Java Code Examples for android.os.Bundle.getStringArray()

The following are Jave code examples for showing how to use getStringArray() of the android.os.Bundle class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: MyNotes   File: ColorPickerDialog.java   View Source Code Vote up 6 votes
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (getArguments() != null) {
        mTitleResId = getArguments().getInt(KEY_TITLE_ID);
        mColumns = getArguments().getInt(KEY_COLUMNS);
        mSize = getArguments().getInt(KEY_SIZE);
    }

    if (savedInstanceState != null) {
        mColors = savedInstanceState.getIntArray(KEY_COLORS);
        mSelectedColor = (Integer) savedInstanceState.getSerializable(KEY_SELECTED_COLOR);
        mColorContentDescriptions = savedInstanceState.getStringArray(
                KEY_COLOR_CONTENT_DESCRIPTIONS);
    }
}
 
Example 2
Project: Huochexing12306   File: MultiChoiceFragment.java   View Source Code Vote up 6 votes
private static void show(FragmentManager fm, int requestCode, String title, CharSequence csPositive, CharSequence csNagative, String[] items, boolean hasDefaultSelect, boolean[] selectedIndexes){
	MultiChoiceFragment dialog = new MultiChoiceFragment();
	Bundle args = new Bundle();
	args.putString(ARG_TITLE, title);
	args.putStringArray(ARG_ITEMS, items);
	if (!hasDefaultSelect){
		boolean[] bs = new boolean[args.getStringArray(ARG_ITEMS).length];
		for(int i=0; i<bs.length; i++){
			bs[i] = false;
		}
		args.putBooleanArray(ARG_SELECTED_INDEXES, bs);
	}else{
		args.putBooleanArray(ARG_SELECTED_INDEXES, selectedIndexes);
	}
	args.putInt(ARG_REQUEST_CODE, requestCode);
	args.putCharSequence(ARG_POSITIVE_TEXT, csPositive);
	args.putCharSequence(ARG_NAGATIVE_TEXT, csNagative);
	dialog.setArguments(args);
	dialog.setCancelable(false);
	dialog.show(fm, TAG);
}
 
Example 3
Project: OSchina_resources_android   File: TweetPublishQueueActivity.java   View Source Code Vote up 6 votes
@Override
protected boolean initBundle(Bundle bundle) {
    if (bundle != null) {
        final String[] ids = bundle.getStringArray(TweetPublishService.EXTRA_IDS);
        if (ids != null && ids.length > 0) {
            AppOperator.runOnThread(new Runnable() {
                @Override
                public void run() {
                    Context context = getApplicationContext();
                    List<TweetPublishModel> models = new ArrayList<>();
                    for (String str : ids) {
                        TweetPublishModel model = TweetPublishCache.get(context, str);
                        if (model != null)
                            models.add(model);
                    }
                    if (models.size() > 0)
                        addData(models);
                    else
                        finish();
                }
            });
            return true;
        }
    }
    return false;
}
 
Example 4
Project: PhotoPicker-master   File: ImagePagerFragment.java   View Source Code Vote up 6 votes
@Override public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);

  paths = new ArrayList<>();

  Bundle bundle = getArguments();

  if (bundle != null) {
    String[] pathArr = bundle.getStringArray(ARG_PATH);
    paths.clear();
    if (pathArr != null) {

      paths = new ArrayList<>(Arrays.asList(pathArr));
    }

    hasAnim         = bundle.getBoolean(ARG_HAS_ANIM);
    currentItem     = bundle.getInt(ARG_CURRENT_ITEM);
    thumbnailTop    = bundle.getInt(ARG_THUMBNAIL_TOP);
    thumbnailLeft   = bundle.getInt(ARG_THUMBNAIL_LEFT);
    thumbnailWidth  = bundle.getInt(ARG_THUMBNAIL_WIDTH);
    thumbnailHeight = bundle.getInt(ARG_THUMBNAIL_HEIGHT);
  }

  mPagerAdapter = new PhotoPagerAdapter(Glide.with(this), paths);
}
 
Example 5
Project: boohee_v5.6   File: ChartletFragment.java   View Source Code Vote up 5 votes
public void onAttach(Activity activity) {
    super.onAttach(activity);
    Bundle args = getArguments();
    if (args != null) {
        this.CHARTLET_RES_IDS = args.getIntArray(KEY_DRAWABLE_IDS);
        this.mThumbailIds = args.getIntArray(KEY_THUMBNAIL_DRAWABLE_IDS);
        this.CHARTLET_TEXTS = args.getStringArray(KEY_STRINGS);
        this.mUri = Uri.parse(args.getString(KEY_URI_STR));
    }
}
 
Example 6
Project: boohee_v5.6   File: NotificationCompatApi21.java   View Source Code Vote up 5 votes
static UnreadConversation getUnreadConversationFromBundle(Bundle b, Factory factory, RemoteInput.Factory remoteInputFactory) {
    RemoteInput remoteInput = null;
    if (b == null) {
        return null;
    }
    Parcelable[] parcelableMessages = b.getParcelableArray(KEY_MESSAGES);
    String[] messages = null;
    if (parcelableMessages != null) {
        String[] tmp = new String[parcelableMessages.length];
        boolean success = true;
        for (int i = 0; i < tmp.length; i++) {
            if (!(parcelableMessages[i] instanceof Bundle)) {
                success = false;
                break;
            }
            tmp[i] = ((Bundle) parcelableMessages[i]).getString("text");
            if (tmp[i] == null) {
                success = false;
                break;
            }
        }
        if (!success) {
            return null;
        }
        messages = tmp;
    }
    PendingIntent onRead = (PendingIntent) b.getParcelable(KEY_ON_READ);
    PendingIntent onReply = (PendingIntent) b.getParcelable(KEY_ON_REPLY);
    android.app.RemoteInput remoteInput2 = (android.app.RemoteInput) b.getParcelable(KEY_REMOTE_INPUT);
    String[] participants = b.getStringArray(KEY_PARTICIPANTS);
    if (participants == null || participants.length != 1) {
        return null;
    }
    if (remoteInput2 != null) {
        remoteInput = toCompatRemoteInput(remoteInput2, remoteInputFactory);
    }
    return factory.build(messages, remoteInput, onReply, onRead, participants, b.getLong(KEY_TIMESTAMP));
}
 
Example 7
Project: Android-FileBrowser-FilePicker   File: Permissions.java   View Source Code Vote up 5 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Bundle b=this.getIntent().getExtras();
    String[] permissions = b.getStringArray(Constants.APP_PREMISSION_KEY);
    requestPermissions(permissions);
}
 
Example 8
Project: chromium-for-android-56-debug-video   File: ConfirmImportantSitesDialogFragment.java   View Source Code Vote up 5 votes
@Override
public void setArguments(Bundle args) {
    super.setArguments(args);
    mImportantDomains = args.getStringArray(IMPORTANT_DOMAINS_TAG);
    mFaviconURLs = args.getStringArray(FAVICON_URLS_TAG);
    int[] importantDomainReasons = args.getIntArray(IMPORTANT_DOMAIN_REASONS_TAG);
    for (int i = 0; i < mImportantDomains.length; ++i) {
        mImportantDomainsReasons.put(mImportantDomains[i], importantDomainReasons[i]);
        mCheckedState.put(mImportantDomains[i], true);
    }
}
 
Example 9
Project: AOSP-Kayboard-7.1.2   File: PermissionsActivity.java   View Source Code Vote up 5 votes
@Override
protected void onResume() {
    super.onResume();
    // Only do request when there is no pending request to avoid duplicated requests.
    if (mPendingRequestCode == INVALID_REQUEST_CODE) {
        final Bundle extras = getIntent().getExtras();
        final String[] permissionsToRequest =
                extras.getStringArray(EXTRA_PERMISSION_REQUESTED_PERMISSIONS);
        mPendingRequestCode = extras.getInt(EXTRA_PERMISSION_REQUEST_CODE);
        // Assuming that all supplied permissions are not granted yet, so that we don't need to
        // check them again.
        PermissionsUtil.requestPermissions(this, mPendingRequestCode, permissionsToRequest);
    }
}
 
Example 10
Project: letv   File: FragmentActivity.java   View Source Code Vote up 5 votes
protected void onCreate(@Nullable Bundle savedInstanceState) {
    List list = null;
    this.mFragments.attachHost(null);
    super.onCreate(savedInstanceState);
    NonConfigurationInstances nc = (NonConfigurationInstances) getLastNonConfigurationInstance();
    if (nc != null) {
        this.mFragments.restoreLoaderNonConfig(nc.loaders);
    }
    if (savedInstanceState != null) {
        Parcelable p = savedInstanceState.getParcelable(FRAGMENTS_TAG);
        FragmentController fragmentController = this.mFragments;
        if (nc != null) {
            list = nc.fragments;
        }
        fragmentController.restoreAllState(p, list);
        if (savedInstanceState.containsKey(NEXT_CANDIDATE_REQUEST_INDEX_TAG)) {
            this.mNextCandidateRequestIndex = savedInstanceState.getInt(NEXT_CANDIDATE_REQUEST_INDEX_TAG);
            int[] requestCodes = savedInstanceState.getIntArray(ALLOCATED_REQUEST_INDICIES_TAG);
            String[] fragmentWhos = savedInstanceState.getStringArray(REQUEST_FRAGMENT_WHO_TAG);
            if (requestCodes == null || fragmentWhos == null || requestCodes.length != fragmentWhos.length) {
                Log.w(TAG, "Invalid requestCode mapping in savedInstanceState.");
            } else {
                this.mPendingFragmentActivityResults = new SparseArrayCompat(requestCodes.length);
                for (int i = 0; i < requestCodes.length; i++) {
                    this.mPendingFragmentActivityResults.put(requestCodes[i], fragmentWhos[i]);
                }
            }
        }
    }
    if (this.mPendingFragmentActivityResults == null) {
        this.mPendingFragmentActivityResults = new SparseArrayCompat();
        this.mNextCandidateRequestIndex = 0;
    }
    this.mFragments.dispatchCreate();
}
 
Example 11
Project: AdaptationX-android   File: RationaleDialogConfig.java   View Source Code Vote up 5 votes
RationaleDialogConfig(Bundle bundle) {
    positiveButton = bundle.getInt(KEY_POSITIVE_BUTTON);
    negativeButton = bundle.getInt(KEY_NEGATIVE_BUTTON);
    rationaleMsg = bundle.getString(KEY_RATIONALE_MESSAGE);
    requestCode = bundle.getInt(KEY_REQUEST_CODE);
    permissions = bundle.getStringArray(KEY_PERMISSIONS);
}
 
Example 12
Project: CXJPadProject   File: RationaleDialogConfig.java   View Source Code Vote up 5 votes
RationaleDialogConfig(Bundle bundle) {
    positiveButton = bundle.getInt(KEY_POSITIVE_BUTTON);
    negativeButton = bundle.getInt(KEY_NEGATIVE_BUTTON);
    rationaleMsg = bundle.getString(KEY_RATIONALE_MESSAGE);
    requestCode = bundle.getInt(KEY_REQUEST_CODE);
    permissions = bundle.getStringArray(KEY_PERMISSIONS);
}
 
Example 13
Project: boohee_v5.6   File: FragmentActivity.java   View Source Code Vote up 5 votes
protected void onCreate(@Nullable Bundle savedInstanceState) {
    List list = null;
    this.mFragments.attachHost(null);
    super.onCreate(savedInstanceState);
    NonConfigurationInstances nc = (NonConfigurationInstances) getLastNonConfigurationInstance();
    if (nc != null) {
        this.mFragments.restoreLoaderNonConfig(nc.loaders);
    }
    if (savedInstanceState != null) {
        Parcelable p = savedInstanceState.getParcelable(FRAGMENTS_TAG);
        FragmentController fragmentController = this.mFragments;
        if (nc != null) {
            list = nc.fragments;
        }
        fragmentController.restoreAllState(p, list);
        if (savedInstanceState.containsKey(NEXT_CANDIDATE_REQUEST_INDEX_TAG)) {
            this.mNextCandidateRequestIndex = savedInstanceState.getInt(NEXT_CANDIDATE_REQUEST_INDEX_TAG);
            int[] requestCodes = savedInstanceState.getIntArray(ALLOCATED_REQUEST_INDICIES_TAG);
            String[] fragmentWhos = savedInstanceState.getStringArray(REQUEST_FRAGMENT_WHO_TAG);
            if (requestCodes == null || fragmentWhos == null || requestCodes.length != fragmentWhos.length) {
                Log.w(TAG, "Invalid requestCode mapping in savedInstanceState.");
            } else {
                this.mPendingFragmentActivityResults = new SparseArrayCompat(requestCodes.length);
                for (int i = 0; i < requestCodes.length; i++) {
                    this.mPendingFragmentActivityResults.put(requestCodes[i], fragmentWhos[i]);
                }
            }
        }
    }
    if (this.mPendingFragmentActivityResults == null) {
        this.mPendingFragmentActivityResults = new SparseArrayCompat();
        this.mNextCandidateRequestIndex = 0;
    }
    this.mFragments.dispatchCreate();
}
 
Example 14
Project: SimpleRssReader   File: FilterByCategoriesFragment.java   View Source Code Vote up 5 votes
@Override
public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    final Bundle args = getArguments();

    mCategories = args.getStringArray(KEY_CATEGORIES);
    mCheckedCategories = new SparseBooleanArray();
}
 
Example 15
Project: OSchina_resources_android   File: ImageGalleryActivity.java   View Source Code Vote up 5 votes
@Override
protected boolean initBundle(Bundle bundle) {
    mImageSources = bundle.getStringArray(KEY_IMAGE);
    mCurPosition = bundle.getInt(KEY_POSITION, 0);
    mNeedSaveLocal = bundle.getBoolean(KEY_NEED_SAVE, true);
    mNeedCookie = bundle.getBoolean(KEY_COOKIE, false);

    if (mImageSources != null) {
        // 初始化下载状态
        mImageDownloadStatus = new boolean[mImageSources.length];
        return true;
    }

    return false;
}
 
Example 16
Project: wallpaperboard   File: InAppBillingFragment.java   View Source Code Vote up 5 votes
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    if (savedInstanceState != null) {
        mProductsId = savedInstanceState.getStringArray(Extras.EXTRA_PRODUCT_ID);
    }

    mAsyncTask = new InAppProductsLoader().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
 
Example 17
Project: gvsig-mobile   File: SpatialiteExporterActivity.java   View Source Code Vote up 5 votes
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.webdatauploadlist);

    Bundle extras = getIntent().getExtras();
    user = extras.getString(PREFS_KEY_USER);
    pwd = extras.getString(PREFS_KEY_PWD);
    url = extras.getString(PREFS_KEY_URL);
    databases = extras.getStringArray(DATABASE_ID);

    refreshList();
}
 
Example 18
Project: Saiy-PS   File: ActivityPermissionDialog.java   View Source Code Vote up 4 votes
@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (DEBUG) {
        MyLog.i(CLS_NAME, "onCreate");
    }

    this.setFinishOnTouchOutside(false);

    then = System.nanoTime();

    final Bundle bundle = getIntent().getExtras();

    if (UtilsBundle.notNaked(bundle) && !UtilsBundle.isSuspicious(bundle)) {

        if (bundle.containsKey(PermissionHelper.REQUESTED_PERMISSION)) {

            final String[] permissions = bundle.getStringArray(PermissionHelper.REQUESTED_PERMISSION);

            if (permissions != null && permissions.length > 0) {

                if (bundle.containsKey(PermissionHelper.REQUESTED_PERMISSION_ID)) {

                    final int permissionsId = bundle.getInt(PermissionHelper.REQUESTED_PERMISSION_ID, 0);

                    if (permissionsId > 0) {
                        if (DEBUG) {
                            MyLog.i(CLS_NAME, "extractPermission: extract successful");
                        }

                        if (shouldShowRequestPermissionRationale(permissions)) {
                            if (DEBUG) {
                                MyLog.i(CLS_NAME, "User has previously denied");
                            }
                            createPermissionsNotification(permissionsId);
                        } else {
                            if (DEBUG) {
                                MyLog.i(CLS_NAME, "First time request");
                            }
                            ActivityCompat.requestPermissions(ActivityPermissionDialog.this, permissions, permissionsId);
                        }
                    } else {
                        if (DEBUG) {
                            MyLog.w(CLS_NAME, "extractPermission: bundle REQUESTED_PERMISSION_ID 0");
                        }
                        createPermissionsNotification(PermissionHelper.REQUEST_UNKNOWN);
                    }
                } else {
                    if (DEBUG) {
                        MyLog.w(CLS_NAME, "extractPermission: bundle missing REQUESTED_PERMISSION_ID");
                    }
                    createPermissionsNotification(PermissionHelper.REQUEST_UNKNOWN);
                }
            } else {
                if (DEBUG) {
                    MyLog.w(CLS_NAME, "extractPermission: bundle REQUESTED_PERMISSION naked");
                }
                createPermissionsNotification(PermissionHelper.REQUEST_UNKNOWN);
            }
        } else {
            if (DEBUG) {
                MyLog.w(CLS_NAME, "extractPermission: bundle missing REQUESTED_PERMISSION");
            }
            createPermissionsNotification(PermissionHelper.REQUEST_UNKNOWN);
        }
    } else {
        if (DEBUG) {
            MyLog.w(CLS_NAME, "extractPermission: bundle null or empty");
        }
        createPermissionsNotification(PermissionHelper.REQUEST_UNKNOWN);
    }
}
 
Example 19
Project: boohee_v5.6   File: Util.java   View Source Code Vote up 4 votes
public static String encodeUrl(Bundle bundle) {
    if (bundle == null) {
        return "";
    }
    StringBuilder stringBuilder = new StringBuilder();
    Object obj = 1;
    for (String str : bundle.keySet()) {
        Object obj2 = bundle.get(str);
        if ((obj2 instanceof String) || (obj2 instanceof String[])) {
            Object obj3;
            if (obj2 instanceof String[]) {
                if (obj != null) {
                    obj = null;
                } else {
                    stringBuilder.append(a.b);
                }
                stringBuilder.append(URLEncoder.encode(str) + "=");
                String[] stringArray = bundle.getStringArray(str);
                if (stringArray != null) {
                    for (int i = 0; i < stringArray.length; i++) {
                        if (i == 0) {
                            stringBuilder.append(URLEncoder.encode(stringArray[i]));
                        } else {
                            stringBuilder.append(URLEncoder.encode("," + stringArray[i]));
                        }
                    }
                }
                obj3 = obj;
            } else {
                if (obj != null) {
                    obj = null;
                } else {
                    stringBuilder.append(a.b);
                }
                stringBuilder.append(URLEncoder.encode(str) + "=" + URLEncoder.encode(bundle
                        .getString(str)));
                obj3 = obj;
            }
            obj = obj3;
        }
    }
    return stringBuilder.toString();
}
 
Example 20
Project: boohee_v5.6   File: HttpUtils.java   View Source Code Vote up 4 votes
public static String encodeUrl(Bundle bundle) {
    if (bundle == null) {
        return "";
    }
    StringBuilder stringBuilder = new StringBuilder();
    Object obj = 1;
    for (String str : bundle.keySet()) {
        Object obj2 = bundle.get(str);
        if ((obj2 instanceof String) || (obj2 instanceof String[])) {
            Object obj3;
            if (obj2 instanceof String[]) {
                if (obj != null) {
                    obj = null;
                } else {
                    stringBuilder.append(com.alipay.sdk.sys.a.b);
                }
                stringBuilder.append(URLEncoder.encode(str) + "=");
                String[] stringArray = bundle.getStringArray(str);
                if (stringArray != null) {
                    for (int i = 0; i < stringArray.length; i++) {
                        if (i == 0) {
                            stringBuilder.append(URLEncoder.encode(stringArray[i]));
                        } else {
                            stringBuilder.append(URLEncoder.encode("," + stringArray[i]));
                        }
                    }
                    obj3 = obj;
                }
            } else {
                if (obj != null) {
                    obj = null;
                } else {
                    stringBuilder.append(com.alipay.sdk.sys.a.b);
                }
                stringBuilder.append(URLEncoder.encode(str) + "=" + URLEncoder.encode(bundle
                        .getString(str)));
                obj3 = obj;
            }
            obj = obj3;
        }
    }
    return stringBuilder.toString();
}