Boss temporarily let me do a demo, to implement an app to open another app
Requirements: Click on the Open button, have installed the words opened, no installation display installation
Sub-program can no longer display icon on mobile phone page
Parent Program Core Code
public void OnClick (View arg0) {
//TODO auto-generated method stub
Intent Intent = new Intent ();
COM.EXAMPLE.DEMO2: Child package name com.example.demo2.MainActivity: subroutine open page
componentname cn = New ComponentName (" Com.example.demo2 "," com.example.demo2.MainActivity ");
Intent.setcomponent (CN);
Intent.setaction ("Android.intent.action.MAIN");
try {
Startactivityforresult (intent, RESULT_OK);
} catch (Exception e) {
Toast.maketext ( Mainactivity.this, "No sub-apps, please download Install", Toast.length_short). Show ();
}
}
Subroutines only need to set a line of code under the manifest file
<application
android:allowbackup= "true"
android:icon= "@drawable/ic_launcher"
android:label= "@ String/app_name "
android:theme=" @style/apptheme ">
<activity
android:name=" Com.example.demo2.MainActivity "
android:label=" @string/app_name ">
<intent-filter>
< Action android:name= "Android.intent.action.MAIN"/>
<!--<category Android:name= " Android.intent.category.LAUNCHER "/>-->//comment out this line
</intent-filter>
</activity>
</application>