22. Third Party Framework
Kivy on Android
PythonコードからAndroid
アプリケーションを作成す
る
Monaca
HTML5、JavaScript、CSSベ
ースでAndroidアプリケー
ションを作成する
Unity
AppInventor
Webブラウザ上で画面をデ
ザインし、ブロックをドラ
ッグ&ドロップしてパズル
のように組み合わせて作成
する
3Dコンテンツも作成できる
ゲーム開発プラットフォー
ム。Webやマルチプラット
フォームでコンテンツの書
き出しができる
This material is licensed under the Creative
Commons License BY-NC-SA 4.0.
22
23. Third Party IDE
IntelliJ IDEA
AIDE
JetBrains社が開発した、
Java言語など多言語対応の
統合開発環境
Android上でAndroidアプ
リケーションの開発を行
えるIDE
This material is licensed under the Creative
Commons License BY-NC-SA 4.0.
23
26. Android Market
Android Market
Google Play
Googleが提供するコンテンツ配信サービス
「Android Market」「Google eBookstore」「Google Music」といった、これ
まで個別に運営されてきた複数のサービスを統合
• https://play.google.com/store
This material is licensed under the Creative
Commons License BY-NC-SA 4.0.
26
27. Third Party Market
Third Party Market
Amazon Appstore for Android
米Amazon.comが、Androidアプリを販売
するアプリ市場
DeployGate
開発中のアプリケーション配信サービス
。
主に開発メンバーに対してテスト版アプ
リをリモートで提供することが目的
Handster
ホワイトレーベルのプラットフォームと
ブランドのアプリケーションストアを提
供するアプリ市場
M-trix Market
Androidアプリの成人向けコンテンツ専
用ストア
This material is licensed under the Creative
Commons License BY-NC-SA 4.0.
27
67. プロジェクトの作成(2)
2. [New Android Application]画面の設定
Apllication の設定情報を以下にし、Nextボタンをクリック
Propertiesの各項目に以下を入力する
項目
設定値
Application
Name
HelloWorld
Project Name
HelloWorld
Package Name
jp.oesf.tutori
al
Minimum Required SDK
API 10
Target SDK
API 10
Compile
This material is licensed under the Creative
Commons License BY-NC-SA 4.0.
With
Theme
67
API 10
None
68. プロジェクトの作成(3)
3. [New Android Application]画面の設定
Create Custom launcher iconのチェックを外し、Nextボタンをクリック
チェックを外す
This material is licensed under the Creative
Commons License BY-NC-SA 4.0.
68
70. プロジェクトの作成(5)
5. [New Blank Activity]画面の設定
Finishボタンをクリックする
This material is licensed under the Creative
Commons License BY-NC-SA 4.0.
70
71. アプリケーションの実行
6. Android Projectが生成され、下図(上)のように表示される
7. Package ExplorerからHelloWorldプロジェクトを選択し、右クリックし
、[Run As]-[Android Application]を選択する
This material is licensed under the Creative
Commons License BY-NC-SA 4.0.
71
82. Viewの整列 (余白の設定)
余計な空白があって綺麗に整列されない場合
marginの確認をする
• LinearLayoutへの変更時、配置情報によってはmarginで補正されている
ことがあります。marginの値を消すことで対応出来ます
Propertiesビューを使っ
て余計なmarginを削除す
る
This material is licensed under the Creative
Commons License BY-NC-SA 4.0.
82
94. 文字列リソースの追加(3)
5. ResourcesタブのResouces Elementsに String が追加されていることを
確認する
6. ResourcesタブのAttributes for StringのName、Valueに以下の値を入
力する
Attributes for Stringの設定値
項目名
Name
button_label
Value
This material is licensed under the Creative
Commons License BY-NC-SA 4.0.
設定値
Hello Button
94
105. インターネットへのアクセス許可を
設定(3)
5. Permissionsに Uses Permission が追加されていることを確認する
6. Attributes for Uses Permissionの Name のプルダウンから
android.permission.INTERNETを選択する
This material is licensed under the Creative
Commons License BY-NC-SA 4.0.
105
114. Hello Worldからログを出力する
(2)
3. MainActivity#onCreateにログ出力を行う5つのコードを追加する
■MainActivity.java
package jp.oesf.tutorial;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
public class MainActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Log.e("HelloWorld",
Log.w("HelloWorld",
Log.i("HelloWorld",
Log.d("HelloWorld",
Log.v("HelloWorld",
"Error Message");
"Warning Message");
"Infomation Message");
"Debug Message");
"Verbose Message");
}
……………………
}
This material is licensed under the Creative
Commons License BY-NC-SA 4.0.
114
115. Hello Worldからログを出力する
(3)
4. Package ExplorerからHelloWorldプロジェクトを選択し、右クリック
[Run As]-[Android Application]を選択する
5. エミュレータが起動し、右画面が表示されることを確認する
This material is licensed under the Creative
Commons License BY-NC-SA 4.0.
115
158. 方法2:Activityに
OnClickListenerを実装する
ActivityにOnClickListenerを実装する
手順
1. AnctivityにOnClickListenerを実装する
2. OnClickメソッドをオーバライドする
3. Button#setOnClickListenerで引数にthisを指定する
public class MainActivity extends Activity implements OnClickListener {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// OnCLickListenerの実装
Button bt = (Button) findViewById(R.id.button1);
// クリックされるとこのメソッドが呼ばれる
bt.setOnClickListener(this); ・・・
}
public void onClick(View v) {
if (v.getId() == R.id.button1) {
// Buton1が押されたときの処理
} else if (v.getId() == R.id.button2) {
// Buton2が押されたときの処理
}
}
This material is licensed under the Creative
Commons License BY-NC-SA 4.0.
・・・
③
・・・
②
158
①