use*_*535 18 android android-intent
我对隐式和显式意图之间的区别感到困惑.隐式和显式意图的目的是什么,为什么使用这些概念?
我是Android应用程序的新手,所以请提供一些示例.
kum*_*oid 45
使用意图过滤器,您可以为活动创建操作,以便其他应用可以通过操作调用您的活动:
<activity android:name=".BrowserActivitiy" android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="http"/>
</intent-filter>
</activity>
Run Code Online (Sandbox Code Playgroud)
.
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.example.com"));
startActivity(intent);
Run Code Online (Sandbox Code Playgroud)
您拨打电话,准确指出要使用的活动类:
Intent intent = new Intent(this, ActivityABC.class);
startActivity(intent);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
37765 次 |
| 最近记录: |