My program runs an activity on startup, afterwards it sends an Intent opening another activity. The first time this happens, I want to save the information from the Intent
to the savedInstanceState
so whenever the app is opened again that information is available. The code looks like this:
savedInstanceState.putString("name", getIntent().getStringExtra("name"));
savedInstanceState.putString("font", getIntent().getStringExtra("font"));
savedInstanceState.putInt("background", getIntent().getIntExtra("background", R.drawable.bg1big));
However I continue to get a NullPointerException
saying
Attempt to invoke virtual method 'void android.os.Bundle.putString(java.lang.String, java.lang.String)' on a null object reference.