I am working in android. i want to make a custom dialog in which i want to add a paypal button.
this is the code for my program:-
public class CustomizeDialog extends Dialog implements OnClickListener {
Button close;
String TAG="CustomizeDialog";
Context customize_dialog;
CheckoutButton launchSimplePayment;
public CustomizeDialog(Context context,String title_of_song,String artist_of_song,float price_of_song) {
super(context);
customize_dialog=context;
setContentView(R.layout.paypal_custom_dialog);
close = (Button) findViewById(R.id.paypal_close);
PayPal pp = PayPal.getInstance();
if (pp == null) {
try {
pp = PayPal.initWithAppID(context, "", PayPal.ENV_NONE);
} catch (IllegalStateException e) {
throw new RuntimeException(e);
}
pp.setShippingEnabled(false);
}
launchSimplePayment = pp.getCheckoutButton(context,
PayPal.BUTTON_118x24, CheckoutButton.TEXT_PAY);
LinearLayout lnr = (LinearLayout) findViewById(R.id.Paypal_Custom_Dialog_View);
launchSimplePayment.setOnClickListener( this);
lnr.addView(launchSimplePayment);
close.setOnClickListener(this);
}
@Override
public void onClick(View v) {
if (v == close)
dismiss();
if(v==launchSimplePayment)
{
PayPalPayment payment = new PayPalPayment();
payment.setSubtotal(new BigDecimal("2.25"));
payment.setCurrencyType("USD");
payment.setRecipient("kuntal_1316186174_biz@gmail.com");
payment.setPaymentType(PayPal.PAYMENT_TYPE_GOODS);
Intent checkoutIntent =
PayPal.getInstance().checkout(payment,customize_dialog);
startActivityForResult(checkoutIntent, 1); **//this line is creating error that startActivityForResult() is undefined for type CustomizeDialog**
}
}
are we not apply CustomizeDialog() for a activity which is extending Dialog ? (as i done in my this program)
please suggest me what should i do for this ?
Thank you in advance…
You can use the Activity whose theme is Dialog. This way you can achieve startActivityForResult as well as make it look like Dialog.