Sunday, 15 August 2010

java - android programming reuse dialogfragment -



java - android programming reuse dialogfragment -

my android app has been suspended play store because of play store policy:

do not send sms, email, or other messages on behalf of user without providing user ability confirm content , intended recipient.

my application vas sms application telecommunication provider. trying create confirmation sms send using dialogframent. want have single dialog class , method reuse sms sending confirmation. have through forum can find looking for.

what manage have was

public class sendsms extends activity { public sendsms(final string phoneno, final string sms) { dialoginterface.onclicklistener dialogclicklistener = new dialoginterface.onclicklistener() { @override public void onclick(dialoginterface dialog, int which) { switch (which) { case dialoginterface.button_positive: //do yes progress seek { smsmanager smsmanager = smsmanager.getdefault(); smsmanager.sendtextmessage(phoneno, null, sms, null, null); toast.maketext(getapplicationcontext(), "request sent!", toast.length_long).show(); // finish(); } grab (exception e) { toast.maketext(getapplicationcontext(), "request faild, please seek 1 time again later!", toast.length_long).show(); e.printstacktrace(); } break; case dialoginterface.button_negative: //do no progress dialog.cancel(); break; } } }; alertdialog.builder ab = new alertdialog.builder(this); ab.setmessage("are sure delete?").setpositivebutton("yes", dialogclicklistener) .setnegativebutton("no", dialogclicklistener).show(); return; //alertdialog alertdialog = ab.create(); // alertdialog.show(); } }

and calling in activity as:

new sendsms(phoneno, sms);

but whenever click on function app crashes nullpointerexception error. need help have several sms trigger methods rewriting confirmation on , on seems bit on kill.

java android

No comments:

Post a Comment