title: Android Facebook SDK - programmatically login user
body: <p>I am using the following sample project (which im trying to modify):
  <a href="https://github.com/fbsamples/android-3.0-howtos/tree/master/PublishFeedHowTo" rel="nofollow">https://github.com/fbsamples/android-3.0-howtos/tree/master/PublishFeedHowTo</a></p>
  
  <p>There is a separate LoginButton and a Share Button in the project. The LoginButton is the widget from the Facebook SDK. I want to have a single button that will log in the user if its not already logged in and then automatically perform the share action. I couldn't manage to open a session programmatically. What code should I write to be able to login the user from my custom button or via code? </p>
  
  <p>The code bellow is part of the sample project, all the session logic is encapusulated inside the LoginButton widget. I need to be able to perform the same action through my own button / code.</p>
  
  <pre><code>    LoginButton authButton = (LoginButton) view.findViewById(R.id.authButton);
      authButton.setFragment(this);
  </code></pre>
  
  <p>Although I found other threads on this topic, I couldn't find any answer. I don't want to use third party libraries, I would like to know if I can achieve this with the official Facebook SDK for Android.</p>