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. 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:
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...
). You can even check if it is normal in the packaged apk
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.