title: Android Dialog with SharedPreferences
body: <p>If you press a button in my app, a Dialog will show up with some textviews which has to be loaded with text via SharedPreference. But when I want to do this, the app is crashing..</p>
  
  <p>Here's my code:</p>
  
  <pre><code>      @Override
      public void onClick(View arg0) {
  
          // show up view met medische specialisten
  
          final Dialog settingsDialog = new Dialog(Gevaar.this);
          settingsDialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
          settingsDialog.setContentView(getLayoutInflater().inflate(R.layout.dialogms_layout
                  , null));
          settingsDialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
  
  
  
  
          Button dialogButton = (Button) settingsDialog.findViewById(R.id.terugms);
          // if button is clicked, close the custom dialog
          dialogButton.setOnClickListener(new Button.OnClickListener() {
              @Override
              public void onClick(View v) {
                  settingsDialog.dismiss();
              }
          });
  
  
  
  
  
  
          settingsDialog.show();
  
  
  
          final TextView popuptxt1 = (TextView)findViewById(R.id.mspopuptxt1);
          String naamms1 = myPrefs.getString("NAAMMS1", null);
          popuptxt1.setText(naamms1);
  </code></pre>
  
  <p>I've 'designed' the Dialog (of course) in a simple layout.</p>
  
  <p>So what is the problem with my code?</p>
  
  <p>EDIT </p>
  
  <p>Logcat:  </p>
  
  <pre><code>10-28 18:16:24.940    2239-2239/com.stylo.diabetes E/AndroidRuntime﹕ FATAL EXCEPTION: main
  java.lang.NullPointerException
          at com.stylo.diabetes.Gevaar$10.onClick(Gevaar.java:453)
          at android.view.View.performClick(View.java:4240)
          at android.view.View$PerformClick.run(View.java:17721)
          at android.os.Handler.handleCallback(Handler.java:730)
          at android.os.Handler.dispatchMessage(Handler.java:92)
          at android.os.Looper.loop(Looper.java:137)
          at android.app.ActivityThread.main(ActivityThread.java:5103)
          at java.lang.reflect.Method.invokeNative(Native Method)
          at java.lang.reflect.Method.invoke(Method.java:525)
          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
          at dalvik.system.NativeStart.main(Native Method)
  </code></pre>