Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Build Challenge for Android(TM)                          2011/11/22
2                                Step 1 -Copyright (C) mixi, Inc. All rights reserved.
3     Step 1 -0.     Eclipse + ADT Plugin       Eclipse: http://www.eclipse.org/downloads/          Eclipse IDE for Java D...
4     Step 1 -1.     mixi Developer Center       URL      http://developer.mixi.co.jp/                                    ...
5     Step 1 -1.                URL                      Copyright (C) mixi, Inc. All rights reserved.
6     Step 1 -1.     1.     C:Users[User Name].android     2.          ● keytool -list -v -keystore debug.keystore -alias ...
7     Step 1 -1.                URL                      Copyright (C) mixi, Inc. All rights reserved.
8     Step 1 -2.                Copyright (C) mixi, Inc. All rights reserved.
9     Step 1 -3.                                                 UTF-8                Copyright (C) mixi, Inc. All rights ...
10     Step 1 -3.                  Java                     1.6                Copyright (C) mixi, Inc. All rights reserved.
11 Step 1 -4. Consumer Key  MixiAndroidExample    MixiAndroidExampleActivity.java 34      CLIENT_ID                       ...
12     Step 1 -5.     Android                Copyright (C) mixi, Inc. All rights reserved.
13 Step 1 -6. Android  Activity    MixiAndroidExampleActivity    Activity           onCreate()       1.               Load...
14                 Step 2 -Copyright (C) mixi, Inc. All rights reserved.
15     Step 2 -0.     1.     2. API     3. JSON     4.     5.                Copyright (C) mixi, Inc. All rights reserved.
16     Step 2 -0.       MixiContainer#authorize()       MixiContainer#isAuthorized()                         …       77   ...
17     Step 2 -0.       MixiContainer#authorizeCallback()                        MixiContainer                         …  ...
18     Step 2 -1.       131       onInitialized()        API          loadSelfProfile()          loadVoice()              ...
19     Step 2 -1.     API       MixiContainer#send()                         …       159       send()           API       ...
20     Step 2 -1.       API          /voice/statuses/friends_timeline          key          value       CallbackListener  ...
21     Step 2 -1.     JSON       CallbackListener#onComplete()                Bundle       Bundle#getString()       168   ...
22     Step 2 -                                                [1.                                                      { ...
23     Step 2 -                                                   [1.                                                     ...
24     Step 2 -1.       1.       JSONArray       2. JSONArray    JSONObject 1       3. JSONObject       4.              Mi...
25     Step 2 -2.     MixiVoice            ArrayList                            ListView                 Copyright (C) mix...
26     Step 2 -2.     ListView     1.                    ListView     2.         ListView                                 ...
27     Step 2 -2.       MixiAndroidExample res layout main.xml                                     XML       ListView     ...
28     Step 2 -2.                     ListView                                                     Adapter       MixiAndro...
29     Step 2 -2.     ListView                                              Adapter     1. MixiAndroidExampleActivity     ...
30     Step 2 -2.     ListView                                                       Adapter                public class M...
31     Step 2 -2.     ListView                                                         Adapter       getView()            ...
32     Step 2 -2.     addVoicesToListView()     1.                     Adapter     2. MixiVoice                           ...
33     Step 2 -3.     showVoices(voices) addVoicesToList(voices)                              Copyright (C) mixi, Inc. All...
34Copyright (C) mixi, Inc. All rights reserved.
Upcoming SlideShare
Loading in …5
×

mixi Build Challenge for Android 2011 - Tutorial

12,391 views

Published on

This is the tutorial document for mixi Build Challenge for Android, held on November 22th, 2011, at mixi, Inc.

このドキュメントは、2011年11月22日に株式会社ミクシィにて開催されました、Build Challenge for Androidのチュートリアルです。

Published in: Technology
  • Be the first to comment

mixi Build Challenge for Android 2011 - Tutorial

  1. 1. Build Challenge for Android(TM) 2011/11/22
  2. 2. 2 Step 1 -Copyright (C) mixi, Inc. All rights reserved.
  3. 3. 3 Step 1 -0. Eclipse + ADT Plugin Eclipse: http://www.eclipse.org/downloads/ Eclipse IDE for Java Developers ADT Plugin: http://dl-ssl.google.com/android/eclipse/ eclipse Android SDK http://developer.android.com/sdk/index.html Android 4.0 mixi API SDK for Android(TM) http://developer.mixi.co.jp/appli/spec/android/download/ Mixi Android Example https://github.com/mixi-inc/mixi-api-sdk-android-sample Copyright (C) mixi, Inc. All rights reserved.
  4. 4. 4 Step 1 -1. mixi Developer Center URL http://developer.mixi.co.jp/ Copyright (C) mixi, Inc. All rights reserved.
  5. 5. 5 Step 1 -1. URL Copyright (C) mixi, Inc. All rights reserved.
  6. 6. 6 Step 1 -1. 1. C:Users[User Name].android 2. ● keytool -list -v -keystore debug.keystore -alias androiddebugkey 3. android 4. SHA1 :( ) Copyright (C) mixi, Inc. All rights reserved.
  7. 7. 7 Step 1 -1. URL Copyright (C) mixi, Inc. All rights reserved.
  8. 8. 8 Step 1 -2. Copyright (C) mixi, Inc. All rights reserved.
  9. 9. 9 Step 1 -3. UTF-8 Copyright (C) mixi, Inc. All rights reserved.
  10. 10. 10 Step 1 -3. Java 1.6 Copyright (C) mixi, Inc. All rights reserved.
  11. 11. 11 Step 1 -4. Consumer Key MixiAndroidExample MixiAndroidExampleActivity.java 34 CLIENT_ID Consumer Key Copyright (C) mixi, Inc. All rights reserved.
  12. 12. 12 Step 1 -5. Android Copyright (C) mixi, Inc. All rights reserved.
  13. 13. 13 Step 1 -6. Android Activity MixiAndroidExampleActivity Activity onCreate() 1. Loading 2. Activity 3. MixiContainer(mixi Graph API ) Activity onDestroy() Copyright (C) mixi, Inc. All rights reserved.
  14. 14. 14 Step 2 -Copyright (C) mixi, Inc. All rights reserved.
  15. 15. 15 Step 2 -0. 1. 2. API 3. JSON 4. 5. Copyright (C) mixi, Inc. All rights reserved.
  16. 16. 16 Step 2 -0. MixiContainer#authorize() MixiContainer#isAuthorized() … 77 onLoginClick() Copyright (C) mixi, Inc. All rights reserved.
  17. 17. 17 Step 2 -0. MixiContainer#authorizeCallback() MixiContainer … 65 onActivityResult() MixiContainer#authorizeCallback() Copyright (C) mixi, Inc. All rights reserved.
  18. 18. 18 Step 2 -1. 131 onInitialized() API loadSelfProfile() loadVoice() Copyright (C) mixi, Inc. All rights reserved.
  19. 19. 19 Step 2 -1. API MixiContainer#send() … 159 send() API ( ) (java.util.Map) CallbackListener Copyright (C) mixi, Inc. All rights reserved.
  20. 20. 20 Step 2 -1. API /voice/statuses/friends_timeline key value CallbackListener →onComplete →onFatal, onError →onCancel Copyright (C) mixi, Inc. All rights reserved.
  21. 21. 21 Step 2 -1. JSON CallbackListener#onComplete() Bundle Bundle#getString() 168 values.getString(“response”); Copyright (C) mixi, Inc. All rights reserved.
  22. 22. 22 Step 2 - [1. { “created_at”: “Thu Nov 17 06:29:28 +0000 2011”, “favorite_count”: “0”, JSON “favorited”: false, “id”: “1FZ3P4ACUWBBC-20111117062928”, “reply_count”: “0”, JSON “text”: “Hello World!!”, “user”: { “id”: “1FZ3P4ACUWBBC”, created_at “profile_image_url”: “http://profile.img.mixi.jp/photo/user/ 1FZ3P4ACUWBBC_301280930.jpg”, “screen_name”: “Nickname”, “url”: “http://mixi.jp/show_friend.pl?uid=1FZ3P4ACUWBBC”, favorite_count } }, { “created_at”: “Thu Nov 17 06:26:00 +0000 2011”, favorited “favorite_count”: “1”, “favorited”: true, “id”: “1FZ3P4ACUWBBC-20111117062600”, “reply_count”: “3”, id “text”: “Hello World.”, “user”: { ID “id”: “1FZ3P4ACUWBBC”, “profile_image_url”: “http://profile.img.mixi.jp/photo/user/ 1FZ3P4ACUWBBC_301280930.jpg”, reply_count “screen_name”: “Nickname”, “url”: “http://mixi.jp/show_friend.pl?uid=1FZ3P4ACUWBBC”, } }, text { ... }, ... user ] Copyright (C) mixi, Inc. All rights reserved.
  23. 23. 23 Step 2 - [1. { “created_at”: “Thu Nov 17 06:29:28 +0000 2011”, “favorite_count”: “0”, JSON “favorited”: false, “id”: “1FZ3P4ACUWBBC-20111117062928”, “reply_count”: “0”, “text”: “Hello World!!”, “user”: { “id”: “1FZ3P4ACUWBBC”, org.json.JSONObject “profile_image_url”: “http://profile.img.mixi.jp/photo/user/ 1FZ3P4ACUWBBC_301280930.jpg”, “screen_name”: “Nickname”, “url”: “http://mixi.jp/show_friend.pl?uid=1FZ3P4ACUWBBC”, } }, {...} { “created_at”: “Thu Nov 17 06:26:00 +0000 2011”, org.json.JSONArray “favorite_count”: “1”, “favorited”: true, JSONObject “id”: “1FZ3P4ACUWBBC-20111117062600”, “reply_count”: “3”, [...] “text”: “Hello World.”, “user”: { “id”: “1FZ3P4ACUWBBC”, “profile_image_url”: “http://profile.img.mixi.jp/photo/user/ 1FZ3P4ACUWBBC_301280930.jpg”, “screen_name”: “Nickname”, “url”: “http://mixi.jp/show_friend.pl?uid=1FZ3P4ACUWBBC”, } }, { ... }, ... ] Copyright (C) mixi, Inc. All rights reserved.
  24. 24. 24 Step 2 -1. 1. JSONArray 2. JSONArray JSONObject 1 3. JSONObject 4. MixiVoice 5. MixiVoice ArrayList Copyright (C) mixi, Inc. All rights reserved.
  25. 25. 25 Step 2 -2. MixiVoice ArrayList ListView Copyright (C) mixi, Inc. All rights reserved.
  26. 26. 26 Step 2 -2. ListView 1. ListView 2. ListView Adapter 3. ArrayList Adapter Copyright (C) mixi, Inc. All rights reserved.
  27. 27. 27 Step 2 -2. MixiAndroidExample res layout main.xml XML ListView <ListView> <ListView android:id=”@+id/list” android:layout_width=”fill_parent” <Button> android:layout_height=”fill_parent” android:layout_weight=”1” /> <ListView> android:id @+id/ id fill_parent android:layout_width wrap_content android:layout_height android:layout_weight Copyright (C) mixi, Inc. All rights reserved.
  28. 28. 28 Step 2 -2. ListView Adapter MixiAndroidExampleActivity.java 1. ListView Adapter 2. addVoicesToListView() 3. showVoices() addVoicesToListView() Copyright (C) mixi, Inc. All rights reserved.
  29. 29. 29 Step 2 -2. ListView Adapter 1. MixiAndroidExampleActivity 2. ArrayAdapter public class MixiAndroidExampleActivity extends Activity { ... public static class MixiVoiceListAdapter extends ArrayAdapter<MixiVoice> { ... } ... } Copyright (C) mixi, Inc. All rights reserved.
  30. 30. 30 Step 2 -2. ListView Adapter public class MixiAndroidExampleActivity extends Activity { ... public static class MixiVoiceListAdapter extends ArrayAdapter<MixiVoice> { // public MixiVoiceListAdapter(Context context, List<MixiVoice> list) { //ArrayAdapter super(context, android.R.layout.simple_list_item_2, android.R.id.text1, list); } ... } ... } Copyright (C) mixi, Inc. All rights reserved.
  31. 31. 31 Step 2 -2. ListView Adapter getView() public class MixiAndroidExampleActivity extends Activity { ... public static class MixiVoiceListAdapter extends ArrayAdapter<MixiVoice> { ... @Override public View getView(int position, View convertView, ViewGroup parent) { //ArrayAdapter getView() View view = super.getView(position, convertView, parent); // TextView //findViewById() Id TextView text1 = (TextView)view.findViewById(android.R.id.text1); TextView text2 = (TextView)view.findViewById(android.R.id.text2); // MixiVoice TextView MixiVoice item = getItem(position); text1.setText(item.screenName); text2.setText(item.text); return View; } } ... } Copyright (C) mixi, Inc. All rights reserved.
  32. 32. 32 Step 2 -2. addVoicesToListView() 1. Adapter 2. MixiVoice ArrayList Adapter public class MixiAndroidExampleActivity extends Activity { MixiVoiceListAdapter mListAdapter; ... public void addVoicesToList(ArrayList<MixiVoice> voices) { //R.id.list list ListView android:id ListView listView = (ListView)findViewById(R.id.list); if (mListAdapter == null) { //new MixiVoiceListAdapter() mListAdapter = new MixiVoiceListAdapter(this, voices); //ListView Adapter listView.setAdapter(mListAdapter); } ... } ... } Copyright (C) mixi, Inc. All rights reserved.
  33. 33. 33 Step 2 -3. showVoices(voices) addVoicesToList(voices) Copyright (C) mixi, Inc. All rights reserved.
  34. 34. 34Copyright (C) mixi, Inc. All rights reserved.

×