title: Android Intent with NullPointerException
body: <p>There are many many questions about starting new <code>Intent</code> from another <code>Intent</code> but i'm unable to find solutions of mine. In my main <code>Activity</code> i started an <code>Activity</code> this way</p>
  
  <pre><code>Intent intent = new Intent(MainActivity.this, DownloadManagerSettings.class);
  intent.putExtra("DM_SETTINGS_ACTIVITY", "MainActivity");
  startActivity(intent);
  </code></pre>
  
  <p>and trying to get extra <code>String</code> value this way</p>
  
  <pre><code>public class DownloadManagerSettings extends Activity {
  
  private Button dmOk;
  private Bundle extra;
  private String className;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.dm_settings);
      extra = getIntent().getExtras();
  
      dmOk = (Button) findViewById(R.id.dm_settings_ok);
  
      final Bundle strExtra = extra;
  
      dmOk.setOnClickListener(new View.OnClickListener() {
  
          @Override
          public void onClick(View v) {
              // TODO Auto-generated method stub
  
              className = strExtra.getString("DM_SETTINGS_ACTIVITY");
              try {
                  Intent intent = new Intent(DownloadManagerSettings.this, Class.forName(className));
                  startActivity(intent);
              } catch (ClassNotFoundException e) {
                  e.printStackTrace();
              }
          }
      });
  }
  </code></pre>
  
  <p>But in my LogCat shows following error</p>
  
  <pre><code>08-28 14:19:33.777: E/AndroidRuntime(17837): java.lang.NullPointerException08-28 14:19:33.777: E/AndroidRuntime(17837):     at com.downloadmanager.settings.DownloadManagerSettings$1.onClick(DownloadManagerSettings.java:101)
  </code></pre>
  
  <p>Here 101 Line is</p>
  
  <pre><code>className = strExtra.getString("DM_SETTINGS_ACTIVITY");
  </code></pre>
  
  <p><strong>UPDATE</strong></p>
  
  <p>new error</p>
  
  <pre><code>08-28 14:55:11.237: E/AndroidRuntime(24623): Caused by: java.lang.NullPointerException 08-28 14:55:11.237: E/AndroidRuntime(24623):     at com.downloadmanager.settings.DownloadManagerSettings.onCreate(DownloadManagerSettings.java:66)
  </code></pre>
  
  <p>66 Line is</p>
  
  <pre><code>className = strExtra.getString("DM_SETTINGS_ACTIVITY");
  </code></pre>
  
  <p><strong>NEW UPDATE1</strong></p>
  
  <p>Now</p>
  
  <pre><code>Intent intent = new Intent(MainActivity.this, DownloadManagerSettings.class);
  intent.putExtra(getApplicationContext().getPackageName()+".DM_SETTINGS_ACTIVITY", "MainActivity");
  startActivity(intent);
  </code></pre>
  
  <p>Another Activity</p>
  
  <pre><code>className = getIntent().getStringExtra(getApplicationContext().getPackageName()+".DM_SETTINGS_ACTIVITY");
  final String newClass = className;
  Log.d("DM_AAAAAAAA", className);
  dmOk.setOnClickListener(new View.OnClickListener() {
  </code></pre>
  
  <p>Find in LogCat</p>
  
  <pre><code>08-28 15:09:14.670: E/AndroidRuntime(27291): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.addon.downloadmanager/com.downloadmanager.settings.DownloadManagerSettings}: java.lang.NullPointerException: println needs a message
  </code></pre>
  
  <p>Thanks in advance</p>