Wednesday, 11 September 2013

How to start Activity using instance of it?

How to start Activity using instance of it?

I used this code to start a activity but throw a NullPointer and
illegalState exceptions.this is the code.
String test="test";
DownloadActivity downloadAct=new DownloadActivity(test);
Intent intent=new Intent(this,DownloadActivity.class);
downloadAct.startActivity(intent);
Is this possible?And i also tried with
downloadAct.onCreate();
but it need to pass Bundle and i passed
new Bundle();
it throw null pointer exception,So how can i use DownloadActivity
constructers to set its data and start the activity?

No comments:

Post a Comment