*

インテント

公開日: : 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】 adbコマンド集

●adbサービス起動 adb start-server ●adbサービス終了 adb

記事を読む

no image

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

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

記事を読む

no image

【android】DrawableとBitmap、リソースの相互変換 

Resource → Bitmap Bitmap bm = BitmapFactory.dec

記事を読む

no image

【android】 年月だけのDatePicker

final DatePicker datePicker = new DatePicker(sel

記事を読む

no image

【andoid】ViewPagerを使う

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

記事を読む

no image

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

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

記事を読む

no image

【android】アプリ内課金を実装する

アプリ内課金のサンプルコードを解析します。 参考URL 公式API Android

記事を読む

no image

【android】任意のスレッドで処理を行う

非UIスレッドでUIを操作したい場合に、任意の処理をUIスレッド上で実行する。 目次

記事を読む

no image

【android】オーバーレイでトップレイヤーにViewを表示する

常にホーム画面や他のアプリより前面にViewを表示する方法です。 前面に透明のViewGroupを

記事を読む

no image

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

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

記事を読む

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 ↑