編輯:關於Android編程
1、首先是要先下載 FaceBook SDK Android 版;
2、導入FaceBookSDK 作為Library 引入到自己的項目中
3、在FaceBook 注冊一個 測試應用
4、配置AndroidManifest.xml:
5、添加 Facebook 登錄按鈕 :1548440642074664
public class MainActivity extends Activity { private static final String TAG = "MainActivity"; private UiLifecycleHelper uiHelper; private Session.StatusCallback callback = new Session.StatusCallback() { @Override public void call(Session session, SessionState state, Exception exception) { onSessionStateChange(session, state, exception); } }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); uiHelper = new UiLifecycleHelper(MainActivity.this, callback); uiHelper.onCreate(savedInstanceState); setContentView(R.layout.activity_main); LoginButton authButton = (LoginButton) findViewById(R.id.login_button); authButton.setReadPermissions(Arrays .asList("email","user_likes", "user_status")); } private void onSessionStateChange(Session session, SessionState state, Exception exception) { if (state.isOpened()) { Log.i(TAG, "Logged in..."); } else if (state.isClosed()) { Log.i(TAG, "Logged out..."); } } @Override public void onResume() { super.onResume(); // For scenarios where the main activity is launched and user // session is not null, the session state change notification // may not be triggered. Trigger it if it's open/closed. Session session = Session.getActiveSession(); if (session != null && (session.isOpened() || session.isClosed())) { onSessionStateChange(session, session.getState(), null); } uiHelper.onResume(); } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); uiHelper.onActivityResult(requestCode, resultCode, data); } @Override public void onPause() { super.onPause(); uiHelper.onPause(); } @Override public void onDestroy() { super.onDestroy(); uiHelper.onDestroy(); } @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); uiHelper.onSaveInstanceState(outState); } }
private void getUserInfo() { String fqlQuery = "SELECT uid,name,email FROM user WHERE uid = me()"; Bundle params = new Bundle(); params.putString("q", fqlQuery); Request request = new Request(Session.getActiveSession(), "/me", params, HttpMethod.GET, new Request.Callback(){ public void onCompleted(Response response) { String str = response.toString(); Log.i(TAG, str); } }); Request.executeBatchAsync(request); }
昨天琢磨了下Android的輸入法彈出模式,突然發現利用動態切換輸入法的彈出模式可以解決輸入法抖動的問題。具體是怎樣的抖動呢?我們先看微博的反面教材。 【具體表現為:表情
關於Ditscc分布式編譯環境的搭建,網上也有不少文章,但是基本上都過時了。所以看了很多文章,走了不少彎路,最後總算梳理清楚了一條正確的環境搭建的步驟,而且可以實現zer
使用命令行創建項目cordova 創建項目的命令是cordova create 第一個參數 < dir >:項目目錄文件夾的名稱第二個參數< packa
本文較為詳細的總結分析了Android編程下拉菜單spinner用法。分享給大家供大家參考,具體如下:Spinner控件也是一種列表類型的控件,它的繼承關系如下:java