I have a problem with newbies. Here is my situation:
I want to start a new activity from the main action. The code for starting a new action is in a separate class file. I seem to pass the wrong arguments, and I get a nullpointer exception when trying to start a new action. The new action starts fine when I put the code in the main file of the activity class, so the second action and manifest are great. Here is an example of my code:
In my main class of activity, where I intrude into the second class (THIS IS MY MAIN ACTIVITY. I REFUSED REST, BECAUSE I DO NOT THINK, IT RELATES TO THE PROBLEM):
Tester mytest = new Tester();
mytest.test(this);
In my second class file (THIS IS NOT ACTIVITY: THIS IS A CLASS SPECIFIED IN THE ACTIVITY):
public class Tester extends Activity {
Intent myIntent;
public void test (Context context) {
myIntent = new Intent (Intent.ACTION_VIEW);
myIntent.setClass(context, newActivity.class);
thebutton.setOnClickListener(
new OnClickListener() {
public void onClick(View v) {
startActivity(myIntent);
}
}
):}
, nullpointerexception startactivity. - , ? , .