Android plug-in-apkplug starts the plug-in Activity from the host-06

Source: Internet
Author: User

The plug-in is an apk file that has its own Activity interface and UI display. This section describes how to configure the plug-in to start the Activity and how to start it from the host.

1. Configure the external startup Activity of the plug-in apk (internal activity does not need to be configured)

Different from common apps, The AndroidManifest. xml configuration of the plug-in is invalid in the apkplug framework. We need to configure it in plugin. xml to be recognized by apkplug.

Set the property

Bundle-Activity = xxx. Activity

Only the Activity set as Bundle-activity can be started from the host. Otherwise, an exception of the corresponding class cannot be found.

2. Set multiple external launch activities

If you have multiple activities that need to be started from the outside, you can use, split as shown in

Bundle-Activity = a. B. c, d. e. f, j. q. p

The preceding three activities are configured. You can use Bundle. getBundleActivity () of the plug-in to obtain this string from external startup.

Bundle. getBundleActivity (). split (,) [0] splits the corresponding Activity Class

3. Start activity

There are many ways to start a plug-in activity. The simplest way is to start a native activity.

Intent I = new Intent ();
I. setClassName (mContext, Bundle. getBundleActivity (). split (,) [0]);

// Start with this label
I. addFlags (Intent. FLAG_ACTIVITY_NEW_TASK );
MContext. startActivity (I );

Four plug-in internal activity calls

It can be called in android native mode.

Note that all plug-in activities can only be started in I. addFlags (Intent. FLAG_ACTIVITY_NEW_TASK );

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.