You are accessing a Field that you do not have in Activity
( PaymentActivity
), which I do not think extends from PayPalService
.
intent.putExtra(PaymentActivity.EXTRA_PAYPAL_CONFIGURATION,m_configuration);
EXTRA_PAYPAL_CONFIGURATION is a field of the Service.
intent.putExtra(PayPalService.EXTRA_PAYPAL_CONFIGURATION, m_configuration);
For the implementation I suggest you see this example :
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_paypal);
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
getSupportActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor("#ffffff")));
getSupportActionBar().setDisplayShowTitleEnabled(false);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
Intent intent = new Intent(this, PayPalService.class);
intent.putExtra(PayPalService.EXTRA_PAYPAL_CONFIGURATION, config);
startService(intent);
Log.e(TAG, "Alert Dialog");
new AlertDialog.Builder(this)
.setTitle("Notice")
.setMessage(this.getString(R.string.disclaimer))
.setCancelable(false)
.setIcon(android.R.drawable.ic_dialog_alert)
.setPositiveButton("Ok, I understand", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
PayPalPayment thingToBuy = getThingToBuy(PayPalPayment.PAYMENT_INTENT_SALE);
Intent intent = new Intent(PaypalActivity.this, PaymentActivity.class);
intent.putExtra(PaymentActivity.EXTRA_PAYMENT, thingToBuy);
startActivityForResult(intent, REQUEST_CODE_PAYMENT);
}
})
.setNegativeButton("Nevermind", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
PaypalActivity.this.finish();
}
})
.show();
}