More Related Content
PDF
PPT
Android Hacks - 合宿 Service PPTX
PDF
GDG DevFest 2020 Android data linkage info PDF
PPTX
Android lecture for iOS developers PPT
PPTX
Presentation janice s. dionisio Viewers also liked
PPT
orientamento Liceo Elio Vittorini Gela 2014_ 2015 PDF
PDF
Concurso Procuradoria Geral do Piauí PDF
PDF
Sleddin' Road_excerpt_7-7-16 PDF
PPTX
Climate Justice, #BlackLivesMatter, and Palestinian Liberation - Coalition of... PDF
How not to fail at programming education PPTX
PDF
In2thinking conference 2016.psh PDF
Finishing brands atomization technology - vietnamese PPTX
Corporate intro presentation PPTX
Acuerdos para evitar la ciberdependia PDF
Corporate intro presentation PPTX
Article Inspiration - Devlin PDF
Www.commercialconstructionla PDF
PPTX
PPTX
Diez años del descubrimiento de las células iPS Similar to 【Android勉強会】第一回Activity & intent
PPT
PDF
PDF
PPT
Android Hacks - 合宿 Activity PPT
PPS
PDF
【Android勉強会】第一回Activity & intent
- 1.
- 2.
- 3.
- 4.
- 5.
- 7.
- 8.
- 10.
- 11.
- 12.
- 13.
レイアウトリソースとの関連付け
Button button =(Button)findViewById①(R.id.button);
xmlファイルに記述したボタンなどのビューに関
して,Javaソースでidを引数に取ることによってそ
のオブジェクトを取得できる
→findViewById(id)
取得したオブジェクトに「クリック時の振る舞
い」などをセットできる
→setOnClickListener( new View.OnClickListener())
- 14.
イベントリスナーの実装
Button button =(Button)findViewById①(R.id.button);
button.setOnClickListener②(new View.OnClickListener() {
public void onClick(View v)③ {
Intent intent=new Intent(MainActivity.this, SecondActivity.class);
startActivity(intent);
}
});
①idからButtonオブジェクトを取得
②View.setOnclickListener(View.OnClickListener i)メソッドでbuttonオブ
ジェクトがクリックされた時の振る舞いを実装
③View.OnClickListenerインターフェースの抽象メソッドonClick(View v)に
て処理を記述
- 15.
イベントリスナーの実装
別の書き方(こっちの方が馴染みがあるかも)
………
Button button =(Button)findViewById①(R.id.button);
button.setOnClickListener②(new ButtonClickListener());
}
class ButtonClickListener implements OnClickListener{
public void onClick(View v)③ {
Intent intent=new Intent(MainActivity.this, SecondActivity.class);
startActivity(intent);
}
};
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
- 25.
暗黙的インテント
ブラウザ呼び出し
Intent intent= new
Intent(Intent.ACTION_VIEW,Uri.parse("http://www.google.co.jp"));
地図呼び出し
Intent intent = new
Intent(Intent.ACTION_VIEW,Uri.parse("geo:0,0?waseda"));
共有呼び出し(テキストデータ渡し)
Intent intent = new Intent();
intent.setAction(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT,"Hello,Google");
- 26.
- 27.
- 28.
Activityの構造
スタック ―複数のアクティビティを管理する
構造
タスク ― アクティビティ遷移の一連の流れを
まとめたもの。一つのアプリケーションから遷
移したアクティビティは同じタスクに入る。
- 29.
- 30.
- 31.
- 32.
- 33.
- 34.
- 35.
- 36.
- 37.
- 38.
- 39.