什么是Android的显性与隐性的活动通话之间的有什么不同?显性、隐性、有什么不同、Android

2023-09-12 22:11:34 作者:刻骨铭心的是回忆

什么是明确的和隐含的活动通话之间的不同的Andr​​oid?如果你用一个简单的例子来说明,答案将是不错的:)

What is the different between Explicit and implicit activity call in android ? if you explain the answer with a simple example will be good :)

推荐答案

例如:

隐活动通话

   <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>

和其他的方式来调用隐含的意图是如下。

And the Other way to call implicit Intent is below.

Intent intent = new Intent(Intent.ACTION_VIEW,
                           Uri.parse("http://www.example.com"));
startActivity(intent);

明确活动的呼叫:您拨打一个电话,指示到底哪个活动类:

Explicit activity call: You make a call that indicate exactly which activity class:

Intent intent = new Intent(this, ActivityABC.class);
i.putExtra("Value", "This value for ActivityABC");
startActivity(intent);

希望这有助于您了解更多关于Android的显性和隐性的活动通话。 你可以得到更详细的关于Android意图

Hope this help you understand more about Explicit and implicit activity call in android. You can get more detail about Android Intent here