title: After installing the app , when I open app and give email and password as input, app closes in android
body: <p>I am trying to login the user through networking by using OkHttp library to send request and getting response. After running these when I open app and enter email and password as input and press the login button, my app crashes.</p>
  
  <p><strong>LoginFragment:</strong></p>
  
  <pre><code> public void onClick(View view) {
              String a=ed1.getText().toString();
              String b=ed2.getText().toString();
              Log.e("sas", "onClick: "+a );
                  NetworkRequestAndResponse asyncTask = new NetworkRequestAndResponse(getActivity());
                  asyncTask.execute(a,b);
          }
      });
      return view;
  </code></pre>
  
  <p><strong>AsyncTask:</strong></p>
  
  <pre><code>    public class NetworkRequestAndResponse extends AsyncTask&lt;String,String,String&gt; {
      Context context;
  
      public NetworkRequestAndResponse(Context context){
          this.context = context.getApplicationContext();
      }
  
      @Override
      protected String doInBackground(String... params) {
          OkHttpClient okHttpClient = new OkHttpClient();
          RequestBody requestBody= new FormBody.Builder().add("email",params[0])
                          .add("password",params[1]).build();
          Request request = new Request.Builder().url("http://192.168.1.8:8011/api/check")
                          .post(requestBody).build();
          Log.e("asd", "doInBackground: "+request );
          Response response=null;
          try {
              response = okHttpClient.newCall(request).execute();
            return response.body().string();
          } catch (RuntimeException|IOException e){
              Log.e("455", "doInBackground: ",e );
          }
          finally {
              response.close();
          }
          return null;
  
      }
  
      @Override
      protected void onPostExecute(String obj){
  
          if (obj.equals("true")){
              Intent intent = new Intent(context, WelcomeActivity.class);
              context.startActivity(intent);
          }else{
              Toast.makeText(context,"Invalid Email or Password",Toast.LENGTH_SHORT).show();
          }
      }
  }
  </code></pre>
  
  <p><strong>MainActivity:</strong></p>
  
  <pre><code>    protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      android.support.v4.app.FragmentManager fragmentManager = getSupportFragmentManager();
      LoginFragment obj = new LoginFragment();
      fragmentManager.beginTransaction().add(R.id.content,obj).commit();
      MessagesFragment messagesFragment = new MessagesFragment();
  }
  }
  </code></pre>
  
  <p><strong>Error:</strong>
  <a href="https://i.stack.imgur.com/7EBqX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7EBqX.png" alt="enter image description here"></a></p>