i'm having a problem with starting activity from inside java class , i want to active an activity from java class i tried this code but it doesn't work :
public class AlMA_PRO_Class{
public static void Start_Setting(){
ActionBarActivity mn = new MainActivity2(); // this is the setting activity
//i've tried it like this way ==> mn.setContentView(R.layout.activity_main_activity2);
//but not working , so i've tried this code below
Bundle b = new Bundle();
b.putString("command","not used , just because it's needed");
startActivity(new Activity(), new Intent(new Activity(),MainActivity2.class), b);
}
}
and it return with the following error :
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Context.getPackageName()' on a null object reference
i've tested many many different ways to do it ,but nothing worked !! any help ?