Last active
August 29, 2015 14:16
-
-
Save smison/937607a729fcb5da7a49 to your computer and use it in GitHub Desktop.
AndroidStudioメモ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- 基本操作 | |
- Windowのキーボード移動: Alt+Space > M | |
- プレビューの表示 | |
- http://hipopocroco.hatenablog.com/entry/2014/05/27/234647 | |
- ComponentTreeも同様にこの「Design」表示時に現れる | |
- ショートカット | |
http://qiita.com/sugoi_wada/items/db449d5cbb5c83cb586c | |
- コメントアウト: Ctrl + / | |
- 定義に移動: Ctrl + b | |
- エミュレータを横向きに: ctrl + F11 | |
- レイアウト作成 | |
- レイアウト追加 | |
layout (右クリック)> New > Activity > BlankActivity | |
- リストビュー作成 | |
- ComponentTreeからRelativeLayoutの中身を削除 | |
- RelativeLayout自体は削除できない模様 | |
- http://ja.stackoverflow.com/questions/166/android-studio%E3%81%A7relativelayout%E3%81%AE%E5%89%8A%E9%99%A4%E3%81%8C%E3%81%A7%E3%81%8D%E3%81%AA%E3%81%84 | |
- Palette > Layouts > LinearLayout(Vertical) をComponentTreeに追加 | |
- Pallete > Containers > ListViewをLinearLayout(Vertical)配下に追加 | |
- layout resourceの追加 | |
コンポーネントペイン > layout (右クリック)> New > layout resources | |
- DB | |
- ListView <> CursorLoader <> ContentsProvider <> DB | |
- DBからListViewへの直接の値表示は推奨されない(DBから値を取るときのタイムラグでListViewが固まるため) | |
- ListViewには非同期で値を投げる必要がある => CursorLoaderを使う | |
- ただしCursorLoaderはDBに直接アクセスできないので => ContentsProviderを間に挟む | |
1. ListView | |
https://github.com/smison/database_lesson/commit/e6f7257774e35f2b37467ba2a9180b4a6885b96a | |
- adapterの設定 | |
- ListViewの取得 | |
- ListViewにAdapterを設定 | |
これでCursorLoaderを受けられるようになる | |
2. COrsorLoader | |
https://github.com/smison/database_lesson/commit/1f5cd911b7fafc70305afd2bdd15e0513515694e | |
- LoaderCallbacksをactivityに追加 | |
3. ContentProvier | |
- https://github.com/smison/database_lesson/commit/e320f2ac657482e1b2b55520ca34d8227d4cea2b | |
- URIでtableやrowなどの処理対象を識別 => ContentProvider内にUriMatcherを定義する必要 | |
- https://github.com/smison/database_lesson/commit/e304045ec48db62dbdd1ec3d0c1c19b17186863b | |
- http://ichitcltk.hustle.ne.jp/gudon2/index.php?pageType=file&id=Android033_ContentProvider | |
- SimpleCursorAdapter: http://petitviolet.hatenablog.com/entry/20121127/1354002208 | |
- select: table単位 | |
- insert: table単位 | |
- update: row単位(table名+idがuriになる) | |
- delete: row単位(table名+idがuriになる) | |
- 値を反映 https://github.com/smison/database_lesson/commit/e242a9e80460b7ab3fcc67124ed67cdab92d4515 | |
- VCS | |
- githubからのcloneは VCS > Checkout... > Github | |
- から出来るが、下記でImportしてrepositoryつくった方がquick start出来て楽 | |
- VCS > Import... > Share...Github | |
- 以降の操作はTerminal(左下に存在)からやるのが楽(だけど基本はGUIからやる方が色々安定する) | |
- Windowsのgitはダブルクォートがデフォルトらしい | |
- 「git commit -m ''」だとコメントに''が含まれる | |
- .ideaについて | |
- 不要なものは.gitignoreしてよいらしい | |
- http://gihyo.jp/dev/serial/01/android_studio/0034 | |
- quick startすると.gitignoreが自動生成されているので「*.iml」を加筆すればOK | |
- 実機デバッグ | |
- no deviceになる場合 | |
- http://blog.yoshikawa.64kb.net/2013/11/21/814 | |
- Google USB DriverはAndroidStudioのSDK Managerから直で落とすのがよい | |
- http://developer.android.com/sdk/win-usb.html#top | |
- Tools > Android > SDK Manager > Extras > Google USB Driver > Install | |
- 加えて、メーカのADBドライバをダウンロードしてインストールすることも必要 | |
- http://www.katch.ne.jp/~kakonacl/douga/android_capture/usb_driver_android.html | |
- これでビルド時の動作先に実機を選択できる | |
- adb shell | |
- android emulatorや実機に対して直接shellを実行できるもの | |
- http://www.javadrive.jp/android/commnadline/index5.html | |
- Android SDKと一緒に導入されるが、PATHはとおっていない | |
- C:\Users\XXXXXX\AppData\Local\Android\sdk\platform-tools\adb.exe | |
- usage example | |
* database_lessonアプリのDBの中身をsqlite3で確認 | |
$ adb shell | |
# cd /data/data/net.soragoto.sumi.database_lesson/databases | |
# sqlite3 myapp.db | |
sqlite> select * from users; | |
- Tips | |
- xmlをTextモードで編集中にIDE右端のPreviewをクリックすると、編集しながら端末もどきでグラフィカルな変化を確認できる | |
- 学習資料 | |
- Androidアプリ開発入門 | |
- http://dotinstall.com/lessons/basic_android_v2 | |
- Androidレイアウト入門 | |
- http://dotinstall.com/lessons/basic_android_layout | |
- Androidリストビュー入門 | |
- http://dotinstall.com/lessons/basic_android_listview | |
- Androidデータベース入門 | |
- http://dotinstall.com/lessons/basic_android_db | |
- Androidでおみくじアプリを作ろう | |
- http://dotinstall.com/lessons/omikuji_android | |
- Androidで姓名診断アプリを作ろう | |
- http://dotinstall.com/lessons/namescore_android | |
- Androidでストップウォッチを作ろう | |
- http://dotinstall.com/lessons/stopwatch_android | |
- Androidでウェブブラウザを作ろう | |
- http://dotinstall.com/lessons/browser_android | |
- Androidでクイズアプリを作ろう | |
- http://dotinstall.com/lessons/quiz_android | |
- Androidでメモアプリを作ろう | |
- http://dotinstall.com/lessons/memo_android | |
- mixi-inc/AndroidTraining | |
- https://github.com/mixi-inc/AndroidTraining | |
- Tech Institute アプリ開発者養成講座テキスト | |
- http://www.techinstitute.jp/material/01/ | |
- 参考 | |
- Androidアプリ開発を独学で学ぶ人への効果的な勉強法 | |
- http://qiita.com/Reyurnible/items/5e57e44baeddd2149833 | |
- TroubleShoot | |
- Rendering Problem | |
- SDKがインストールされていないこと原因 | |
Rendering領域内のドロイド君からSDKのバージョンを変えればとりあえず回避できる | |
- http://blog.bylo.jp/develop/2014/08/1631/ | |
- PalleteにEditTextがない | |
- Multiline Textを使えばよい。DropするとEditTextになる | |
- http://stackoverflow.com/questions/11220796/why-dont-i-have-edittext-in-the-form-widgets-section-in-my-eclipse-ide | |
- Java | |
- 総称型、イレイジャ、型変数 | |
http://jutememo.blogspot.jp/2010/02/java.html | |
http://into.cocolog-nifty.com/pulog/2012/02/generics1-969f.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment