SHOW:
|
|
- or go back to the newest paste.
1 | ||
2 | import android.app.Activity; | |
3 | import android.os.Bundle; | |
4 | import android.view.View; | |
5 | import android.widget.AdapterView; | |
6 | import android.widget.AdapterView.OnItemSelectedListener; | |
7 | import android.widget.ArrayAdapter; | |
8 | import android.widget.Button; | |
9 | import android.widget.ImageButton; | |
10 | import android.widget.Spinner; | |
11 | import android.widget.Toast; | |
12 | ||
13 | import com.easy.facebook.android.apicall.RestApi; | |
14 | import com.easy.facebook.android.data.Status; | |
15 | import com.easy.facebook.android.error.EasyFacebookError; | |
16 | import com.easy.facebook.android.facebook.FBLoginManager; | |
17 | import com.easy.facebook.android.facebook.LoginListener; | |
18 | import com.facebook.android.Facebook; | |
19 | import com.facebook.android.R; | |
20 | ||
21 | ||
22 | ||
23 | ||
24 | public class Login extends Activity implements LoginListener { | |
25 | private ImageButton mLoginButton; | |
26 | String[] permissions = { "offline_access", "publish_stream", "user_photos", "publish_checkins", | |
27 | "photo_upload" }; | |
28 | private FBLoginManager fbManager; | |
29 | ||
30 | ||
31 | public void onCreate(Bundle savedInstanceState) { | |
32 | ||
33 | super.onCreate(savedInstanceState); | |
34 | setContentView(R.layout.settings); | |
35 | fbManager = new FBLoginManager(this,R.layout.black,"MYFBID",permissions); | |
36 | ||
37 | mLoginButton = (ImageButton) findViewById(R.id.login); | |
38 | mLoginButton.setOnClickListener(new View.OnClickListener() { | |
39 | public void onClick(View vi) { | |
40 | if (fbManager.existsSavedFacebook()) { | |
41 | fbManager.loadFacebook(); | |
42 | } else { | |
43 | ||
44 | fbManager.login(); | |
45 | } | |
46 | ||
47 | } | |
48 | ||
49 | }); | |
50 | } | |
51 | @Override | |
52 | public void loginSuccess( | |
53 | com.easy.facebook.android.facebook.Facebook facebook) { | |
54 | // TODO Auto-generated method stub | |
55 | RestApi restApi= new RestApi(facebook); | |
56 | ||
57 | Status status = new Status(); | |
58 | ||
59 | try { | |
60 | status = restApi.getCurrentStatus(); | |
61 | } catch (EasyFacebookError e) { | |
62 | e.toString(); | |
63 | } | |
64 | ||
65 | } | |
66 | @Override | |
67 | public void logoutSuccess() { | |
68 | // TODO Auto-generated method stub | |
69 | ||
70 | } | |
71 | @Override | |
72 | public void loginFail() { | |
73 | // TODO Auto-generated method stub | |
74 | ||
75 | } | |
76 | } |