検索
AND検索
OR検索
トップ
|
リロード
|
新規
|
一覧
|
単語検索
|
最終更新
|
ヘルプ
勉強会/インテントを発行してみよう をテンプレートにして作成
詳細は
入会方法
をご覧下さい。
メニュー
日本Androidの会とは?
入会方法
イベント
技術資料
ワーキンググループ
支部
リリース
Japan Android Report
リンク
FAQ
権利関係
プライバシーポリシー
Twitter
公式Youtubeチャンネル
NPOサイト
最新の10件
2023-11-13
ABC2023A-pr
リリース
2023-10-13
MenuBar
入会方法
2023-09-17
ワーキンググループ/香川支部
2023-09-07
林田官呂
2023-08-19
イベント/イベント予定表
2023-06-11
日本Androidの会とは?
2023-06-01
秋葉 楓
2022-11-07
スタッフ
edit
Total:0/Today:0
開始行:
[[勉強会]]
* インテントを発行してみよう [#lb576677]
インテントとは、アプリケーションから、新しいアクティビテ...
起動するアクティビティは、同じアプリケーション内のアクテ...
ここでは、代表的なアクションである、ACTION_VIEWに対する動...
** プロジェクトを作成しましょう [#u24e2ce2]
- "File -> New -> Project"を選択して、開いたダイアログで"...
- 開いたダイアログで、以下のように入力してFinishボタンを...
-- Project Name: HelloIntent
-- Package name: jp.hews.hellointent
-- Activity Name: HelloIntentActivity
-- Application Name: ハローインテント
** 表示文字列を定義する [#xe5e9d08]
- res/values/strings.xmlを開いて、ボタンに表示するための...
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hello">Hello World, HelloIntent</string>
<string name="app_name">ハローインテント</string>
<!-- 押しボタンに表示する文字列 -->
<string name="button_label">開始</string>
</resources>
** 画面を定義する [#v8f3894b]
- res/layout/main.xmlを編集して、画面を定義します。テキス...
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/...
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<EditText android:id="@+id/edit_text_id"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<Button android:id="@+id/button_id"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/button_label" />
<TextView android:id="@+id/text_id"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</LinearLayout>
#ref(intent.001.main.png)
** ボタンにリスナーを登録します [#r4fd4044]
- HelloIntentActivity.javaを開いて、onCreateメソッドでボ...
- ボタンリスナーを作成して、リスナー内のonClickメソッドで...
- onClickListenerでリスナーを登録します。
private View.OnClickListener mButtonListener =
new View.OnClickListener() {
public void onClick(View v) {
sendIntent();
}
};
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button b = (Button)findViewById(R.id.button_id);
b.setOnClickListener(mButtonListener);
}
** インテントを作成して、発行する [#e36747e2]
- EditTextの内容をUriに変換して、インテントを作成します。
- 作成したインテントを引数にしてstartActivityを呼び出しま...
- エラー発生時は、TextViewにエラーを表示します。
private void sendIntent() {
try {
EditText et = (EditText)findViewById(R.id.edit_t...
Intent i = new Intent(Intent.ACTION_VIEW,
Uri.parse(et.getText().toS...
startActivity(i);
} catch (Exception e) {
TextView t = (TextView)findViewById(R.id.text_id);
t.setText(e.toString());
}
}
** Uriを入力してみる [#x44fbe3e]
- あらかじめ組み込まれているUriに対応するアクティビティを...
|Uri|動作|例|
|http://web_address |ブラウザを起動する|http://www.google...
|tel:phone_number|ダイヤル画面を表示します|tel:123456|
|geo:latitude,longitude|地図を表示します|geo:0,0?q=Sapporo|
|content://contacts/people|コンタクトリストを表示します|c...
** 地図を表示してみる [#h4537c94]
- geo:0,0?q=Sapporo
#ref(intent.002.Sapporo.png)
** まとめ [#g4eae58e]
- インテントは、アクションと、Uriで指定します
- startActivityを呼び出すと対応するアクティビティが起動し...
- Androidにはいくつかのインテントに対応するアクティビティ...
** ソースコード [#e1cc3414]
package jp.hews.hellointent;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
public class HelloIntentActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button b = (Button)findViewById(R.id.button_id);
b.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
sendIntent();
}});
}
private void sendIntent() {
try {
EditText et = (EditText)findViewById(R.id.ed...
Intent i = new Intent(Intent.ACTION_VIEW,
Uri.parse(et.getText()...
startActivity(i);
} catch (Exception e) {
TextView t = (TextView)findViewById(R.id.tex...
t.setText(e.toString());
}
}
}
** プレゼンテーション資料 [#m302c589]
#ref(インテントを発行してみよう.pdf)
終了行:
[[勉強会]]
* インテントを発行してみよう [#lb576677]
インテントとは、アプリケーションから、新しいアクティビテ...
起動するアクティビティは、同じアプリケーション内のアクテ...
ここでは、代表的なアクションである、ACTION_VIEWに対する動...
** プロジェクトを作成しましょう [#u24e2ce2]
- "File -> New -> Project"を選択して、開いたダイアログで"...
- 開いたダイアログで、以下のように入力してFinishボタンを...
-- Project Name: HelloIntent
-- Package name: jp.hews.hellointent
-- Activity Name: HelloIntentActivity
-- Application Name: ハローインテント
** 表示文字列を定義する [#xe5e9d08]
- res/values/strings.xmlを開いて、ボタンに表示するための...
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hello">Hello World, HelloIntent</string>
<string name="app_name">ハローインテント</string>
<!-- 押しボタンに表示する文字列 -->
<string name="button_label">開始</string>
</resources>
** 画面を定義する [#v8f3894b]
- res/layout/main.xmlを編集して、画面を定義します。テキス...
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/...
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<EditText android:id="@+id/edit_text_id"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<Button android:id="@+id/button_id"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/button_label" />
<TextView android:id="@+id/text_id"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</LinearLayout>
#ref(intent.001.main.png)
** ボタンにリスナーを登録します [#r4fd4044]
- HelloIntentActivity.javaを開いて、onCreateメソッドでボ...
- ボタンリスナーを作成して、リスナー内のonClickメソッドで...
- onClickListenerでリスナーを登録します。
private View.OnClickListener mButtonListener =
new View.OnClickListener() {
public void onClick(View v) {
sendIntent();
}
};
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button b = (Button)findViewById(R.id.button_id);
b.setOnClickListener(mButtonListener);
}
** インテントを作成して、発行する [#e36747e2]
- EditTextの内容をUriに変換して、インテントを作成します。
- 作成したインテントを引数にしてstartActivityを呼び出しま...
- エラー発生時は、TextViewにエラーを表示します。
private void sendIntent() {
try {
EditText et = (EditText)findViewById(R.id.edit_t...
Intent i = new Intent(Intent.ACTION_VIEW,
Uri.parse(et.getText().toS...
startActivity(i);
} catch (Exception e) {
TextView t = (TextView)findViewById(R.id.text_id);
t.setText(e.toString());
}
}
** Uriを入力してみる [#x44fbe3e]
- あらかじめ組み込まれているUriに対応するアクティビティを...
|Uri|動作|例|
|http://web_address |ブラウザを起動する|http://www.google...
|tel:phone_number|ダイヤル画面を表示します|tel:123456|
|geo:latitude,longitude|地図を表示します|geo:0,0?q=Sapporo|
|content://contacts/people|コンタクトリストを表示します|c...
** 地図を表示してみる [#h4537c94]
- geo:0,0?q=Sapporo
#ref(intent.002.Sapporo.png)
** まとめ [#g4eae58e]
- インテントは、アクションと、Uriで指定します
- startActivityを呼び出すと対応するアクティビティが起動し...
- Androidにはいくつかのインテントに対応するアクティビティ...
** ソースコード [#e1cc3414]
package jp.hews.hellointent;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
public class HelloIntentActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button b = (Button)findViewById(R.id.button_id);
b.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
sendIntent();
}});
}
private void sendIntent() {
try {
EditText et = (EditText)findViewById(R.id.ed...
Intent i = new Intent(Intent.ACTION_VIEW,
Uri.parse(et.getText()...
startActivity(i);
} catch (Exception e) {
TextView t = (TextView)findViewById(R.id.tex...
t.setText(e.toString());
}
}
}
** プレゼンテーション資料 [#m302c589]
#ref(インテントを発行してみよう.pdf)
ページ名: