当前位置: 首页>>代码示例>>Java>>正文


Java Intent.setSelector方法代码示例

本文整理汇总了Java中android.content.Intent.setSelector方法的典型用法代码示例。如果您正苦于以下问题:Java Intent.setSelector方法的具体用法?Java Intent.setSelector怎么用?Java Intent.setSelector使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.content.Intent的用法示例。


在下文中一共展示了Intent.setSelector方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreate

import android.content.Intent; //导入方法依赖的package包/类
protected void onCreate(Bundle savedInstanceState) {
    try {
        super.onCreate(savedInstanceState);
        Intent intent = getIntent();
        if (intent != null) {
            Intent forwordIntent = getForwarIntent();
            if (forwordIntent != null) {
                forwordIntent.addFlags(268435456);
                forwordIntent.putExtras(intent);
                if (VERSION.SDK_INT >= 15) {
                    forwordIntent.setSelector(null);
                }
                if (ApkManager.getInstance().isConnected()) {
                    if (isPlugin(forwordIntent)) {
                        startActivity(forwordIntent);
                    }
                    finish();
                    return;
                }
                waitAndStart(forwordIntent);
                return;
            }
            finish();
            return;
        }
        finish();
    } catch (Exception e) {
        e.printStackTrace();
        finish();
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:32,代码来源:ShortcutProxyActivity.java

示例2: onCreate

import android.content.Intent; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    try {
        super.onCreate(savedInstanceState);
        Intent intent = getIntent();

        if (intent != null) {
            Intent forwordIntent = getForwarIntent();
            if (forwordIntent != null) {
                forwordIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                forwordIntent.putExtras(intent);
                //安全审核问题
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
                    forwordIntent.setSelector(null);
                }
                if (PluginManager.getInstance().isConnected()) {
                    if (isPlugin(forwordIntent)) {
                        execStartForwordIntent(forwordIntent);
                    }
                    finish();
                } else {
                    waitAndStart(forwordIntent);
                }
            } else {
                finish();
            }
        } else {
            finish();
        }
    } catch (Exception e) {
        e.printStackTrace();
        finish();
    }
}
 
开发者ID:amikey,项目名称:DroidPlugin,代码行数:35,代码来源:ShortcutProxyActivity.java

示例3: shouldOverrideUrlLoading

import android.content.Intent; //导入方法依赖的package包/类
/**
 * Give the host application a chance to take over the control when a new url
 * is about to be loaded in the current WebView.
 *
 * @param view          The WebView that is initiating the callback.
 * @param url           The url to be loaded.
 * @return              true to override, false for default behavior
 */
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1)
boolean shouldOverrideUrlLoading(WebView view, String url) {
    // Give plugins the chance to handle the url
    if (this.appView.pluginManager.onOverrideUrlLoading(url)) {
        // Do nothing other than what the plugins wanted.
        // If any returned true, then the request was handled.
        return true;
    }
    else if(url.startsWith("file://") | url.startsWith("data:"))
    {
        //This directory on WebKit/Blink based webviews contains SQLite databases!
        //DON'T CHANGE THIS UNLESS YOU KNOW WHAT YOU'RE DOING!
        return url.contains("app_webview");
    }
    else if (appView.getWhitelist().isUrlWhiteListed(url)) {
        // Allow internal navigation
        return false;
    }
    else if (appView.getExternalWhitelist().isUrlWhiteListed(url))
    {
        try {
            Intent intent = new Intent(Intent.ACTION_VIEW);
            intent.setData(Uri.parse(url));
            intent.addCategory(Intent.CATEGORY_BROWSABLE);
            intent.setComponent(null);
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
                intent.setSelector(null);
            }
            this.cordova.getActivity().startActivity(intent);
            return true;
        } catch (android.content.ActivityNotFoundException e) {
            LOG.e(TAG, "Error loading url " + url, e);
        }
    }
    // Intercept the request and do nothing with it -- block it
    return true;
}
 
开发者ID:aabognah,项目名称:LoRaWAN-Smart-Parking,代码行数:46,代码来源:CordovaUriHelper.java

示例4: onDownloadStart

import android.content.Intent; //导入方法依赖的package包/类
/**
 * Notify the host application a download should be done, or that the data
 * should be streamed if a streaming viewer is available.
 *
 * @param context            The context in which the download was requested.
 * @param url                The full url to the content that should be downloaded
 * @param userAgent          User agent of the downloading application.
 * @param contentDisposition Content-disposition http header, if present.
 * @param mimetype           The mimetype of the content reported by the server
 * @param contentSize        The size of the content
 */
public void onDownloadStart(@NonNull Activity context, @NonNull PreferenceManager manager, String url, String userAgent,
                            @Nullable String contentDisposition, String mimetype, String contentSize) {

    Log.d(TAG, "DOWNLOAD: Trying to download from URL: " + url);
    Log.d(TAG, "DOWNLOAD: Content disposition: " + contentDisposition);
    Log.d(TAG, "DOWNLOAD: Mimetype: " + mimetype);
    Log.d(TAG, "DOWNLOAD: User agent: " + userAgent);

    // if we're dealing wih A/V content that's not explicitly marked
    // for download, check if it's streamable.
    if (contentDisposition == null
        || !contentDisposition.regionMatches(true, 0, "attachment", 0, 10)) {
        // query the package manager to see if there's a registered handler
        // that matches.
        Intent intent = new Intent(Intent.ACTION_VIEW);
        intent.setDataAndType(Uri.parse(url), mimetype);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        intent.addCategory(Intent.CATEGORY_BROWSABLE);
        intent.setComponent(null);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
            intent.setSelector(null);
        }
        ResolveInfo info = context.getPackageManager().resolveActivity(intent,
            PackageManager.MATCH_DEFAULT_ONLY);
        if (info != null) {
            // If we resolved to ourselves, we don't want to attempt to
            // load the url only to try and download it again.
            if (BuildConfig.APPLICATION_ID.equals(info.activityInfo.packageName)
                || MainActivity.class.getName().equals(info.activityInfo.name)) {
                // someone (other than us) knows how to handle this mime
                // type with this scheme, don't download.
                try {
                    context.startActivity(intent);
                    return;
                } catch (ActivityNotFoundException ex) {
                    // Best behavior is to fall back to a download in this
                    // case
                }
            }
        }
    }
    onDownloadStartNoStream(context, manager, url, userAgent, contentDisposition, mimetype, contentSize);
}
 
开发者ID:XndroidDev,项目名称:Xndroid,代码行数:55,代码来源:DownloadHandler.java


注:本文中的android.content.Intent.setSelector方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。