title: Perform logout in next activity on actionbar
body: <p>I'm using <a href="http://developers.facebook.com/docs/tutorials/androidsdk/3.0/scrumptious/authenticate/" rel="nofollow">this</a> tutorial . I have login and logout by facebook in MainActivity , and the problem is how can i perform a logout in the next (Home) activity ? For HomeActivity , i create on my own(by create new activity).<br><br>
  <b>Here is the code for home activity</b><br><br></p>
  
  <pre><code>package com.innoark.motivator;
  
  import android.app.Activity;
  import android.content.Intent;
  import android.os.Bundle;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.widget.Button;
  
  import com.facebook.Session;
  
  public class Home extends Activity {
  
      Button button;
      MenuItem logout , writepost , send;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_home);
  
      }
  
  
      @Override
      public boolean onPrepareOptionsMenu(Menu menu) {
          Session session = Session.getActiveSession();
          if (session != null &amp;&amp; session.isOpened()) {
              if (menu.size() == 0) {
                  writepost = menu.add(R.string.writepost);
                  logout = menu.add(R.string.settings);
  
              }
              return true;
          } else {
              menu.clear();
              logout = null;
              writepost = null;
          }
      return true;
      }
  
  //  @Override
      public boolean onOptionsItemSelected(MenuItem item) {
          if (item.equals(logout)) {
  
              return true;
          }
          if (item.equals(writepost)){
              Intent intent = new Intent (this,MainActivity.class);
              startActivity(intent);
          }
          return true;
      }
  
  }
  </code></pre>
  
  <p>Thanks in advance :)</p>