简体   繁体   English

Android:android.content.res.Resources$NotFoundException: 资源 ID #0x0 in

[英]Android:android.content.res.Resources$NotFoundException: Resource ID #0x0 in

i'm new to android and its my first attempt paymnet getway intigration with android app.I got the 'sdk' for android from atom's official site and correctly intigrate it, when I'm trying to call PayActivity.java from library MobilePaymentSDKOutput.jar which androidsdk given by atom payment getway. i'm new to android and its my first attempt paymnet getway intigration with android app.I got the 'sdk' for android from atom's official site and correctly intigrate it, when I'm trying to call PayActivity.java from library MobilePaymentSDKOutput.jar atom支付androidsdk给出的androidsdk。 When i run the app in emulator it shows following error:当我在模拟器中运行应用程序时,它显示以下错误:

java.lang.RuntimeException: Unable to start activity ComponentInfo{in.lightwave.plwpay/com.atom.mobilepaymentsdk.PayActivity}: android.content.res.Resources$NotFoundException: Resource ID #0x0
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2913)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6669)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
     Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x0
        at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:216)
        at android.content.res.Resources.loadXmlResourceParser(Resources.java:2155)
        at android.content.res.Resources.getLayout(Resources.java:1155)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:421)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
        at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:420)
        at android.app.Dialog.setContentView(Dialog.java:557)
        at a.a(SourceFile:66)
        at j.onPreExecute(SourceFile:796)
        at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:648)
        at android.os.AsyncTask.execute(AsyncTask.java:595)
        at com.atom.mobilepaymentsdk.PayActivity.onCreate(SourceFile:2215)
        at android.app.Activity.performCreate(Activity.java:7136)
        at android.app.Activity.performCreate(Activity.java:7127)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048) 
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78) 
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108) 
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loop(Looper.java:193) 
        at android.app.ActivityThread.main(ActivityThread.java:6669) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) 

here is the java code:这是 java 代码:

    public class MainActivity extends AppCompatActivity {
TextView whichCard;
ImageButton payNow,cancel;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    Toast.makeText(this, ""+ Constants.whichCard, Toast.LENGTH_SHORT).show();
    try {
        if (!Constants.whichCard.equals("")) {
            whichCard.setText(Constants.whichCard);
        }
        else {
            Toast.makeText(this, "Nullll", Toast.LENGTH_SHORT).show();
        }
    }catch (Exception e){}

    payNow= findViewById(R.id.payNow);
    cancel= findViewById(R.id.cancelPay);


    cancel.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {

        }
    });
    payNow.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Intent newPayIntent = new Intent(MainActivity.this, PayActivity.class);

            newPayIntent.putExtra("merchantId", "459");
            newPayIntent.putExtra("txnscamt", "0"); //Fixed. Must be �0�
            newPayIntent.putExtra("loginid", "459");
            newPayIntent.putExtra("password", "Test@123");
            newPayIntent.putExtra("prodid", "NSE");
            newPayIntent.putExtra("txncurr", "INR"); //Fixed. Must be �INR�
            newPayIntent.putExtra("clientcode", "001");
            newPayIntent.putExtra("custacc", "100000036900");
            newPayIntent.putExtra("amt", "50.000");//Should be 3 decimal number i.e 1.000
            newPayIntent.putExtra("txnid", "01");
            newPayIntent.putExtra("date", "25/08/2015 18:31:00");//Should be in same format
            newPayIntent.putExtra("bankid", "2019"); //Should be valid bank id

            //use below Production url only with Production "Library-MobilePaymentSDK", Located inside PROD folder
            //newPayIntent.putExtra("ru","https://payment.atomtech.in/mobilesdk/param"); //ru FOR Production

            //use below UAT url only with UAT "Library-MobilePaymentSDK", Located inside UAT folder
            newPayIntent.putExtra("ru", "https://paynetzuat.atomtech.in/mobilesdk/param"); // FOR UAT (Testing)

            //Optinal Parameters
            newPayIntent.putExtra("customerName", "Sweta sap"); //Only for Name
            newPayIntent.putExtra("customerEmailID", "sap.sweta@atomtech.in");//Only for Email ID
            newPayIntent.putExtra("customerMobileNo", "9876043210");//Only for Mobile Number
            newPayIntent.putExtra("billingAddress", "Mumbai");//Only for Address
            newPayIntent.putExtra("optionalUdf9", "OPTIONAL DATA 1");// Can pass any data

            startActivityForResult(newPayIntent, 1);
        }
    });

}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (requestCode == 1)
    {
        if (data != null)
        {
            String message = data.getStringExtra("status");
            String[] resKey = data.getStringArrayExtra("responseKeyArray");
            String[] resValue = data.getStringArrayExtra("responseValueArray");

            if(resKey!=null && resValue!=null)
            {
                for(int i=0; i<resKey.length; i++)
                    System.out.println("  "+i+" resKey : "+resKey[i]+" resValue : "+resValue[i]);
            }
            Toast.makeText(this, message, Toast.LENGTH_LONG).show();

        }
    }

}

} }

Kindly guide me how to solve this issue.请指导我如何解决这个问题。

If you are sure that PayActivity is there and there is no problem, I suggest you try with clearing the cache ( Build -> Clean Project or File -> Invalidat Caches/Restart... ).如果您确定PayActivity存在并且没有问题,我建议您尝试清除缓存( Build -> Clean Project or File -> Invalidat Caches/Restart... )。 You can even check if it is normal in the packaged apk .甚至可以在打包的apk中检查是否正常。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 android.content.res.Resources $ NotFoundException:资源ID#0x0 - android.content.res.Resources$NotFoundException: Resource ID #0x0 android.content.res.Resources $ NotFoundException:资源ID#0x0 - android.content.res.Resources$NotFoundException: Resource ID #0x0 音频无法在android中播放。 android.content.res.Resources $ NotFoundException:资源ID#0x0 - Audio not playing in android. android.content.res.Resources$NotFoundException: Resource ID #0x0 android.content.res.Resources $ NotFoundException:资源ID#0x0 Android错误 - android.content.res.Resources$NotFoundException: Resource ID #0x0 Android error Android - android.content.res.Resources $ NotFoundException:资源ID#0x0 - Android - android.content.res.Resources$NotFoundException: Resource ID #0x0 GridView.FATAL例外:main android.content.res.Resources $ NotFoundException:字符串资源ID#0x0 - GridView.FATAL EXCEPTION: main android.content.res.Resources$NotFoundException: String resource ID #0x0 android.content.res.Resources$NotFoundException:使用 RecyclerView 时出现资源 ID #0x0 异常 - android.content.res.Resources$NotFoundException: Resource ID #0x0 exception while using RecyclerView android.content.res.Resources $ NotFoundException:onCreate()之后的资源ID#0x0 - android.content.res.Resources$NotFoundException: Resource ID #0x0 after onCreate() android.content.res.Resources $ NotFoundException:访问getResource()时的字符串数组资源ID#0x0 - android.content.res.Resources$NotFoundException: String array resource ID #0x0 while accessing getResource() android.content.res.Resources$NotFoundException: 字符串资源 ID #0x0 - android.content.res.Resources$NotFoundException: String resource ID #0x0
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM