User Tools

Site Tools


code:android-code:如何调起其它ap的activity

需要在一个AP里调起其它AP的一个Activity,

比如我这里要调起Browser 的Download Page Activity

    /*
     * This method is called as a result of the user selecting the options menu
     * to see the download window, or when a download changes state. It shows
     * the download window ontop of the current window.
     */
    /* package */void viewDownloads(Uri downloadRecord) {
 
        Context friendContext = null;
        try {
            friendContext = this.createPackageContext("com.android.browser",
                    Context.CONTEXT_IGNORE_SECURITY);
        } catch (NameNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
 
        Intent intent = new Intent();
        intent.setComponent(new ComponentName("com.android.browser",
                "com.android.browser.BrowserDownloadPage"));
        intent.setData(downloadRecord);
        startActivity(intent);
    }

/var/www/dokuwiki/wiki/data/pages/code/android-code/如何调起其它ap的activity.txt · Last modified: 2016/05/05 13:07 by 127.0.0.1