title: Logout functionality in android
body: <p>I am making a kind of social networking app. I am implementing log-out functionality in it.
  On Logout button click it should navigate to login screen but instead it is now navigating to the home page screen.I am using the following code for logout..</p>
  
  <pre><code>  IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction("com.package.ACTION_LOGOUT");
    registerReceiver(new BroadcastReceiver() {
      public void onReceive(Context context, Intent intent) {
  
           System.out.println("onReceive Log out in progress");
            Intent intent1 = new Intent(getApplicationContext(),          Login.class);
                      startActivity(intent1);
                                  finish();
                  }
              }, intentFilter);
  </code></pre>