简体   繁体   中英

how to call subactivity of another application android?

To call main activity I saw componentName class in android.

intent = new Intent(new ComponentName(packageNam,classname);

if same is used in case of child activity, I got error , "is activity delcared in andorid manifest?" like error.

how to call app1 child activity in app2 by using intent ? In app1 the activity is declared like this in manifest

<activity android:name=".activity.MessageCompose" android:label="@string/app_name" android:enabled="false">
- <intent-filter>
  <action android:name="android.intent.action.VIEW" /> 
  <action android:name="android.intent.action.SENDTO" /> 
  <data android:scheme="mailto" /> 
  <category android:name="android.intent.category.DEFAULT" /> 
  <category android:name="android.intent.category.BROWSABLE" /> 
  </intent-filter>
- <intent-filter android:label="@string/app_name">
  <action android:name="android.intent.action.SEND" /> 
  <data android:mimeType="*/*" /> 
  <category android:name="android.intent.category.DEFAULT" /> 
  </intent-filter>
- <intent-filter android:label="@string/app_name">
  <action android:name="android.intent.action.SEND_MULTIPLE" /> 
  <data android:mimeType="*/*" /> 
  <category android:name="android.intent.category.DEFAULT" /> 
  </intent-filter>
  </activity>

Read up on how intents work in Android. Since the component you're launching is in another app, you can't access the component directly. In short, you need some way to identify the app1 child activity with an intent filter, then call that from app2 using something like this:

Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);

请在app1 / AndroidManifest.xml中声明该活动

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM