下面列出了android.os.Bundle#putStringArray ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
public void setSelectedPopOverInMultiWindow(String[] parm) {
if (isFirstParamExistAndIsJson(parm)){
WindowJsonWrapper.setSelectedPopOverInMultiWindow(this,
DataHelper.gson.fromJson(parm[0], WindowSetMultiPopoverSelectedVO.class));
}
if (parm == null || parm.length < 2) {
errorCallback(0, EUExCallback.F_E_UEXWINDOW_EVAL, "Illegal parameter");
return;
}
Message msg = new Message();
msg.obj = this;
msg.what = MSG_FUNCTION_SETSELECTEDPOPOVERINMULTIWINDOW;
Bundle bd = new Bundle();
bd.putStringArray(TAG_BUNDLE_PARAM, parm);
msg.setData(bd);
mHandler.sendMessage(msg);
}
@Override
public void onSearchTextChanged(String oldQuery, String newQuery) {
Log.d(TAG, "oldQuery = " + oldQuery + " | newQuery = " + newQuery);
String contactIDsArguments = mSQLiteHelper
.convertArrayToInOperatorArguments(mContactHelper
.getContactIDsByName(mContactHelper
.getContactCursorByName(newQuery)));
String selection = RecordDbContract.RecordItem.COLUMN_NUMBER
+ " LIKE ?"
+ " OR "
+ RecordDbContract.RecordItem.COLUMN_CONTACT_ID
+ " IN "
+ contactIDsArguments;
//+ "= 682";
String[] selectionArgs = new String[]{"%" + newQuery + "%"};
Bundle args = (Bundle) mArguments.clone();
args.putString(RecordsActivity.args.selection.name(), selection);
args.putStringArray(RecordsActivity.args.selectionArguments.name(), selectionArgs);
refreshCursorLoader(args);
}
public static CollectionFragment newInstance(String[] collectionList) {
CollectionFragment fragment = new CollectionFragment();
Bundle args = new Bundle();
args.putStringArray(ARG_PARAM1, collectionList);
fragment.setArguments(args);
return fragment;
}
public void insertPopoverAbovePopover(String[] parm) {
if (!mBrwView.checkType(EBrwViewEntry.VIEW_TYPE_MAIN)
|| parm.length < 2) {
return;
}
Message msg = new Message();
msg.obj = this;
msg.what = MSG_FUNCTION_INSERTPOPOVERABOVEPOPOVER;
Bundle bd = new Bundle();
bd.putStringArray(TAG_BUNDLE_PARAM, parm);
msg.setData(bd);
mHandler.sendMessage(msg);
}
private static void show(FragmentManager fm, int requestCode, String title, String[] items){
FavoriteCharacterDialogFragment dialog = new FavoriteCharacterDialogFragment();
Bundle args = new Bundle();
args.putString(ARG_TITLE, title);
args.putStringArray(ARG_ITEMS, items);
args.putInt(ARG_REQUEST_CODE, requestCode);
dialog.setArguments(args);
dialog.show(fm, TAG);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mContext = this;
// Get File Storage Permission
Intent in = new Intent(this, Permissions.class);
Bundle bundle = new Bundle();
bundle.putStringArray(Constants.APP_PREMISSION_KEY, Constants.APP_PREMISSIONS);
in.putExtras(bundle);
startActivityForResult(in, APP_PERMISSION_REQUEST);
// Initialize Stuff
mSelectionMode = getIntent().getIntExtra(Constants.SELECTION_MODE, Constants.SELECTION_MODES.SINGLE_SELECTION.ordinal());
mNavigationHelper = new NavigationHelper(mContext);
mNavigationHelper.setmChangeDirectoryListener(this);
io = new FileIO(mNavigationHelper, new Handler(Looper.getMainLooper()), mContext);
op = Operations.getInstance(mContext);
//set file filter (i.e display files with the given extension)
String filterFilesWithExtension = getIntent().getStringExtra(Constants.ALLOWED_FILE_EXTENSIONS);
if (filterFilesWithExtension != null && !filterFilesWithExtension.isEmpty()) {
Set<String> allowedFileExtensions = new HashSet<String>(Arrays.asList(filterFilesWithExtension.split(";")));
mNavigationHelper.setAllowedFileExtensionFilter(allowedFileExtensions);
}
mFileList = mNavigationHelper.getFilesItemsInCurrentDirectory();
}
/**
* Constructs a new instance of the important sites dialog fragment.
* @param importantDomains The list of important domains to display.
* @param importantDomainReasons The reasons for choosing each important domain.
* @param faviconURLs The list of favicon urls that correspond to each importantDomains.
* @return An instance of ConfirmImportantSitesDialogFragment with the bundle arguments set.
*/
public static ConfirmImportantSitesDialogFragment newInstance(
String[] importantDomains, int[] importantDomainReasons, String[] faviconURLs) {
ConfirmImportantSitesDialogFragment dialogFragment =
new ConfirmImportantSitesDialogFragment();
Bundle bundle = new Bundle();
bundle.putStringArray(IMPORTANT_DOMAINS_TAG, importantDomains);
bundle.putIntArray(IMPORTANT_DOMAIN_REASONS_TAG, importantDomainReasons);
bundle.putStringArray(FAVICON_URLS_TAG, faviconURLs);
dialogFragment.setArguments(bundle);
return dialogFragment;
}
/**
* Insert network traffic event to watchlist async queue processor.
*/
public void asyncNetworkEvent(String host, String[] ipAddresses, int uid) {
final Message msg = obtainMessage(LOG_WATCHLIST_EVENT_MSG);
final Bundle bundle = new Bundle();
bundle.putString(WatchlistEventKeys.HOST, host);
bundle.putStringArray(WatchlistEventKeys.IP_ADDRESSES, ipAddresses);
bundle.putInt(WatchlistEventKeys.UID, uid);
bundle.putLong(WatchlistEventKeys.TIMESTAMP, System.currentTimeMillis());
msg.setData(bundle);
sendMessage(msg);
}
public static ShareLinkToDialog newInstance(Intent intent, String[] packagesToExclude) {
ShareLinkToDialog f = new ShareLinkToDialog();
Bundle args = new Bundle();
args.putParcelable(ARG_INTENT, intent);
args.putStringArray(ARG_PACKAGES_TO_EXCLUDE, packagesToExclude);
f.setArguments(args);
return f;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mContext = this;
// Get File Storage Permission
Intent in = new Intent(this, Permissions.class);
Bundle bundle = new Bundle();
bundle.putStringArray(Constants.APP_PREMISSION_KEY, Constants.APP_PREMISSIONS);
in.putExtras(bundle);
startActivityForResult(in, APP_PERMISSION_REQUEST);
// Initialize Stuff
mNavigationHelper = new NavigationHelper(mContext);
mNavigationHelper.setmChangeDirectoryListener(this);
io = new FileIO(mNavigationHelper, new Handler(Looper.getMainLooper()), mContext);
op = Operations.getInstance(mContext);
//set file filter (i.e display files with the given extension)
String filterFilesWithExtension = getIntent().getStringExtra(Constants.ALLOWED_FILE_EXTENSIONS);
if(filterFilesWithExtension != null && !filterFilesWithExtension.isEmpty()) {
Set<String> allowedFileExtensions = new HashSet<String>(Arrays.asList(filterFilesWithExtension.split(";")));
mNavigationHelper.setAllowedFileExtensionFilter(allowedFileExtensions);
}
mFileList = mNavigationHelper.getFilesItemsInCurrentDirectory();
}
public static CompileDialogFragment newInstance(ApplicationInfo appInfo,
String msg, String[] commands) {
Bundle arguments = new Bundle();
arguments.putParcelable(KEY_APP_INFO, appInfo);
arguments.putString(KEY_MSG, msg);
arguments.putStringArray(KEY_COMMANDS, commands);
CompileDialogFragment fragment = new CompileDialogFragment();
fragment.setArguments(arguments);
fragment.setCancelable(false);
return fragment;
}
@AppCanAPI
public void hidePluginViewContainer(String[] parm) {
Message msg = mHandler.obtainMessage();
msg.what = MSG_PLUGINVIEW_CONTAINER_HIDE;
msg.obj = this;
Bundle bd = new Bundle();
bd.putStringArray(TAG_BUNDLE_PARAM, parm);
msg.setData(bd);
mHandler.sendMessage(msg);
}
private static InAppBillingFragment newInstance(String key, String[] productId) {
InAppBillingFragment fragment = new InAppBillingFragment();
Bundle bundle = new Bundle();
bundle.putString(Extras.EXTRA_KEY, key);
bundle.putStringArray(Extras.EXTRA_PRODUCT_ID, productId);
fragment.setArguments(bundle);
return fragment;
}
public Bundle prepareArguments() {
Bundle bundle = new Bundle();
bundle.putString(ARG_CANCEL_BUTTON_TITLE, mCancelButtonTitle);
bundle.putStringArray(ARG_OTHER_BUTTON_TITLES, mOtherButtonTitles);
bundle.putBoolean(ARG_CANCELABLE_ONTOUCHOUTSIDE,
mCancelableOnTouchOutside);
return bundle;
}
public void insertBelow(String[] parm) {
if (!mBrwView.checkType(EBrwViewEntry.VIEW_TYPE_POP) || parm.length < 1) {
return;
}
Message msg = new Message();
msg.obj = this;
msg.what = MSG_FUNCTION_INSERTBELOW;
Bundle bd = new Bundle();
bd.putStringArray(TAG_BUNDLE_PARAM, parm);
msg.setData(bd);
mHandler.sendMessage(msg);
}
public static TuSDKEditorBarFragment newInstance(String[] mFilterGroup, String[] mCartoonFilterGroup,boolean hasMonsterFace) {
TuSDKEditorBarFragment fragment = new TuSDKEditorBarFragment();
Bundle bundle = new Bundle();
bundle.putStringArray("FilterGroup", mFilterGroup);
bundle.putStringArray("CartoonFilterGroup", mCartoonFilterGroup);
bundle.putBoolean("hasMonsterFace",hasMonsterFace);
fragment.setArguments(bundle);
return fragment;
}
@Override
public void onSearchTextChanged(String oldQuery, String newQuery) {
Log.d(TAG, "oldQuery = " + oldQuery + " | newQuery = " + newQuery);
Bundle args = (Bundle) mArguments.clone();
if (!(newQuery.isEmpty() && oldQuery.length() > newQuery.length() && newQuery.length() == 0)) {
String contactIDsArguments = mSQLiteHelper
.convertArrayToInOperatorArguments(mContactHelper
.getContactIDsByName(mContactHelper
.getContactCursorByName(newQuery)));
String selection = RecordDbContract.RecordItem.COLUMN_NUMBER
+ " LIKE ?"
+ " OR "
+ RecordDbContract.RecordItem.COLUMN_CONTACT_ID
+ " IN "
+ contactIDsArguments;
//+ "= 682";
String[] selectionArgs = new String[]{"%" + newQuery + "%"};
String mainSelection = args.getString(Config.args.selection.name());
if (mainSelection != null && mainSelection.length() > 0) {
selection += " AND " + mainSelection;
}
String[] mainSelectionArgs = args.getStringArray(Config.args.selectionArguments.name());
if (mainSelectionArgs != null && mainSelectionArgs.length > 0) {
selectionArgs = ArrayUtils.addAll(selectionArgs, mainSelectionArgs);
}
args.putString(RecordsActivity.args.selection.name(), selection);
args.putStringArray(RecordsActivity.args.selectionArguments.name(), selectionArgs);
}
mEventBus.post(new OnQueryChangedEvent(args));
}
@Override
public Bundle toBundle() {
Bundle bundle = new Bundle();
if (mTags != null) {
bundle.putStringArray("tags", mTags.toArray(new String[0]));
}
if (mSummary != null) {
bundle.putString("summary", mSummary);
}
if (mDescription != null) {
bundle.putString("description", mDescription);
}
if (mExternalDocs != null) {
bundle.putParcelable("externalDocs", mExternalDocs.toBundle());
}
if (mOperationId != null) {
bundle.putString("operationId", mOperationId);
}
if (mConsumes != null) {
bundle.putStringArray("consumes", mConsumes.toArray(new String[0]));
}
if (mProduces != null) {
bundle.putStringArray("produces", mProduces.toArray(new String[0]));
}
if (mParameters != null && !mParameters.isEmpty()) {
List<Bundle> bundles = new ArrayList<>();
for (Parameter parameter : mParameters) {
bundles.add(parameter.toBundle());
}
bundle.putParcelableArray("parameters", bundles.toArray(new Bundle[0]));
}
if (mResponses != null) {
bundle.putParcelable("responses", mResponses.toBundle());
}
if (mSchemes != null) {
bundle.putStringArray("schemes", mSchemes.toArray(new String[0]));
}
if (mDeprecated != null) {
bundle.putBoolean("deprecated", mDeprecated);
}
if (mSecurityRequirement != null && !mSecurityRequirement.isEmpty()) {
Bundle security = new Bundle();
for (Map.Entry<String, String> entry : mSecurityRequirement.entrySet()) {
security.putString(entry.getKey(), entry.getValue());
}
bundle.putParcelable("security", security);
}
if (mXEvent != null) {
bundle.putParcelable("x-event", mXEvent.toBundle());
}
if (mXType != null) {
bundle.putString("x-type", mXType.getName());
}
copyVendorExtensions(bundle);
return bundle;
}
private static Bundle addRestrictionToBundle(Bundle bundle, RestrictionEntry entry) {
switch (entry.getType()) {
case RestrictionEntry.TYPE_BOOLEAN:
bundle.putBoolean(entry.getKey(), entry.getSelectedState());
break;
case RestrictionEntry.TYPE_CHOICE:
case RestrictionEntry.TYPE_CHOICE_LEVEL:
case RestrictionEntry.TYPE_MULTI_SELECT:
bundle.putStringArray(entry.getKey(), entry.getAllSelectedStrings());
break;
case RestrictionEntry.TYPE_INTEGER:
bundle.putInt(entry.getKey(), entry.getIntValue());
break;
case RestrictionEntry.TYPE_STRING:
case RestrictionEntry.TYPE_NULL:
bundle.putString(entry.getKey(), entry.getSelectedString());
break;
case RestrictionEntry.TYPE_BUNDLE:
RestrictionEntry[] restrictions = entry.getRestrictions();
Bundle childBundle = convertRestrictionsToBundle(Arrays.asList(restrictions));
bundle.putBundle(entry.getKey(), childBundle);
break;
case RestrictionEntry.TYPE_BUNDLE_ARRAY:
RestrictionEntry[] bundleRestrictionArray = entry.getRestrictions();
Bundle[] bundleArray = new Bundle[bundleRestrictionArray.length];
for (int i = 0; i < bundleRestrictionArray.length; i++) {
RestrictionEntry[] bundleRestrictions =
bundleRestrictionArray[i].getRestrictions();
if (bundleRestrictions == null) {
// Non-bundle entry found in bundle array.
Log.w(TAG, "addRestrictionToBundle: " +
"Non-bundle entry found in bundle array");
bundleArray[i] = new Bundle();
} else {
bundleArray[i] = convertRestrictionsToBundle(Arrays.asList(
bundleRestrictions));
}
}
bundle.putParcelableArray(entry.getKey(), bundleArray);
break;
default:
throw new IllegalArgumentException(
"Unsupported restrictionEntry type: " + entry.getType());
}
return bundle;
}
@Override
public Cursor query(Uri uri, String[] projection, Bundle queryArgs,
CancellationSignal cancellationSignal) {
int match = sUriMatcher.match(uri);
// We only support a query for multiple images, return null for other form of queries
// including a query for a single image.
switch (match) {
case IMAGES:
break;
default:
return null;
}
MatrixCursor result = new MatrixCursor(resolveDocumentProjection(projection));
File[] files = mBaseDir.listFiles();
int offset = queryArgs.getInt(ContentResolver.QUERY_ARG_OFFSET, 0);
int limit = queryArgs.getInt(ContentResolver.QUERY_ARG_LIMIT, Integer.MAX_VALUE);
Log.d(TAG, "queryChildDocuments with Bundle, Uri: " +
uri + ", offset: " + offset + ", limit: " + limit);
if (offset < 0) {
throw new IllegalArgumentException("Offset must not be less than 0");
}
if (limit < 0) {
throw new IllegalArgumentException("Limit must not be less than 0");
}
if (offset >= files.length) {
return result;
}
for (int i = offset, maxIndex = Math.min(offset + limit, files.length); i < maxIndex; i++) {
includeFile(result, files[i]);
}
Bundle bundle = new Bundle();
bundle.putInt(ContentResolver.EXTRA_SIZE, files.length);
String[] honoredArgs = new String[2];
int size = 0;
if (queryArgs.containsKey(ContentResolver.QUERY_ARG_OFFSET)) {
honoredArgs[size++] = ContentResolver.QUERY_ARG_OFFSET;
}
if (queryArgs.containsKey(ContentResolver.QUERY_ARG_LIMIT)) {
honoredArgs[size++] = ContentResolver.QUERY_ARG_LIMIT;
}
if (size != honoredArgs.length) {
honoredArgs = Arrays.copyOf(honoredArgs, size);
}
bundle.putStringArray(ContentResolver.EXTRA_HONORED_ARGS, honoredArgs);
result.setExtras(bundle);
return result;
}