title: Java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.Boolean.booleanValue()' on a null object reference
body: <p>So I am coding a translation app and this error is persisting. 
  Here is the code, PLEASE help! </p>
  
  <p>RAW CODE 1</p>
  
  <pre><code>public class MyActivity extends Activity {
      public final static String EXTRA_MESSAGE = "com.mycompany.myfirstapp.MESSAGE"; //Defining EXTRA MESSAGE
      public static Boolean hisCheck;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_my);
          ToggleButton toggle = (ToggleButton) findViewById(R.id.his);
  
      }
  
      public void onCheckedChanged(CompoundButton buttonView, boolean isChecked){
          if(isChecked){
              hisCheck = true; 
          }
          else {
              hisCheck = false; 
          }
      }
  
  
      public void sendMessage(View view){
          Intent intent = new Intent("com.robertb.TRANSLATED");
          EditText editText = (EditText) findViewById(R.id.edit_message);
          String message = editText.getText().toString();
          intent.putExtra(EXTRA_MESSAGE, message);
          startActivity(intent);
  
      }
  
  }
  </code></pre>
  
  <p>RAW CODE 2</p>
  
  <pre><code>    super.onCreate(savedInstanceState);
        // Get the message from the intent
      Intent intent = getIntent();
      String input = intent.getStringExtra(MyActivity.EXTRA_MESSAGE);
      Set&lt;String&gt; output = new HashSet&lt;String&gt;();
      String[] outputS = new String[500];
      Boolean check = MyActivity.hisCheck;
     // output[0] = "There are no detected gender specific words within your submitted message";
      int j = 0;
      String outputFinal;;
  
      List&lt;String&gt; lines = new ArrayList&lt;String&gt;();
      List&lt;String&gt; lines2 = new ArrayList&lt;String&gt;();
      AssetManager assetManager = getAssets();
  
  
   //goodwords array
      try {
          InputStream goodIs = null;
          if(check){
          goodIs = assetManager.open("goodwords.txt");
          }
          if(check){
              goodIs = assetManager.open("goodwordshis.txt");
              }
          BufferedReader reader = new BufferedReader(new InputStreamReader(goodIs));
  
          String line;
  
          while ((line = reader.readLine()) != null) {
  
              lines2.add(line);
  
          }
  
  
      } catch (IOException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      }
  
  
    //badwords array
      try {
          InputStream badIs = null; 
          if(!check){
          badIs = assetManager.open("badwords.txt");
          }if(check){
           badIs = assetManager.open("badwordshis.txt");
          }
  
          BufferedReader reader = new BufferedReader(new InputStreamReader(badIs));
          String line1;
  
          while ((line1 = reader.readLine()) != null) {
  
              lines.add(line1);
  
          }
          String[] arrayBad = lines.toArray(new String[0]);
  
      } catch (IOException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      }
  
      String[] arrayGood = lines2.toArray(new String[0]);
      String[] arrayBad = lines.toArray(new String[0]);
  
      String[] words = input.split("\\W");
  
  
  
      for(int i1 = 0; i1 &lt; words.length; ++i1){
           for(int i = 0; i &lt; arrayBad.length; ++i)
           {
               if(words[i1].equalsIgnoreCase(arrayBad[i])){
                   output.add(arrayBad[i] + " = " + arrayGood[i]);
  
               }
           }
      } 
  
  
          StringBuilder out = new StringBuilder();
  
  
      for( String s : output) {
          out.append( s  + "\n");
          }
      if(output.isEmpty()){
          out.append("There are no detected gender specific words within your submitted message");
      }
      outputFinal = out.toString();
      // Create the text view
      TextView textView = new TextView(this);
      textView.setTextSize(40);
      textView.setText(outputFinal);
  
      // Set the text view as the activity layout
      setContentView(textView);
  
  
      }
   }
  </code></pre>
  
  <p>LOGCAT</p>
  
  <pre><code>    11-06 19:55:40.031: E/AndroidRuntime(28865): FATAL EXCEPTION: main
  11-06 19:55:40.031: E/AndroidRuntime(28865): Process: com.example.android, PID: 28865
  11-06 19:55:40.031: E/AndroidRuntime(28865): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.android/com.example.android.Translated}: java.lang.NullPointerException: lock == null
  11-06 19:55:40.031: E/AndroidRuntime(28865):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2411)
  11-06 19:55:40.031: E/AndroidRuntime(28865):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2474)
  11-06 19:55:40.031: E/AndroidRuntime(28865):    at android.app.ActivityThread.access$800(ActivityThread.java:144)
  11-06 19:55:40.031: E/AndroidRuntime(28865):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1359)
  11-06 19:55:40.031: E/AndroidRuntime(28865):    at android.os.Handler.dispatchMessage(Handler.java:102)
  11-06 19:55:40.031: E/AndroidRuntime(28865):    at android.os.Looper.loop(Looper.java:155)
  11-06 19:55:40.031: E/AndroidRuntime(28865):    at android.app.ActivityThread.main(ActivityThread.java:5696)
  11-06 19:55:40.031: E/AndroidRuntime(28865):    at java.lang.reflect.Method.invoke(Native Method)
  11-06 19:55:40.031: E/AndroidRuntime(28865):    at java.lang.reflect.Method.invoke(Method.java:372)
  11-06 19:55:40.031: E/AndroidRuntime(28865):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1028)
  11-06 19:55:40.031: E/AndroidRuntime(28865):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:823)
  11-06 19:55:40.031: E/AndroidRuntime(28865): Caused by: java.lang.NullPointerException: lock == null
  11-06 19:55:40.031: E/AndroidRuntime(28865):    at java.io.Reader.&lt;init&gt;(Reader.java:64)
  11-06 19:55:40.031: E/AndroidRuntime(28865):    at java.io.InputStreamReader.&lt;init&gt;(InputStreamReader.java:120)
  11-06 19:55:40.031: E/AndroidRuntime(28865):    at java.io.InputStreamReader.&lt;init&gt;(InputStreamReader.java:57)
  11-06 19:55:40.031: E/AndroidRuntime(28865):    at com.example.android.Translated.onCreate(Translated.java:51)
  11-06 19:55:40.031: E/AndroidRuntime(28865):    at android.app.Activity.performCreate(Activity.java:5958)
  11-06 19:55:40.031: E/AndroidRuntime(28865):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1129)
  11-06 19:55:40.031: E/AndroidRuntime(28865):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2364)
  11-06 19:55:40.031: E/AndroidRuntime(28865):    ... 10 more
  </code></pre>
  
  <p>If you want me to sift through this and return only the important Boolean parts, then I can do that. Just ask. It seems like a made a pretty basic error, and I really really need help on this. Thanks! Any ideas where I need to add in a  if(num != null), or if I even need to?</p>