ユーザ用ツール

差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

両方とも前のリビジョン前のリビジョン
次のリビジョン
前のリビジョン
暗黙のインテント [2025/06/03 01:24] – [画像をギャラリーから取得する] araki暗黙のインテント [2025/06/03 01:25] (現在) – [画像をインテント経由で受け取る] araki
行 42: 行 42:
 インテントからデータを受け取るためには、受け取りたい Activityに Intent-filterを定義してやる必要がある。Manifest ファイルで、 インテントからデータを受け取るためには、受け取りたい Activityに Intent-filterを定義してやる必要がある。Manifest ファイルで、
  
-<code>+<code xml>
 <intent-filter> <intent-filter>
     <action android:name="android.intent.action.SEND"/>     <action android:name="android.intent.action.SEND"/>
行 58: 行 58:
 プログラム側では、onCreate()の中で、次のようにデータを受け取る。URIはParcelableで渡されてくるので注意。Stringなどではないので、誤った受け取り方をすると、NullPointer例外などを引き起こす。 プログラム側では、onCreate()の中で、次のようにデータを受け取る。URIはParcelableで渡されてくるので注意。Stringなどではないので、誤った受け取り方をすると、NullPointer例外などを引き起こす。
  
-<code>+<code java>
 Intent intent = getIntent(); Intent intent = getIntent();
 String action = intent.getAction(); String action = intent.getAction();

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also, you acknowledge that you have read and understand our Privacy Policy. If you do not agree, please leave the website.

More information