當前位置: 首頁>>代碼示例>>Java>>正文


Java Intent.setExtrasClassLoader方法代碼示例

本文整理匯總了Java中android.content.Intent.setExtrasClassLoader方法的典型用法代碼示例。如果您正苦於以下問題:Java Intent.setExtrasClassLoader方法的具體用法?Java Intent.setExtrasClassLoader怎麽用?Java Intent.setExtrasClassLoader使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.content.Intent的用法示例。


在下文中一共展示了Intent.setExtrasClassLoader方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getIntent

import android.content.Intent; //導入方法依賴的package包/類
private static Intent getIntent(Context context, IntentType intentType, DataCollector dataCollector, SiteToSiteClientConfig siteToSiteClientConfig, Integer requestCode, Parcelable transactionResultCallback) {
    Intent intent = new Intent(context, SiteToSiteRepeating.class);
    if (dataCollector != null) {
        intent.setExtrasClassLoader(dataCollector.getClass().getClassLoader());
    } else if (transactionResultCallback != null) {
        intent.setExtrasClassLoader(transactionResultCallback.getClass().getClassLoader());
    } else {
        intent.setExtrasClassLoader(siteToSiteClientConfig.getClass().getClassLoader());
    }
    intent.putExtra(SiteToSiteService.INTENT_TYPE, intentType.name());

    if (requestCode == null) {
        // Find unused requestCode
        PendingIntent existing;
        do {
            requestCode = random.nextInt();
            existing = PendingIntent.getBroadcast(context, requestCode, intent, PendingIntent.FLAG_NO_CREATE);
        } while (existing != null);
    }

    intent.putExtra(REQUEST_CODE, requestCode);
    SerializationUtils.putParcelable(dataCollector, intent, DATA_COLLECTOR);
    SerializationUtils.putParcelable(transactionResultCallback, intent, SiteToSiteService.TRANSACTION_RESULT_CALLBACK);
    SerializationUtils.putParcelable(siteToSiteClientConfig, intent, SiteToSiteService.SITE_TO_SITE_CONFIG);
    return intent;
}
 
開發者ID:hortonworks,項目名稱:nifi-android-s2s,代碼行數:27,代碼來源:SiteToSiteRepeating.java

示例2: StackRemoteViewsFactory

import android.content.Intent; //導入方法依賴的package包/類
public StackRemoteViewsFactory(Context applicationContext, Intent intent) {
    Log.v(TAG, "StackRemoteViewsFactory");
    intent.setExtrasClassLoader(GitHubJourneyWidgetDataEntry.class.getClassLoader());
    this.context = applicationContext;
    appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, 1);
    Bundle bundle = intent.getBundleExtra("bundle");
    Parcelable[] items = bundle.getParcelableArray("parcelables");
    Log.v(TAG, "items size = " + items.length);

    if (items.length != 0) {
        widgetDatas = new ArrayList<>(items.length);
        for (Parcelable item : items) {
            widgetDatas.add((GitHubJourneyWidgetDataEntry) item);
        }
    } else {
        widgetDatas = new ArrayList<>(0);
    }
    Log.v(TAG, "widgetDatas" + widgetDatas.size());
}
 
開發者ID:OlgaKuklina,項目名稱:GitJourney,代碼行數:20,代碼來源:StackWidgetService.java

示例3: handleOnStartOne

import android.content.Intent; //導入方法依賴的package包/類
private void handleOnStartOne(Intent intent, int flags, int startIds) throws Exception {
    ServiceInfo info = ApkManager.getInstance().resolveServiceInfo(intent, 0);
    if (info != null) {
        Service service = (Service) this.mNameService.get(info.name);
        if (service != null) {
            intent.setExtrasClassLoader(getClassLoader(info.applicationInfo));
            Object token = findTokenByService(service);
            Integer integer = (Integer) this.mServiceTaskIds.get(token);
            if (integer == null) {
                integer = Integer.valueOf(-1);
            }
            int startId = integer.intValue() + 1;
            this.mServiceTaskIds.put(token, Integer.valueOf(startId));
            int res = service.onStartCommand(intent, flags, startId);
            QueuedWorkCompat.waitToFinish();
        }
    }
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:19,代碼來源:ServcesManager.java

示例4: handleMessage

import android.content.Intent; //導入方法依賴的package包/類
@Override
public boolean handleMessage(Message msg) {
    if (msg.what == LAUNCH_ACTIVITY) {
        // ActivityClientRecord r
        Object r = msg.obj;
        try {
            Intent intent = (Intent) ReflectUtil.getField(r.getClass(), r, "intent");
            intent.setExtrasClassLoader(VAInstrumentation.class.getClassLoader());
            ActivityInfo activityInfo = (ActivityInfo) ReflectUtil.getField(r.getClass(), r, "activityInfo");

            if (PluginUtil.isIntentFromPlugin(intent)) {
                int theme = PluginUtil.getTheme(mPluginManager.getHostContext(), intent);
                if (theme != 0) {
                    Log.i(TAG, "resolve theme, current theme:" + activityInfo.theme + "  after :0x" + Integer.toHexString(theme));
                    activityInfo.theme = theme;
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    return false;
}
 
開發者ID:didi,項目名稱:VirtualAPK,代碼行數:25,代碼來源:VAInstrumentation.java

示例5: sendIntent2Process

import android.content.Intent; //導入方法依賴的package包/類
private void sendIntent2Process(String target, Intent intent, boolean sync) throws RemoteException {
    if (LOG) {
        LogDebug.d(PLUGIN_TAG, "sendIntent2Process target=" + target + " intent=" + intent);
    }

    if (TextUtils.equals(target, IPC.getPluginHostProcessName())) {
        intent.setExtrasClassLoader(getClass().getClassLoader());
        if (sync) {
            LocalBroadcastHelper.sendBroadcastSyncUi(mContext, intent);
        } else {
            LocalBroadcastManager.getInstance(mContext).sendBroadcast(intent);
        }
        return;
    }

    if (TextUtils.isEmpty(target)) {
        intent.setExtrasClassLoader(getClass().getClassLoader());
        if (sync) {
            LocalBroadcastHelper.sendBroadcastSyncUi(mContext, intent);
        } else {
            LocalBroadcastManager.getInstance(mContext).sendBroadcast(intent);
        }
    }
    PluginProcessMain.sendIntent2Process(target, intent, sync);
}
 
開發者ID:wangyupeng1-iri,項目名稱:springreplugin,代碼行數:26,代碼來源:PmHostSvc.java

示例6: handleOnStartOne

import android.content.Intent; //導入方法依賴的package包/類
private void handleOnStartOne(Intent intent, int flags, int startIds) throws Exception {
    ServiceInfo info = PluginManager.getInstance().resolveServiceInfo(intent, 0);
    if (info != null) {
        Service service = mNameService.get(info.name);
        if (service != null) {
            ClassLoader classLoader = getClassLoader(info.applicationInfo);
            intent.setExtrasClassLoader(classLoader);
            Object token = findTokenByService(service);
            Integer integer = mServiceTaskIds.get(token);
            if (integer == null) {
                integer = -1;
            }
            int startId = integer + 1;
            mServiceTaskIds.put(token, startId);
            int res = service.onStartCommand(intent, flags, startId);
            QueuedWorkCompat.waitToFinish();
        }
    }
}
 
開發者ID:amikey,項目名稱:DroidPlugin,代碼行數:20,代碼來源:ServcesManager.java

示例7: handleServiceArgs

import android.content.Intent; //導入方法依賴的package包/類
private void handleServiceArgs(Intent serviceIntent,IBinder token){
    Service service = mActivateServices.get(token);
    if(service!=null){
        if(serviceIntent!=null) {
            serviceIntent.setExtrasClassLoader(service.getClassLoader());
        }
        service.onStartCommand(serviceIntent,Service.START_FLAG_RETRY,0);
    }
}
 
開發者ID:alibaba,項目名稱:atlas,代碼行數:10,代碼來源:BaseDelegateService.java

示例8: handleOnTaskRemovedOne

import android.content.Intent; //導入方法依賴的package包/類
private void handleOnTaskRemovedOne(Intent intent) throws Exception {
    if (VERSION.SDK_INT >= 14) {
        ServiceInfo info = ApkManager.getInstance().resolveServiceInfo(intent, 0);
        if (info != null) {
            Service service = (Service) this.mNameService.get(info.name);
            if (service != null) {
                intent.setExtrasClassLoader(getClassLoader(info.applicationInfo));
                service.onTaskRemoved(intent);
                QueuedWorkCompat.waitToFinish();
            }
            QueuedWorkCompat.waitToFinish();
        }
    }
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:15,代碼來源:ServcesManager.java

示例9: handleOnBindOne

import android.content.Intent; //導入方法依賴的package包/類
private IBinder handleOnBindOne(Intent intent) throws Exception {
    ServiceInfo info = ApkManager.getInstance().resolveServiceInfo(intent, 0);
    if (info != null) {
        Service service = (Service) this.mNameService.get(info.name);
        if (service != null) {
            intent.setExtrasClassLoader(getClassLoader(info.applicationInfo));
            return service.onBind(intent);
        }
    }
    return null;
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:12,代碼來源:ServcesManager.java

示例10: handleOnRebindOne

import android.content.Intent; //導入方法依賴的package包/類
private void handleOnRebindOne(Intent intent) throws Exception {
    ServiceInfo info = ApkManager.getInstance().resolveServiceInfo(intent, 0);
    if (info != null) {
        Service service = (Service) this.mNameService.get(info.name);
        if (service != null) {
            intent.setExtrasClassLoader(getClassLoader(info.applicationInfo));
            service.onRebind(intent);
        }
    }
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:11,代碼來源:ServcesManager.java

示例11: handleOnUnbindOne

import android.content.Intent; //導入方法依賴的package包/類
private boolean handleOnUnbindOne(Intent intent) throws Exception {
    ServiceInfo info = ApkManager.getInstance().resolveServiceInfo(intent, 0);
    if (info == null) {
        return false;
    }
    Service service = (Service) this.mNameService.get(info.name);
    if (service == null) {
        return false;
    }
    intent.setExtrasClassLoader(getClassLoader(info.applicationInfo));
    return service.onUnbind(intent);
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:13,代碼來源:ServcesManager.java

示例12: sendIntent

import android.content.Intent; //導入方法依賴的package包/類
private void sendIntent(Intent intent, boolean sync) throws RemoteException {
    if (LOG) {
        LogDebug.d(PLUGIN_TAG, "sendIntent pr=" + IPC.getCurrentProcessName() + " intent=" + intent);
    }
    intent.setExtrasClassLoader(getClass().getClassLoader());
    if (sync) {
        LocalBroadcastHelper.sendBroadcastSyncUi(mContext, intent);
    } else {
        LocalBroadcastManager.getInstance(mContext).sendBroadcast(intent);
    }
}
 
開發者ID:wangyupeng1-iri,項目名稱:springreplugin,代碼行數:12,代碼來源:PluginProcessPer.java

示例13: handleActivityCreateBefore

import android.content.Intent; //導入方法依賴的package包/類
/**
 * @hide 內部方法,插件框架使用
 * 插件的Activity的onCreate調用前調用此方法
 * @param activity
 * @param savedInstanceState
 */
public void handleActivityCreateBefore(Activity activity, Bundle savedInstanceState) {
    if (LOG) {
        LogDebug.d(PLUGIN_TAG, "activity create before: " + activity.getClass().getName() + " this=" + activity.hashCode() + " taskid=" + activity.getTaskId());
    }

    // 對FragmentActivity做特殊處理
    if (savedInstanceState != null) {
        //
        savedInstanceState.setClassLoader(activity.getClassLoader());
        //
        try {
            savedInstanceState.remove("android:support:fragments");
        } catch (Throwable e) {
            if (LOGR) {
                LogRelease.e(PLUGIN_TAG, "a.c.b1: " + e.getMessage(), e);
            }
        }
    }

    // 對FragmentActivity做特殊處理
    Intent intent = activity.getIntent();
    if (intent != null) {
        intent.setExtrasClassLoader(activity.getClassLoader());
        activity.setTheme(getThemeId(activity, intent));
    }
}
 
開發者ID:wangyupeng1-iri,項目名稱:springreplugin,代碼行數:33,代碼來源:PluginLibraryInternalProxy.java

示例14: setIntentClassLoader

import android.content.Intent; //導入方法依賴的package包/類
private void setIntentClassLoader(Intent intent, ClassLoader classLoader) {
    try {
        Bundle mExtras = (Bundle) FieldUtils.readField(intent, "mExtras");
        if (mExtras != null) {
            mExtras.setClassLoader(classLoader);
        } else {
            Bundle value = new Bundle();
            value.setClassLoader(classLoader);
            FieldUtils.writeField(intent, "mExtras", value);
        }
    } catch (Exception e) {
    } finally {
        intent.setExtrasClassLoader(classLoader);
    }
}
 
開發者ID:amikey,項目名稱:DroidPlugin,代碼行數:16,代碼來源:IActivityManagerHookHandle.java

示例15: handleOnTaskRemovedOne

import android.content.Intent; //導入方法依賴的package包/類
private void handleOnTaskRemovedOne(Intent intent) throws Exception {
    if (VERSION.SDK_INT >= VERSION_CODES.ICE_CREAM_SANDWICH) {
        ServiceInfo info = PluginManager.getInstance().resolveServiceInfo(intent, 0);
        if (info != null) {
            Service service = mNameService.get(info.name);
            if (service != null) {
                ClassLoader classLoader = getClassLoader(info.applicationInfo);
                intent.setExtrasClassLoader(classLoader);
                service.onTaskRemoved(intent);
                QueuedWorkCompat.waitToFinish();
            }
            QueuedWorkCompat.waitToFinish();
        }
    }
}
 
開發者ID:amikey,項目名稱:DroidPlugin,代碼行數:16,代碼來源:ServcesManager.java


注:本文中的android.content.Intent.setExtrasClassLoader方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。