約 6,002,708 件
https://w.atwiki.jp/android/pages/42.html
チュートリアル:ノートパッドアプリケーションを作る このチュートリアルでは、みなさんに実際に手を動かしてもらいながらアプリケーションを作成するための Android フレームワークやツールの紹介を行います。プレコンフィギュレーションファイルから始め、簡単なノートパッドアプリケーションを開発する過程を通じてプロジェクトのセットアップ方法、アプリケーションロジックの開発方法、ユーザインターフェースの開発方法、アプリケーションのコンパイルと起動方法についての具体的な例を示します。 このチュートリアルではノートパッドアプリケーションの開発をいくつかのエクササイズ(下記参照)に分けて進めていきます。それぞれのエクササイズはいくつかのステップからなります。エクササイズの中のステップに沿って進んでいくとアプリケーションが完成していき、改良が進んでいきます。エクササイズの中ではそれぞれのステップについて詳しい説明が与えられ、アプリケーションを完成させるために必要なコードのサンプルも示されています。 チュートリアルを終えると、機能を果たす Android アプリケーションが完成し、Android アプリケーションの開発において重要な考え方についての知識が得られていることでしょう。Android SDK に付属するノートパッドアプリケーションのサンプルコードを研究・利用してより複雑な機能を加えてみるのもよいでしょう。 目次 本チュートリアルの対象となる読者 準備 エクササイズ その他のリソースとチュートリアル 本チュートリアルの対象となる読者 本チュートリアルは熟練した開発者(特に Java 言語の知識のある方)を想定して書かれています。これまでに Java アプリケーションを書いたことが無い方でも本チュートリアルを読み進めることはできますが、読み進めるスピードは落ちてしまうかもしれません。 また、本チュートリアルは「SDKとプラグインのインストール」と「もしもしAndroid!」ドキュメントの内容を前提として書かれています。これらのドキュメントでは Android アプリケーションの開発環境のセットアップについて詳説しています。本チュートリアルを開始する前に、これらのドキュメントに従って SDK のインストールとセットアップを済ませておきましょう。 最後に、本チュートリアルではAndroid プラグインをインストールした Eclipse 開発環境上でのノートパッドアプリケーション開発を解説しています。Eclipse をお使いでない場合、エクササイズを進めていくことはできますが、Eclipse 上での操作がお使いの環境でどの操作に相当するのかを読み解く必要があります。Android SDK に付属するノートパッドアプリケーションのサンプルコードを研究・利用してより複雑な機能を加えることもできます。 本チュートリアルは Android アプリケーションについての基本的な概念や用語を知っていることを仮定しています。基本的な概念や用語を全く知らない方は、「Android アプリケーション解体新書」と「Android アプリケーションのライフサイクル?」を先に読んでおいてください。 準備 チュートリアルを開始する前に、 SDK と Eclipse 開発環境のセットアップが必須です。開発環境が整ったら、エクササイズのアーカイブファイルを展開しましょう。アーカイブファイルは SDK パッケージに含まれています。アーカイブにはそれぞれのエクササイズで使う一連の Eclipse プロジェクトファイルが入っています。これらのプロジェクトファイルを使えば自分でプロジェクトファイルを設定する必要がありません。 チュートリアルプロジェクトファイルを準備するには、 プロジェクトエクササイズアーカイブ(.zip) をダウンロードします。 好きな場所にアーカイブファイルを展開します。 展開してできた NotepadCodeLab フォルダを開きます。 NotepadCodeLab フォルダには、6つのプロジェクトファイルがあるはずです( Notepadv1、 Notepadv2、 Notepadv3、 Notepadv1Solution、 Notepadv2Solution 、Notepadv3Solution)。Notepadv* プロジェクトはそれぞれのエクササイズを開始する時点で使うファイル、Notepadv*Solution プロジェクトはエクササイズの終了時点でできているはずの「模範解答」です。何か問題が起きた場合には Solution ファイルと比べてみて問題点を修正するとよいでしょう。 エクササイズ 下表にチュートリアルのエクササイズと、そのエクササイズで扱う話題について示します。いずれのエクササイズもそれより前のエクササイズの例を完成させていることを仮定して進めていきます。 エクササイズ1 シンプルなノートリストを作ります。ユーザはこのリストから新規ノートの追加ができますが、追加したノートの編集はできません。ListActivities とメニューオプションの作り方と操作の仕方の基本をデモンストレートします。ノートを保存するために SQLite データベースを用います。 エクササイズ2? アプリケーションに2つ目のアクティビティを追加します。新規アクティビティを作成して Androidmanifest に追加する方法、アクティビティ間でデータをやり取りする方法、スクリーンレイアウトの応用的な利用法についてデモンストレートします。starSubActivity() を使ってアクティビティを非同期的に呼び出す方法についても述べます。 エクササイズ3 アプリケーションにライフサイクルイベントの操作を追加し、ライフサイクル全体を通してアプリケーションの状態を保持することができるようにします。 追加事項? Eclipse のデバッガの使用方法と、デバッガを用いてライフサイクルイベントが生成していく様子を見る方法についてデモンストレートします。本節は必ず読まなければいけないものではありませんが、読むことを強くお勧めします。 その他のリソースとチュートリアル チュートリアル内で扱われていない概念について浅く広く知りたい方は「よくある問題と対処」をご覧ください。 Android SDK には完全に動作するサンプルアプリケーションが同梱されており、より深く学習することができます。サンプルアプリケーションは SDK の samples フォルダにあります。 本チュートリアルは SDK の samples フォルダ内のフル機能の Notepad アプリケーションをもとに書かれています。チュートリアルが終了したら、フル機能の Notepad アプリケーションのソースコードを研究することを強くお勧めします。フル機能のノートパッドアプリケーションは様々な興味深い機能が追加されています。たとえばノートリストをストライプ表示する draw() メソッドをオーバーライドしてカスタムテキストエディットビューを作り、ラインノートパッドのように見せる ノートのコンテントプロバイダーを実装する 自動的に保存するのではなく編集操作を元に戻す
https://w.atwiki.jp/conn/pages/21.html
このページは現在作成中です Androidアプリの基本構成 Androidアプリは幾つかのコンポーネントを組み合わせて作成する。コンポーネントはその役割ごとに幾つかに分類される。 Androidアプリを構成する4つのコンポーネント もっとも基本的なコンポートネントは次の4種類。 Activities 画面。アクティビティはそれぞれが独立したコンポーネントとして作成され、その組み合わせでアプリを動作させる。別のアプリから、また別のアプリ内のアクティビティを動作させることも可能。 Services 裏側でこっそり働く子。ユーザーインターフェースは持たない。ネットワークからデータをダウンロードしてきたり、別のアプリを操作中に音楽ファイルを再生したり、ユーザーの操作を邪魔することは無い。アクティビティのような他のコンポーネントから起動され、動作を指定される、サービス精神の塊のような存在。 Content Providers アプリケーションのデータへのアクセス共有を管理しデータの読み書きを行う。ファイルシステムやSQLiteなどのDB、インターネット上のデータなど、さまざまな場所に対応する。許可すれば他のアプリからデータの読み書きが可能だし、その逆も可能。動画を配信してくれる業者ではない。 Broadcast Reciever システムからの通知を受け取ったり、システム全体へ通知を発信したりする。例えばスリープに入った、バッテリーが切れ掛かっている、写真を撮った、などなどの通知を受けたり、発信したりできる。 電話を自動録音するアプリなんかだと、電話が掛かってきたという通知を受けサービスを起動し録音する、という使い方が想定される。 他にもコンポーネントには分類されないが、Androidアプリを構成する重要な要素がある。 マニフェスト アプリに属するコンポーネントを規定するのがマニフェストファイル。XML形式で記述する。 Intentフィルターで、アプリのエントリポイント(初期起動するアクティビティ)を指定する。 例:雛形アプリの AndroidManifest.xml。Intentフィルターが Activityの子要素で指定されている。 activity android name=".MainActivity" android label="@string/title_activity_main" intent-filter action android name="android.intent.action.MAIN" / category android name="android.intent.category.LAUNCHER" / /intent-filter /activity 他にも幾つかのIntent Filterアクションおよびカテゴリーがあるが、アプリアイコンから起動する場合はこの指定が必要だと覚えておけばよい。 他のアプリから 特定の Intentアクションにより起動されるアプリは、別の指定を追加する必要がある。 Intent(インテント:意図) 特定のアクティビティを指定、または「何をしたいのか」を指定し別のアプリを起動する。 同アプリ内のアクティビティ間連携にも使用される。 例:明示的に特定のアクティビティを指定し、EditTextボックスの入力値を渡している Intent intent = new Intent(this, DisplayActivity.class); EditText editText = (EditText) findViewById(R.id.input_message); String message = editText.getText().toString(); intent.putExtra(EXTRA_MESSAGE, message); startActivity(intent); 例:データ表示を指定し、Webページを開く Uri uri = Uri.parse("http //www.android.com"); Intent intent = new Intent(Intent.ACTION_VIEW, uri); startActivity(intent); 簡略化のため省いているが、通常は事前に実行可能なIntentかチェックするためPackageManagerを使用する。この Intentで開かれるアプリは Intent Filterにて ACTION_VIEWアクションを受け付ける指定があるものの中から選ばれる。 リソース アプリが利用する画像ファイル、レイアウト定義、言語ごとの文字列ファイルなどをひとまとめにし、Rクラスを通じた共通のアクセス方法を提供する。画像、動画、音声などのデータファイル、XMLファイルで構成される。 リソースは異なる解像度、画面サイズ、言語に対応するディレクトリに分けて構成することで自動的に対応するディレクトリ内のファイルが利用されるように最適化される。詳細はこちら その他 基本の4コンポーネント種とリソースの他に、これらをサポートするコンポーネントが幾つかある。 Intent Fragment
https://w.atwiki.jp/conn/pages/18.html
Androidプロジェクト Androidプロジェクトの中身を簡単にまとめます。 ネタ元はAndroid SDKのドキュメントと、EclipseのAndroid SDK Pluginで自動生成された雛形の動作検証です。 プロジェクトのディレクトリ構成 Androidアプリを作るなら、ごく当たり前の知識として知っておく必要があります。 プロジェクトルート src ソースコード用ディレクトリ gen ADTが自動生成したファイル用ディレクトリ。R.javaやAIDLファイルから生成されたファイルが該当。 assets 生のデータファイルを保存する。ビルド時にapkファイルへ組み入れられ、ファイルシステムと変わりない方法でアクセスできる。 bin ビルドされたファイル用ディレクトリres ビルドされたリソースファイル用ディレクトリ libs ライブラリファイル用ディレクトリ res リソースファイル用ディレクトリdrawable-**** 画像ファイルや、レイヤー定義などを記載した描画用定義XMLファイルを保存する。画面解像度ごとにディレクトリが分かれているモヨウ。 layout レイアウト定義XMLファイル用ディレクトリ menu メニュー定義XMLファイル用ディレクトリ values 文字列や設定情報等用のディレクトリ。resディレクトリ内の他のXMLファイルはファイル名ベースでアクセスするのに対し、XML要素を解析し、それぞれの要素名をR.javaファイルに展開しアクセスする点に違いがある。 raw 生のデータファイルを保存する。assetsディレクトリとの違いはアクセス方法で、こちらはR.javaファイルを通じてリソースファイルとしてアクセスする。 AndroidManufest.xml アプリの基本情報を定義する。アプリバージョン、製作者、対応・必要APIバージョン、必要な外部ライブラリなどなど、様々な情報を定義する。奥が深い。 リソースファイル用ディレクトリと、マニフェストファイルは、特に勉強が必要。 詳細が知りたければSDK Managerでドキュメントをインストールし読んでみると良い、全部英語だけども。 雛形プロジェクトの動作 ADTでプロジェクトを作成すると、HelloWorldが表示される簡単なアプリが出来上がった状態になっている。 その動作の細かな点をつついて、それぞれのディレクトリに格納されたファイルが どのように連携するかを調べてみた。 AndroidManifest.xmlを解析しアプリを起動、アクティビティの定義を読み込む。 XMLファイル中では「@」を用いることでリソースにアクセスすることができ、アプリケーション名やスタイル定義の指定に使用されている。 application android icon="@drawable/ic_launcher" <<<res/drawable-****/ic_launcher.pngファイルを参照 android label="@string/app_name" <<<res/valus/strings.xml内の文字列を参照 android theme="@style/AppTheme" <<<res/valus/style.xml内の定義を参照 activity android name=".MainActivity" <<<ここで起動するアクティビティを指定 android label="@string/title_activity_main" <<<res/valus/strings.xml内の文字列を参照 intent-filter action android name="android.intent.action.MAIN" / category android name="android.intent.category.LAUNCHER" / /intent-filter /activity /application binディレクトリ内のデフォルトアクティビティを起動する。 public class MainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); <<<レイアウト定義ファイルを指定 } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.activity_main, menu); <<<メニュー定義ファイルを指定 return true; } } レイアウト定義ファイル res/layout/activity_main.xml メニュー定義ファイル res/menu/activity_main.xml Activityの動作に従い読み込まれる。 それぞれの定義ファイルにはリソースへのアクセスが指定されている。 TextView android layout_width="wrap_content" android layout_height="wrap_content" android layout_centerHorizontal="true" android layout_centerVertical="true" android text="@string/hello_world" tools context=".MainActivity" / menu xmlns android="http //schemas.android.com/apk/res/android" item android id="@+id/menu_settings" android title="@string/menu_settings" android orderInCategory="100" android showAsAction="never" / /menu 以上が簡単な動作解説です。 マニフェストファイルが起点となり、アクティビティが実際の動作を担っており、 動作時に様々な箇所でリソース内の定義ファイルが読み込まれているのが分かる。 Webアプリケーションなどに比べると非常に単純な構成となっているが、アプリが大きくなるとファイルが増え、管理が難しくなりがち。だがディレクトリ構成の原則に従いアプリを作成することで、誰にでも分かりやすい、無論のこと自分自身にも分かりやすい管理しやすい構成にできる。
https://w.atwiki.jp/devandroidknowledge/pages/14.html
≪Android Tips≫ ◆なんと、Androidには温度センサーが付いているみたい! 【温度センサーから温度を取得するには(概要)】 Sensorインスタンスの生成 Sensorインスタンスに温度センサーを指定する SensorManagerインスタンスにリスナ―指定する。( 温度変化があったごとに記録するには、左記にプラスして下記が必要。) Andoridのセンサーには加速度センサーとか磁気センサーなどがある リスナーに設定すると、センサーの値が変更されたタイミングでonSensorhangedというメソッドが呼び出され、センサーの値を取得することが出来る。 SensorManagerインスタンス センサーを管理するためのSensor系のインスタンス。センサーを管理するためのメソッドも用意されている。 【温度センサーから温度を取得するには(詳細)】 getSystemServiceメソッドでSensorManagerインスタンスを取得 SensorManager.getDefaultSensorメソッドにSensor.TYPE_TEMPERATURE(温度センサー)を指定する。 SensorManager.registerListenerメソッドに②で生成したSensorインスタンスを指定。 by nakamura ◆GoogleMap活用法系 GoogleMap使用準備 GooglMapAPIのKeyを取得する。 AndroidManifestにインターネット接続のパーミッションとGooglMaoAPIを利用する記述を行う。 GoogleMap使用準備 さぁ、準備が出来たら画面に表示だ! 画面に表示させるにはあ以下のことを行う必要がある。 MapActibityクラスの継承 そのクラスの中でonCreateするときにsetContentView(R.layout.main)で地図をセットする。 ※main.xmlにMapViewを配置しておく。 ※MapView・・・Googleから取得したAPIキーの記述や、地図に関する表示をクリックの可否の記述を行う isRouteDisplayedメソッドをオーバーライドしてfalseを返すようにする ※isRouteDisplayedメソッド・・・?? ※MapViewインスタンスからマップ表示させることも可能 MapView mapView = new MapView(this,getResources().getString(取得したキー)); mapView.setEnabled(true); mapView.setClickable(true); setContentView(mapView); by nakamura ◆画面系いろいろ入門編 1画面につき1つActivityクラスが対応する。 バックグラウンドの処理はServiceクラスに実装する。 AvtivityからService,ServiceからServiceを呼び出す際はIntentを使う。 アプリ起動時の画面はAndroidManifest.xmlのintent-filterに設定する。 参考にしたページ Androidアプリ作成のための基礎知識 Androidプログラミング入門 Android入門
https://w.atwiki.jp/sh-03c/pages/24.html
Androidアプリ リンク先はマーケットや紹介サイトになっています。断りがないかぎりは無料のものだけ。 Androidアプリ最初に入れるべきアプリは? Android Market - Web版 アプリ紹介サイト アプリHome変更 日本語IME 日本語IMEプラグイン (マッシュルーム) カレンダー スケジューラー 時計 テキストエディタ Webブラウザ 音楽 2chブラウザ - @Wiki メール関連 動画関連 バッテリー関連 Twitterクライアント ユーティリティ お得情報&クーポン系 ニュース&情報誌 その他 最初に入れるべきアプリは? QRコードスキャナー(本体標準のものはマーケット非対応)、Astro File Manager、Quick Setting、Battery Status Free、Meridianあたりはとりあえず入れておいて損なし。 ステータスバーを下げるためのHelloStatusBarもベールビューや留守録用にホームに置いておきたい。 ホーム画面が重いと感じたらADW.LauncherかLauncher Proも。 日本語IMEのATOKトライアルもよい感じです。 Android Market - Web版 Web版の公式Androidマーケットです。 アプリの検索。 アプリランキングの参照。 ユーザーレビューの閲覧。 インストール済みのアプリ(ダウンロード履歴かも)の参照。(表示されないものもある) リモートでのアプリのインストール。 などができます。 アプリ紹介サイト アンドロイダー オクトバ オリコンアプリランキング mobile ASCII for Android 萌えドロイド 萌えアプリ専用 andronavi AndroApp meetroid giveApp de ANDROID Appinfo AndRanking APPmax pandroid applizoo マーケット検索 AndroLib マーケット検索 AppBrain マーケット検索、アプリの同期 ランキングロイド アプリオ appliko アプリ Home変更 ADW.Launcher Home画面がやや重いので、これに代えるといい感じになるかと。 LauncherPRO 軽めのホーム変更ユーティリティ。 Home Switcher (紹介) ホームアプリの簡単切り替え。(2.2用) 日本語IME ATOKトライアル 試用期間は6月末まで(延長しました) OpenWnnフリック入力対応版 Simeji (紹介) 日本語IMEプラグイン (マッシュルーム) マッシュルームパック 連絡先の情報/メルアドピッカー/音声/時刻。 aNdClip クリップボード拡張 Free版 クリップボードを拡張する。アドレス帳も参照可能。 Google変換マッシュ Web版Google日本語入力で変換。 Social IME Mushroom Plug-in Social IMEで変換。 カオ帳 顔文字入力を支援。 カレンダー スケジューラー S2カレンダーウィジェット ジョルテ システム手帳アプリ 時計 diviClock 世界天気時計 テキストエディタ AK Notepad Webブラウザ Dolphine Browser Galapagos Browser Opera Mini - ちょっとクセがある Skyfire Browser 音楽 WinAMP - 無線LAN経由でPCの音楽ファイルを同期できる。 Meridian Ringdroid - MP3を編集して好きな部分を着信音として使える。 2chブラウザ - @Wiki 一長一短だけども野良アプリインストールに抵抗なければTuboroidonがよさげ。 Tuboroidon 開発終了したTuboroidのソースを引き継いだブラウザ。 Tuboroidon524 Tuboroidonをさらに改変。 2chMate Tuboroidonと同じ作者。→広告付きマーケット版 俺2ch Anちゃん En2ch ニブロイド Nora(β) W2Chの人 Ace2ch Bettik Balloo! for Android(β) (紹介) テレビ実況専用。2ch実況対応。 メール関連 IMoNi iモード.netのクライアント spモードメール ドコモwebメール ビューア 動画関連 RockPlayer Lite Androidの基本動画アプリ VitalPlayer FFmpegベースの動画アプリ。RockPlayerより軽い? Ustream ライブストリーミング放送。 Qik VIDEO NicoRo α版 ニコニコ動画 ニコニコPlayer(仮) ニコニコ動画 バッテリー関連 Battery Status Free ステータスバーとウィジェットでバッテリーの%表示 DQB 一発ネタに見えるけど実用的 CPU Full Works - CPUを目いっぱいブン回してバッテリーを食わせる Battery Graph (紹介) バッテリー量のログを取り、グラフで見ることができる。SH-03Cではバッテリー量の精度が10%単位なのがちょっと残念です。 Auto WiFi Toggle 定期的にWiFiをオンにし、接続できなければオフにします。 Twitterクライアント 日本語twitterクライアント twicca イチオシ……というか日本語アプリはこれくらいTWICCA TWIPICプラグイン 独断と偏見によるAndroidのTwitterクライアントレビュー (ケータイ Watch) ユーティリティ QRコードスキャナー 本体標準のものはマーケットに対応していないので必須。 APNdroid 電話は使えるようにしたまま、3G回線を切るアプリ。OFFの時にAPN名を書き換えているのでアンインストールはONの状態ですること。 Advanced Task Killer - バックグランドで動いているアプリを終了させることができる。 Task Manager - 同上 Astro File Manager - ファイラーならこれ。 ES ファイルエクスプローラー - サーバに接続可能なファイラー。マニア向けだけど便利。 HelloStatusBar - ステータスバーを上げ下げするだけのアプリ。 Adobe Photoshop Express 簡単な画像編集ができる Perfect Viewer コミック閲覧にも適した画像ビューア。 Astro File Managerと合わせて使うと吉 SwiFTP Server (紹介) FTPサーバ。便利。 Bluetooth File Transfer Bluetoothでファイル共有。 More Icons Widget - ホームにアイコンをいっぱい置きたい方に。Free版と有料版があります Quick settings - GPSやBluetoothの設定などをすぐに変更できる Quick System Info - ストレージやRAMの空き容量や現在のIPアドレスなどを一括して見ることができる、Logcatの閲覧も可能 Desktop VisuallizeR - ホーム画面のアイコンやラベルを自由に変えることができる 発信確認 Call confirm - 電話をかける直前に割り込んで誤発信を防いでくれる Fast Reboot - 電源を切らずに再起動できる My docomo checker docomoの料金や契約状況などを見ることが出来ます。My docomoアカウントはiモードメールが使えない場合は郵送しないと登録できないらしいので事前に登録しておきましょう。 お得情報&クーポン系 折り込みチラシビューアー ホットペッパー グルメ マクドナルド公式アプリ ニュース&情報誌 ウェザーニュースタッチ 気象情報。 ITmedia for Android ITmediaニュース Impress Watchニュース R25 for android リクルートのフリーペーパー その他 Latte テレビ番組表を取得するアプリ Skype マーケットから落とせるようになりました。 乗換案内 - 携帯サイトでお馴染のところ たいぷぅ (紹介) 文字入力の練習にどうぞ。 ボトルメッセージ 不特定の相手にメッセージを送信。 日本交通タクシー配車 (紹介) 東京23区・武蔵野市・三鷹市で利用可能
https://w.atwiki.jp/android/pages/13.html
Androidことはじめ Androidを始めるために、以下のセクションを読んでください。 SDKとプラグインのインストール SDKとEclipseプラグインをインストールする方法、またはAndroidアプリケーションを構築するための他のツールを使う方法。及び、サンプルアプリケーションを走らせるためのガイド。 もしもしAndroid! あなたの最初のAndroidアプリケーション。一般的なHello WorldをAndroidスタイルで記述します。 Androidアプリケーション解体新書 Androidアプリケーションの構造とアーキテクチャのガイド。このガイドは、あなたがAndroidアプリを作るための理解を手助けします。 Androidアプリケーション構築のチュートリアル このチュートリアルで、実際にAndroidアプリケーション作成を通じて学習していきます。メモの作成、編集、削除等、基本的な概念を実際的な例でカバーしたノートパッドの作成を行います。 開発ツール SDKに含まれるコマンドラインツールと使い方。 Androidアプリケーションのライフサイクル? 内部で動作しているアプリケーションとアクティビティに関するライフサイクルの詳細を解説します。 原文
https://w.atwiki.jp/foras/pages/20.html
Androidアプリのフリーズ、挙動異常の対応方法 Androidアプリやゲームの利用中、フリーズや挙動異常が発生した際は、以下の手順でキャッシュの削除を試す。 ----- ・Androidアプリのキャッシュ削除 1.該当のアプリ(ゲーム)を完全に終了する ※「タスク一覧」から終了させる(最近使ったアプリ一覧を表示させ、左右にスワイプして消す) 2.「タスク一覧」から全てのアプリを終了する 3.「設定」から「アプリケーション(アプリ)」を開く 4.問題の発生しているアプリを開く 5.「キャッシュを削除」をタップ 6.スマートフォンの電源を切り、再起動する ----- ・Androidアプリのデータ消去 上記「キャッシュの削除」をしても問題が解決しない場合は、必ず該当アプリの引き継ぎできるように IDやパスワード(アプリにより異なる)を控えた上、以下の操作を試す。 ※引き継ぎ等を怠るとデータが初期化され、 取り返しがつかない事になる場合がありますので、自己責任でお試しください 1.該当のアプリ(ゲーム)を完全に終了する ※タスク一覧から終了させる(最近使ったアプリ一覧を表示させ、左右にスワイプして消す) 2.タスク一覧から全てのアプリを終了する 3.「設定」から「アプリケーション(アプリ)」を開く 4.問題の発生しているアプリを開く 5.「データを消去」をタップ 6.スマートフォンの電源を切り、再起動する ----- ・Androidアプリの再インストール 上記「データの消去」をしても解決しない場合、該当のアプリのアンインストールを行い、 再度インストールを行う。 ※上記同様IDやパスワードを必ず控えた上、自己責任でお試しください 1.該当のアプリのアイコンを長押しする 2.アンインストールを選択(アンインストールを行う) 3.スマートフォンの電源を切り、再起動する 4.該当のアプリをPlayStore等で検索し、再インストール
https://w.atwiki.jp/bill_kaigh/pages/18.html
iPhone向けのアプリを作ってみようかと思ったけど、MACが必要みたいなのでやめた。 そもそもアップルの製品を人生で一度も買ったことがない。 (ジョブズをそれほど信仰していないので・・・) iPhone持っていないのにiPhoneアプリ作っちゃダメだろ。 ということでAndroidアプリ作ってみる。 Androidアプリ開発の学習 Android Studio Android のホームページhttp //www.android.com/
https://w.atwiki.jp/android_api/pages/17.html
Androidアプリは「アクティビティ」、「ブロードキャストレシーバー」、「サービス」、「コンテンツプロバイダ」の4つの構成要素から成り立ちます。 リソースクラスです。標準的なアンドロイドアプリケーションに使用されます。このパッケージにはアンドロイドアプリケーションを使う際の定義がされています。サードパーティの開発者が使うことのできるたくさんのアップリケーションがあります。リソースの詳細についてはリソースとアセットをご覧ください。
https://w.atwiki.jp/android/pages/43.html
チュートリアル:ノートパッドエクササイズ1 本エクササイズではシンプルなノートリストを作ります。このノートリストを使ってユーザは新規ノートを追加することができますが、ノートの編集を行うことはできません。本エクササイズでは以下の事項をデモンストレートします。 ListActivities の基本、メニューオプションの作成・操作の基本 SQLite データベース内のノートへのアクセス/保存方法 ArrayAdapter (ListView にバインドするためのもっともシンプルな方法の一つ)を用いてデータを ListView にバインドする方法 リストビューの配置の仕方やアクティビティメニューへのアイテムの追加のやり方、アクティビティがアクティビティメニューアイテムをどのように扱うか、といったスクリーンレイアウトの基本 [エクササイズ1] [エクササイズ2?] [エクササイズ3?] [追加事項?] Step 1 Notepadv1 プロジェクトを開きます。 Notepadv1 は開始点として提供されるプロジェクトです - it takes care of some of the boilerplate work that you have already seen if you followed the Hello Android tutorial (すでにHello Android(もしもしアンドロイド)のチュートリアルで見ているかもしれませんが、共通する説明があります。) 2. browse ボタンを押し、あなたが本エクササイズをコピーしたフォルダを選択し、その中からNotepadv1を選んでOKを押してください。 a. Package Explorer で右クリックし、New- Project... を選択してください。 b. Android/Android Project を選択し、Next を押してください。 c. New Android Project のダイアログで、Create project from existing source(既存のソースからプロジェクトを作成)を選択してください. d. browse ボタンを押し、あなたが本エクササイズをコピーしたフォルダを選択し、その中からNotepadv1を選んでOKを押してください。 e. Project name 欄に Notepadv1、Location 欄に選択したパスが表示されることを確認してください。 f. Finish を押します。 g. 本エクササイズのプロジェクトが Eclipse の Package Explorer に開かれ準備が完了します。 h. もし AndroidManifest.xml にエラー表示が出ていたり、Android の zipファイルに関連する問題が表示された場合は、プロジェクトの上で右クリックし、ポップアップから、Android Tools- Fix Project Properties を選択してください。(プロジェクトがライブラリの場所を正しく見ていないので、この操作でそれを修復します。) Step 2 データへのアクセスと更新について このエクササイズにおいては、単にSQLiteデータベースを直接使ってデータを保存しますが、実際のアプリケーションでは正当なContentProviderを作成し、処理をカプセル化する方がずっと良いでしょう。 もし興味があれば、content provider やデータの保存/検索/表示などに関する情報をいろいろと見つけることが出来るでしょう。 DBHelper クラスを見てみてください - このクラスは、我々が作成するノートのデータを保持するとともにその更新も可能にする、SQLiteへのデータアクセスをカプセル化するために提供されています。 典型的にはContentProviderを用いることでこのクラスを実装します。そして実際、SDKには行っている完全なNotepadアプリケーションはそのようなContentProviderを実装しています。しかし、我々がこれからするように、単にSQLiteデータベースを直接利用していけない理由はありません。このクラスについて注意すべき重要なことは、それがSQLiteデータベースのデータの保存、参照、更新の詳細の面倒をみてくれるということです。全ての行を取得するメソッド、行IDに基づいて行を取得するメソッド、新しい行を作成するメソッド、既存の行を削除するメソッド、既存の行を更新するメソッドがあります。もしあなた自身のアプリケーションでSQLiteデータベースを利用する方法に関する入門を希望なら、このクラスを見てみるか、より良くは、ContentProviderの利用例として SDK の samples/ ディレクトリに入っている完全なNotepadアプリケーションを見てみてください。 Step 3 Layout と activity とについて ほとんどのActivityはそれに関連付けられたレイアウトを持っています。レイアウトはユーザに対してそのactivityの「顔」となります。今回の例では我々のレイアウトは画面全体を覆いノートの一覧を提供します。 しかし、フルスクリーンレイアウトはActivityにとっての唯一の選択肢ではありません。フローティングレイアウト(たとえばダイアログとか警告のように)が欲しいこともあるでしょうし、レイアウトを全く必要としないこともあるでしょう(使用するレイアウトを決めない場合、activityはユーザに見えなくなります)。 Open the notepad_list.xml file in res/layout and take a look at it This is a layout definition file with a default starting point in it, we have provided this as a convenience to get you going quickly. 1. All Android layout files must start with the XML header line ?xml version="1.0" encoding="utf-8"? . 2. Also, the next definition will often (but not always) be a layout definition of some kind, in this case a LinearLayout. 3. Note also that the xml namespace of Android should always be defined in the top level component or layout in the XML so that android tags can be used through the rest of the file xmlns android="http //schemas.android.com/apk/res/android" Step 4 We need to create the layout to hold our list. Add code inside of the LinearLayout tag so the whole file looks like this (you may have to hit the Source tab in order to edit the XML file) ?xml version="1.0" encoding="utf-8"? LinearLayout xmlns android="http //schemas.android.com/apk/res/android" android layout_width="wrap_content" android layout_height="wrap_content" ListView id="@id/android list" android layout_width="wrap_content" android layout_height="wrap_content"/ TextView id="@id/android empty" android layout_width="wrap_content" android layout_height="wrap_content" android text="@string/no_notes"/ /LinearLayout 1. The ListView and TextView can be thought as two alternative views, only one of which will be displayed at once. ListView will be used when there are notes to be shown, while the TextView (which has a default value of "No Notes Yet!" defined as a string resource, will be displayed if there aren t any notes to display). 2. The @ in the id strings of the ListView and TextView means that the XML parser should parse and expand the rest of the id string and use an ID resource. 3. And, the android list and android empty are IDs that are already provided for us by the Android platform, empty is used automatically when no data is provided in the list adapter. The List Adapter knows to look for these names specifically by default. Alternatively you could also choose to change the default empty view used by the List Adapter by using the setEmptyView(). More broadly, the android.R class is a set of predefined resources provided for you by the platform, while your project s R class is the set of resources your project has defined. Resources found in the android.R resource class can be used in the XML files by using the android name space prefix (as we see here). Step 5 Resources and the R class The folders under res/ in the Eclipse project are special. There is a specific structure to the folders and files under this folder. In particular, resources defined in these folders and files will have corresponding entries in the R class allowing them to be easily accessed and used from your application. Furthermore, they will be bundled and deployed as part of the application. To make a list view, we also need to define a view for each row in the list 1. Create a new file under res/layout called notes_row.xml. 2. Add the following contents (note again the xml header is used, and the first node defines the Android xml namespace) ?xml version="1.0" encoding="utf-8"? TextView id="@+id/text1" xmlns android="http //schemas.android.com/apk/res/android" android layout_width="wrap_content" android layout_height="wrap_content"/ 3. This is the view that will be used for each notes title row — it has only one text field in it. 4. In this case we create a new id called text1. The + after the @ in the id string indicates that the id should be automatically created if it does not already exist, so we are defining text1 on the fly and then using it. 5. After saving this file, open the R.java class in the project and look at it, you should see new definitions for notes_row and text1 (our new definitions) meaning we can now gain access to these from the our code. Step 6 Next, open the Notepadv1 class in the source. We are going to alter this class to become a list adapter and display our notes, and also allow us to add new notes Notepadv1 will be a subclass of Activity called a ListActivity, which has extra functionality to accommodate the kinds of things you might want to do with a list, for example displaying an arbitrary number of list items in rows on the screen, moving through the list items, and allowing them to be selected. Take a look through the existing code in Notepadv1 class. There are some constant definitions at the top, followed by a private field we will use to create numbered note titles, and some overrides of methods from the superclass. Step 7 Change the inheritance of Notepadv1 from Activity to ListActivity public class Notepadv1 extends ListActivity Note you will have to import ListActivity into the Notepadv1 class using Eclipse, ctrl-shift-O on Windows or Linux, or cmd-shift-O on the Mac (organize imports) will do this for you. Step 8 There are already three override methods defined onCreate, onCreateOptionsMenu and onOptionsItemSelected, we need to fill these out * onCreate() is called when the activity is started — it is a little like the "main" method for the activity. We use this to set up resources and state for the activity when it is running * onCreateOptionsMenu() is used to populate the menu for the activity. This is shown when the user hits the menu button, and has a list of options they can select (like "Create Note") * onOptionsItemSelected() is the other half of the menu equation, it is used to handle events generated from the menu (e.g. when the user selects the "Create Note" item). Step 9 Fill out the body of the onCreate() method. Here we will set the title for the activity (shown at the top of the screen), use the notepad_list layout we have created for the activity display contents, set up the DBHelper instance we will use to access notes data, then populate the list with the available note titles 1. call super() with the icicle parameter passed into our method 2. setContentView to R.layout.notepad_list 3. Create a new private class field called dbHelper of class DBHelper (before the onCreate method) 4. Back in the onCreate method, construct a DBHelper instance — assign to the dbHelper field (note, you must pass this into the constructor for DBHelper) 5. Finally, call a new method -fillData()- gets the data and populates it using the helper, we haven t defined it yet 6. onCreate() should now look like this @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.notepad_list); dbHelper = new DBHelper(this); fillData(); } And remember to add the DBHelper field definition (right under the noteNumber definition) private DBHelper dbHelper; Step 10 More on menus The notepad application we are constructing only scratches the surface with menus. You can also add shortcut keys for menu items, create submenus and even add menu items to other applications!. Fill out the body of the onCreateOptionsMenu() method. We are going to add just one menu item for now, "Add Item", using a string we will create in strings.xml, and defined with a constant we will create at the top of the class to identify the Add Item operation. 1. In strings.xml resource (under res/values), add a new string for menu_insert with text "Add Item" string name="menu_insert" Add Item /string , then save the file 2. Also, you need a menu position constant at the top of the Notepadv1 class (right under the KEY_BODY definition) public static final int INSERT_ID = Menu.FIRST; 3. In the onCreateOptionsMenu() method, add the menu item. Also take care of the result of the super call being returned. The whole method should now look like this @Override public boolean onCreateOptionsMenu(Menu menu) { boolean result = super.onCreateOptionsMenu(menu); menu.add(0, INSERT_ID, R.string.menu_insert); return result; } Step 11 Fill out the body of the onOptionsItemSelected() method This is going to handle our new "Add Note" menu item. When this is selected the onOptionsItemSelected() method will be called with the item.getId() set to INSERT_ID (the constant we used to identify the menu item). We can detect this, and take the appropriate actions 1. The super.onOptionsItemSelected(item) method call goes at the end of this method — we want to catch our events first! 2. Switch statement on item.getId() 3. case INSERT_ID 4. calls new method createNote() 5. break at the end of the case 6. return the result of the superclass onOptionsItemSelected() method at the end 7. The whole onOptionsItemSelect() method should now look like this @Override public boolean onOptionsItemSelected(Item item) { switch (item.getId()) { case INSERT_ID createNote(); break; } return super.onOptionsItemSelected(item); } Step 12 Add a new createNote() method In this first version of our application, createNote() is not going to be very useful. We will simply create a new note with a title assigned to it based on a counter ("Note 1", "Note 2"...) and with an empty body. At present we have no way of editing the contents of a note, so for now we will have to be content making one with some default values 1. String noteName = "Note " + noteNumber++; (Construct the name using "Note" and the counter we have defined in the class) 2. Call dbHelper.createRow() using noteName as the title and "" for the body 3. Call fillData() method again after adding (inefficient but simple) 4. The whole createNote() method should look like this private void createNote() { String noteName = "Note " + noteNumber++; dbHelper.createRow(noteName, ""); fillData(); } Step 13 List adapters Our example uses a very simple array adapter which binds an array or list of items into a ListView. More commonly in Android, List Adapters go hand in hand with ContentProviders, and this is also a very easy way to use lists. To bind a ContentProvider to a ListView you can use a android.widget.SimpleCursorAdapter to bind data from a ContentProvider into a ListView Define the fillData() method. This is fairly long This method uses ArrayAdapter, which is the simplest way of putting data into a ListView. ArrayAdapter takes either a List or an array of Strings, and binds them into a text view provided in the layout defined for the list row (this is the text1 field in our notes_row.xml layout). The method simply obtains a list of notes from the database helper, constructs a List of Strings using the title strings from each row, and then creates an ArrayAdapter out of those items and bound to use the notes_row we defined. private void fillData() { // We need a list of strings for the list items List String items = new ArrayList String (); // Get all of the rows from the database and create the item list List Row rows = dbHelper.fetchAllRows(); for (Row row rows) { items.add(row.title); } // Now create an array adapter and set it to display using our row ArrayAdapter String notes = new ArrayAdapter String (this, R.layout.notes_row, items); setListAdapter(notes); } 1. ArrayAdapter needs a List of Strings (List String ) containing the items to display 2. The data is read out of the database as rows, and the title field from each row is used to populate the list of strings 3. We specify the notes_row view we created as the receptacle for the data 4. If you get compiler errors about classes not being found, ctrl-shift-O or (cmd-shift-O on the mac) to organize imports. Note that for this exercise we use an ArrayAdapter, this is not a very scalable solution and more typically a SimpleCursorAdapter would be used with a ContentProvider or at least a Cursor returned from a query. See the sidebar on List Adapters for more information. Step 14 Run it! 1. Right click on the Notepadv1 project 2. From the popup menu, select Run As - Android Application 3. If you see a dialog come up, select Android Launcher as the way of running the application (you can also use the link near the top of the dialog to set this as your default for the workspace, this is recommended as it will stop the plugin from asking you this every time) 4. Add new notes by hitting the menu button and selecting Add Item from the menu Solution and Next Steps You can see the solution to this class in Notepadv1Solution from the zip file to compare with your own. Once you are ready, move on to Tutorial Exercise 2 to add the ability to create, edit and delete notes. Back to the Tutorial main page...