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


Java Intent.removeExtra方法代码示例

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


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

示例1: fragmentArgumentsToIntent

import android.content.Intent; //导入方法依赖的package包/类
/**
 * Converts a fragment arguments bundle into an intent.
 */
public static Intent fragmentArgumentsToIntent(Bundle arguments) {
    Intent intent = new Intent();
    if (arguments == null) {
        return intent;
    }

    final Uri data = arguments.getParcelable("_uri");
    if (data != null) {
        intent.setData(data);
    }

    intent.putExtras(arguments);
    intent.removeExtra("_uri");
    return intent;
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:19,代码来源:BaseActivity.java

示例2: handleInstallShortcutIntent

import android.content.Intent; //导入方法依赖的package包/类
private Intent handleInstallShortcutIntent(Intent intent) {
    Intent shortcut = intent.getParcelableExtra(Intent.EXTRA_SHORTCUT_INTENT);
    if (shortcut != null) {
        ComponentName component = shortcut.resolveActivity(VirtualCore.getPM());
        if (component != null) {
            String pkg = component.getPackageName();
            Intent newShortcutIntent = new Intent();
            newShortcutIntent.setClassName(getHostPkg(), Constants.SHORTCUT_PROXY_ACTIVITY_NAME);
            newShortcutIntent.addCategory(Intent.CATEGORY_DEFAULT);
            newShortcutIntent.putExtra("_VA_|_intent_", shortcut);
            newShortcutIntent.putExtra("_VA_|_uri_", shortcut.toUri(0));
            newShortcutIntent.putExtra("_VA_|_user_id_", VUserHandle.myUserId());
            intent.removeExtra(Intent.EXTRA_SHORTCUT_INTENT);
            intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, newShortcutIntent);

            Intent.ShortcutIconResource icon = intent.getParcelableExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE);
            if (icon != null && !TextUtils.equals(icon.packageName, getHostPkg())) {
                try {
                    Resources resources = VirtualCore.get().getResources(pkg);
                    if (resources != null) {
                        int resId = resources.getIdentifier(icon.resourceName, "drawable", pkg);
                        if (resId > 0) {
                            Drawable iconDrawable = resources.getDrawable(resId);
                            Bitmap newIcon = BitmapUtils.drawableToBitmap(iconDrawable);
                            if (newIcon != null) {
                                intent.removeExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE);
                                intent.putExtra(Intent.EXTRA_SHORTCUT_ICON, newIcon);
                            }
                        }
                    }
                } catch (Throwable e) {
                    e.printStackTrace();
                }
            }
        }
    }
    return intent;
}
 
开发者ID:codehz,项目名称:container,代码行数:39,代码来源:BroadcastIntent.java

示例3: postCleanup

import android.content.Intent; //导入方法依赖的package包/类
private void postCleanup() {
    if (mLauncher != null) {
        // Remove any drag params from the launcher intent since the drag operation is complete.
        Intent newIntent = new Intent(mLauncher.getIntent());
        newIntent.removeExtra(EXTRA_PIN_ITEM_DRAG_LISTENER);
        mLauncher.setIntent(newIntent);
    }

    new Handler(Looper.getMainLooper()).post(new Runnable() {
        @Override
        public void run() {
            removeListener();
        }
    });
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:16,代码来源:PinItemDragListener.java

示例4: startActivity

import android.content.Intent; //导入方法依赖的package包/类
@Override
public void startActivity(Intent intent) {
  if (intent.getStringExtra(Browser.EXTRA_APPLICATION_ID) != null) {
    intent.removeExtra(Browser.EXTRA_APPLICATION_ID);
  }

  try {
    super.startActivity(intent);
  } catch (ActivityNotFoundException e) {
    Log.w(TAG, e);
    Toast.makeText(this, R.string.ConversationActivity_there_is_no_app_available_to_handle_this_link_on_your_device, Toast.LENGTH_LONG).show();
  }
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:14,代码来源:ConversationActivity.java

示例5: onNewIntent

import android.content.Intent; //导入方法依赖的package包/类
@Override
protected void onNewIntent(Intent intent) {
    super.onNewIntent(intent);
    if (intent != null && intent.getExtras() != null)
    {
        if (DEBUG) Timber.d("From login");
        fromLoginActivity = intent.getExtras().getBoolean(FROM_LOGIN, false);
        // So we wont encounter this flag again.
        intent.removeExtra(FROM_LOGIN);
    }
}
 
开发者ID:MobileDev418,项目名称:AndroidBackendlessChat,代码行数:12,代码来源:ChatSDKBaseActivity.java

示例6: rebindRefMap

import android.content.Intent; //导入方法依赖的package包/类
/**
 * 如果 oldIntent 绑定了 RefMap,那么将其解绑并重新绑定到 newIntent
 */
public void rebindRefMap(Intent oldIntent, Intent newIntent) {
  if (hasRefMap(oldIntent)) {
    Map<String, Object> refMap = getRefMap(oldIntent);

    sGlobalRefMap.remove(getKeyOfMap(oldIntent));
    oldIntent.removeExtra(KEY_OF_MAP);

    int keyOfMap = newIntent.hashCode();
    newIntent.putExtra(KEY_OF_MAP, keyOfMap);
    sGlobalRefMap.put(keyOfMap, refMap);
  }
}
 
开发者ID:douo,项目名称:ActivityBuilder,代码行数:16,代码来源:RefManager.java

示例7: switchFragment

import android.content.Intent; //导入方法依赖的package包/类
void switchFragment(@IdRes int itemId) {
    Intent intent = getIntent();
    // passing intent's extra to the fragment
    Bundle extras = intent.getExtras();
    Bundle arguments = (extras != null ? new Bundle(extras) : new Bundle());
    switch (itemId) {
        case R.id.nav_journal:
            arguments.putString(TITLE, getString(R.string.Journal));
            switchFragment(journalFragment, arguments);
            break;
        case R.id.nav_black_list:
            arguments.putString(TITLE, getString(R.string.Black_list));
            arguments.putInt(CONTACT_TYPE, Contact.TYPE_BLACK_LIST);
            switchFragment(blackListFragment, arguments);
            break;
        case R.id.nav_white_list:
            arguments.putString(TITLE, getString(R.string.White_list));
            arguments.putInt(CONTACT_TYPE, Contact.TYPE_WHITE_LIST);
            switchFragment(whiteListFragment, arguments);
            break;
        case R.id.nav_sms:
            arguments.putString(TITLE, getString(R.string.Messaging));
            switchFragment(smsFragment, arguments);
            break;
        case R.id.nav_settings:
            arguments.putString(TITLE, getString(R.string.Settings));
            switchFragment(settingsFragment, arguments);
            break;
        default:
            arguments.putString(TITLE, getString(R.string.Information));
            switchFragment(informationFragment, arguments);
            break;
    }

    // remove used extras
    intent.removeExtra(LIST_POSITION);
}
 
开发者ID:kaliturin,项目名称:BlackList,代码行数:38,代码来源:MainActivity.java

示例8: handleUninstallShortcutIntent

import android.content.Intent; //导入方法依赖的package包/类
private void handleUninstallShortcutIntent(Intent intent) {
    Intent shortcut = intent.getParcelableExtra(Intent.EXTRA_SHORTCUT_INTENT);
    if (shortcut != null) {
        ComponentName componentName = shortcut.resolveActivity(getPM());
        if (componentName != null) {
            Intent newShortcutIntent = new Intent();
            newShortcutIntent.putExtra("_VA_|_uri_", shortcut);
            newShortcutIntent.setClassName(getHostPkg(), Constants.SHORTCUT_PROXY_ACTIVITY_NAME);
            newShortcutIntent.removeExtra(Intent.EXTRA_SHORTCUT_INTENT);
            intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, newShortcutIntent);
        }
    }
}
 
开发者ID:codehz,项目名称:container,代码行数:14,代码来源:BroadcastIntent.java

示例9: maybeRecordFallbackStats

import android.content.Intent; //导入方法依赖的package包/类
/**
 * In the case where Chrome is called through the fallback mechanism from Instant Apps,
 * record the amount of time the whole trip took and which UI took the user back to Chrome,
 * if any.
 * @param intent The current intent.
 */
private void maybeRecordFallbackStats(Intent intent) {
    Long startTime = IntentUtils.safeGetLongExtra(intent, INSTANT_APP_START_TIME_EXTRA, 0);
    if (startTime > 0) {
        sFallbackIntentTimes.record(SystemClock.elapsedRealtime() - startTime);
        intent.removeExtra(INSTANT_APP_START_TIME_EXTRA);
    }
    int callSource = IntentUtils.safeGetIntExtra(intent, BROWSER_LAUNCH_REASON, 0);
    if (callSource > 0 && callSource < SOURCE_BOUNDARY) {
        sFallbackCallSource.record(callSource);
        intent.removeExtra(BROWSER_LAUNCH_REASON);
    } else if (callSource >= SOURCE_BOUNDARY) {
        Log.e(TAG, "Unexpected call source constant for Instant Apps: " + callSource);
    }
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:21,代码来源:InstantAppsHandler.java

示例10: safeRemoveExtra

import android.content.Intent; //导入方法依赖的package包/类
/**
 * Just like {@link Intent#removeExtra(String)} but doesn't throw exceptions.
 */
public static void safeRemoveExtra(Intent intent, String name) {
    try {
        intent.removeExtra(name);
    } catch (Throwable t) {
        // Catches un-parceling exceptions.
        Log.e(TAG, "removeExtra failed on intent " + intent);
    }
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:12,代码来源:IntentUtils.java

示例11: initializeMainLayout

import android.content.Intent; //导入方法依赖的package包/类
@Override
public void initializeMainLayout(Intent argument) {
    if (argument != null && argument.hasExtra(MainActivity.POSITION_ARGUMENT_KEY)) {
        mInitialPosition = argument.getIntExtra(MainActivity.POSITION_ARGUMENT_KEY, NavigationUtils.POSITION_DASHBOARD);

        if (mInitialPosition == NavigationUtils.POSITION_DASHBOARD) {
            mFragment = new DashFragment();
        } else if (mInitialPosition == NavigationUtils.POSITION_GRID) {
            mFragment = new GridPagerFragment();
        } else if (mInitialPosition == NavigationUtils.POSITION_LEAGUE) {
            mFragment = new LeagueFragment();
        } else if (mInitialPosition == NavigationUtils.POSITION_SETTING) {
            Intent intent = new Intent(mMainView.getActivity(), SettingsActivity.class);
            mMainView.getActivity().startActivity(intent);
        }
        argument.removeExtra(MainActivity.POSITION_ARGUMENT_KEY);
    }

    if (mFragment == null) {
        mInitialPosition = NavigationUtils.POSITION_DASHBOARD;

        mFragment = new DashFragment();
    }

    ((AppCompatActivity) mMainView.getActivity()).getSupportFragmentManager().beginTransaction()
            .add(mMainView.getMainLayoutId(), mFragment)
            .commitAllowingStateLoss();
}
 
开发者ID:riteshakya037,项目名称:Android-Scrapper,代码行数:29,代码来源:MainPresenterImpl.java

示例12: showDialogIf

import android.content.Intent; //导入方法依赖的package包/类
private void showDialogIf(Intent intent) {
	if (intent.hasExtra("id")) {
		id = intent.getExtras().getString("id");
		intent.removeExtra("id");
		Bundle args = new Bundle();
		args.putString("id", id);
		JoinGameDialogFragment fragment = new JoinGameDialogFragment();
		fragment.setArguments(args);
		fragment.show(getSupportFragmentManager(), "dialog");
	}
}
 
开发者ID:eduyayo,项目名称:gamesboard,代码行数:12,代码来源:GameListActivity.java

示例13: showDialogIf

import android.content.Intent; //导入方法依赖的package包/类
private void showDialogIf(Intent intent) {
	if (intent.hasExtra("id")) {
		id = intent.getExtras().getString("id");
		intent.removeExtra("id");
           showDialog();
	}
}
 
开发者ID:eduyayo,项目名称:gamesboard,代码行数:8,代码来源:ContactListActivity.java

示例14: readIntent

import android.content.Intent; //导入方法依赖的package包/类
private void readIntent() {
    Intent intent = getIntent();
    long dateNoteCreated = intent.getLongExtra(INTENT_EXTRA_DATE_NOTE_CREATED, NOTE_INVALID_ID);
    if (dateNoteCreated != NOTE_INVALID_ID) {
        intent.removeExtra(INTENT_EXTRA_DATE_NOTE_CREATED);
        getPresenter().openNote(dateNoteCreated);
    }
}
 
开发者ID:Laaidback,项目名称:A.scribe,代码行数:9,代码来源:MainActivity.java

示例15: cleanIntentPluginParams

import android.content.Intent; //导入方法依赖的package包/类
static final void cleanIntentPluginParams(Intent intent) {
    // 防止 intent 攻击
    try {
        intent.removeExtra(IPluginManager.KEY_COMPATIBLE);
        intent.removeExtra(IPluginManager.KEY_PLUGIN);
        intent.removeExtra(IPluginManager.KEY_ACTIVITY);
    } catch (Exception e) {
        // ignore
    }
}
 
开发者ID:wangyupeng1-iri,项目名称:springreplugin,代码行数:11,代码来源:PluginMgr.java


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