*

インテント

公開日: : android

基本

    //任意のアクティビティの起動
    Intent intent = new Intent(MultiSerch.this,ListBookMark.class);// インテントの作成
    startActivity(intent);// アクティビティの開始

	//呼び出すアクティビティにデータを渡す
	Intent intent = new Intent();
	intent.putExtra("key", "value");

	//呼び出し元intentから渡されたデータを取得
	Bundle extras = getIntent().getExtras();
	String taskName = extras.getString("taskName");
	//データがオブジェクトの場合
	StoreData data = (StoreData)intent.getSerializableExtra("StoreData");

	//呼び出し元にデータを送る
	Intent intent = new Intent();
	intent.putExtra("keyword", "value");
	setResult(RESULT_OK, intent);


標準機能との連携

    //マーケットを起動
    Uri uri = Uri.parse("market://details?id=" + packageName);
    Intent marketIntent = new Intent(Intent.ACTION_VIEW, uri);
    ((Activity)context).startActivity(marketIntent);

	//ブラウザを起動
	Intent intent = new Intent();
	intent.setAction(Intent.ACTION_VIEW);
	intent.setData(Uri.parse(uriString));
	startActivity(intent);

	//マップを起動
	Intent intent = new Intent();
	intent.setAction(Intent.ACTION_VIEW);
	intent.setClassName("com.google.android.apps.maps","com.google.android.maps.MapsActivity");
	//検索
	intent.setData(Uri.parse("http://maps.google.com/maps?q=東京"));
	//経路 dirflg=d|t|w : 車|電車|徒歩
	intent.setData(Uri.parse("http://maps.google.com/maps?saddr=35.671989,139.763965&daddr=35.671989,139.7&dirflg=w"));
	//地点
	intent.setData(Uri.parse("http://maps.google.com/maps?q=35.616209,140.114307(目的地)"));

	startActivity(intent);


	//マップを起動2
	Intent intent = new Intent();
	intent.setAction(Intent.ACTION_VIEW);
	//検索
	intent.setData(Uri.parse("geo:0,0?q=鳥貴族 新宿"));
	//地点
	intent.setData(Uri.parse("geo:35.671989,139.763965?z=1"));
	startActivity(intent);

関連記事

no image

【android】標準の設定画面を作る

設定画面のテンプレートです。 検索一発クンのコードから抜粋しました。 チェックボックス、リス

記事を読む

no image

【android】Activityとプロセスのライフサイクル

またもやライフサイクル周りでハマったのですが、Androidのライフサイクルは複雑で困ります。 G

記事を読む

no image

【android】言語・地域設定の取得

androidでは利用する言語と国名がjava.util.Localeのオブジェクトとして設定されて

記事を読む

no image

【android】IMEの表示/非表示

//IMEを閉じる InputMethodManager inputMethodManager

記事を読む

no image

【andoid】ViewPagerを使う

1. layout.xmlにViewPagerを配置  2. PagerAdapter.jav

記事を読む

no image

[android] JSONのパースにかかる時間

リストデータなんかを保存したいというのはよくある要件だと思います。 DBは面倒だしカラム毎に集計す

記事を読む

no image

【android】webviewでアプリ内にwebページを読み込む

webviewを使ってandroidアプリ内にwebページを読み込む定型文です。 //vie

記事を読む

no image

【android】ネットワークの接続状況を確認する

コードから接続状況を確認。 ConnectivityManager co

記事を読む

no image

【android】 webviewでassetsのリソースを使用する

webviewでassets内のリソースにアクセスするには file:///android_a

記事を読む

no image

【android】ホーム画面や他のアプリの前面にViewを表示する。

WindowManagerのTYPE_SYSTEM_ALERTのレイヤーにViewを表示することで、

記事を読む

Message

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

次のHTML タグと属性が使えます: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

no image
知らないと損をする6つのライセンスまとめ

オープンソースやフリーウェア、フリー素材などが巷に溢れ、それらを利用す

no image
ガリレオ:ニュースブラウザをリリースしました。

概要 ガリレオはニュースを読んだり、検索する機能に特化したブラウザア

no image
【android】Activityとプロセスのライフサイクル

またもやライフサイクル周りでハマったのですが、Androidのライフサ

→もっと見る

PAGE TOP ↑