Android,How to start a new Activity from a dialog? -



Android,How to start a new Activity from a dialog? -

i start new activity custom dialog, have simple button , want when press button new activity start.

i seek start:

intent intent=new intent(arg0.getcontext(),idresult.class); startactivityforresult(intent, 0);

but doesn't work; how can create work?

use

public class customdialog extends dialog implements onclicklistener { button okbutton, cancelbutton; activity mactivity; public customdialog(activity activity) { super(activity); mactivity = activity; setcontentview(r.layout.custom_dialog); okbutton = (button) findviewbyid(r.id.button_ok); okbutton.setonclicklistener(this); cancelbutton = (button) findviewbyid(r.id.button_cancel); cancelbutton.setonclicklistener(this); } @override public void onclick(view v) { if (v == cancelbutton) dismiss(); else { intent = new intent(mactivity, idresult.class); mactivity.startactivity(i); } } }

android android-activity

Comments

Popular posts from this blog

java - How to pass parameters between Request-Scoped Controllers? -

string - what is the difference between "some" == "some\0" and strcmp("some","some\0") in c++? -

actionscript 3 - Flex: moving a point with rotation doesnt change the point XY? -