List of usage examples for android.os Bundle Bundle
public Bundle()
From source file:br.liveo.ndrawer.ui.fragment.MainFragment.java
public static MainFragment newInstance(String text) { MainFragment mFragment = new MainFragment(); Bundle mBundle = new Bundle(); mBundle.putString(TEXT_FRAGMENT, text); mFragment.setArguments(mBundle);//w w w. java2s. c om return mFragment; }
From source file:com.ruesga.rview.fragments.SnippetFragment.java
public static SnippetFragment newInstance(Context context, Uri snippet, String mimeType) { SnippetFragment fragment = new SnippetFragment(); Bundle arguments = new Bundle(); if (snippet != null) { arguments.putParcelable(EXTRA_SNIPPET_URI, snippet); arguments.putString(EXTRA_SNIPPET_MIMETYPE, mimeType); } else {// w w w .j av a2s .c o m try { Uri uri = CacheHelper.createNewTemporaryFileUri(context, ".snippet"); arguments.putParcelable(EXTRA_TEMP_SNIPPET_URI, uri); } catch (IOException ex) { Log.e(TAG, "Can't create temporary snippet", ex); } } fragment.setArguments(arguments); return fragment; }
From source file:org.alfresco.mobile.android.platform.exception.CloudExceptionUtils.java
public static void handleCloudException(Context context, Long accountId, Exception exception, boolean forceRefresh, String taskId) { Log.w(TAG, Log.getStackTraceString(exception)); if (exception instanceof AlfrescoSessionException) { AlfrescoSessionException ex = ((AlfrescoSessionException) exception); switch (ex.getErrorCode()) { case ErrorCodeRegistry.SESSION_API_KEYS_INVALID: case ErrorCodeRegistry.SESSION_REFRESH_TOKEN_EXPIRED: requestOAuthAuthentication(context, accountId, taskId, forceRefresh); return; default:/*from w w w .ja va2 s . co m*/ if (ex.getMessage().contains("No authentication challenges found") || ex.getErrorCode() == 100) { requestOAuthAuthentication(context, accountId, taskId, forceRefresh); return; } break; } } if (exception instanceof AlfrescoServiceException) { AlfrescoServiceException ex = ((AlfrescoServiceException) exception); if ((ex.getErrorCode() == 104 || (ex.getMessage() != null && ex.getMessage().contains("No authentication challenges found")))) { requestOAuthAuthentication(context, accountId, taskId, forceRefresh); return; } else { Bundle b = new Bundle(); b.putInt(SimpleAlertDialogFragment.ARGUMENT_ICON, R.drawable.ic_application_logo); b.putInt(SimpleAlertDialogFragment.ARGUMENT_TITLE, R.string.error_general_title); b.putInt(SimpleAlertDialogFragment.ARGUMENT_POSITIVE_BUTTON, android.R.string.ok); b.putInt(SimpleAlertDialogFragment.ARGUMENT_MESSAGE, AlfrescoExceptionHelper.getMessageId(context, exception)); BaseActionUtils.actionDisplayDialog(context, b); return; } } if (exception instanceof CmisConnectionException) { CmisConnectionException ex = ((CmisConnectionException) exception); if (ex.getMessage().contains("No authentication challenges found")) { requestOAuthAuthentication(context, accountId, taskId, forceRefresh); return; } } if (exception instanceof AlfrescoSessionException) { int messageId = R.string.error_session_notfound; AlfrescoSessionException se = ((AlfrescoSessionException) exception); if (se.getErrorCode() == ErrorCodeRegistry.GENERAL_HTTP_RESP && se.getMessage() != null && se.getMessage().contains(HttpStatus.SC_SERVICE_UNAVAILABLE + "")) { messageId = R.string.error_session_cloud_unavailable; } EventBusManager.getInstance().post(new LoadAccountErrorEvent(null, accountId, exception, messageId)); } }
From source file:com.dahl.brendan.wordsearch.model.HighScore.java
public Bundle toBundle() { Bundle bundle = new Bundle(); bundle.putLong(Constants.KEY_HIGH_SCORE_TIME, time); bundle.putInt(Constants.KEY_HIGH_SCORE_SIZE, size); bundle.putString(Constants.KEY_HIGH_SCORE_THEME, theme); bundle.putInt(Constants.KEY_WORD_COUNT, wordCount); bundle.putString(Constants.KEY_HIGH_SCORE_NAME, name); bundle.putInt(Constants.KEY_GLOBAL_RANK, globalRank); bundle.putBoolean(Constants.KEY_GLOBAL_HIGH_SCORE, globalHighScore); bundle.putInt(Constants.KEY_RANK, rank); bundle.putLong(Constants.KEY_HIGH_SCORE, getScore()); return bundle; }
From source file:com.mobisys.android.ibp.ObservationRequestQueue.java
private void submitObservation(final boolean single, final ObservationInstance sp, final Context context) { Bundle b = new Bundle(); if (sp.getId() != -1) b.putString(Request.OBV_ID, String.valueOf(sp.getId())); b.putString(Request.SPECIES_GROUP_ID, String.valueOf(sp.getGroup().getId())); b.putString(Request.HABITAT_ID, String.valueOf(sp.getHabitatId())); String date = AppUtil.getStringFromDate(sp.getFromDate(), Constants.DATE_FORMAT); b.putString(Request.FROM_DATE, date); b.putString(Request.PLACE_NAME, sp.getPlaceName()); b.putString(Request.AREAS, sp.getAreas()); b.putString(Request.NOTES, sp.getNotes()); if (sp.getMaxVotedReco().getCommonName().length() > 0) b.putString(Request.COMMON_NAME, sp.getMaxVotedReco().getCommonName()); if (sp.getMaxVotedReco().getScientificName().length() > 0) b.putString(Request.SCI_NAME, sp.getMaxVotedReco().getScientificName()); b.putString(Request.RESOURCE_LIST_TYPE, Constants.RESOURCE_LIST_TYPE); b.putString(Request.AGREE_TERMS, Constants.AGREE_TERMS_VALUE); ArrayList<String> imageStringPath = new ArrayList<String>(); ArrayList<String> mImageType = new ArrayList<String>(); ArrayList<Resource> mResourceList = new ArrayList<Resource>(); mResourceList.addAll(sp.getResource()); /*if(sp.getResources()!=null){ String[] items = sp.getResources().split(","); for (String item : items){//from w w w .j av a 2 s. c o m resources.add(item); } }*/ /*if(sp.getImageType()!=null){ String[] imageT = sp.getImageType().split(","); for (String item : imageT){ imageType.add(item); } }*/ if (mResourceList != null && mResourceList.size() > 0) { for (int i = 0; i < mResourceList.size(); i++) { if (mResourceList.get(i).getUri() != null && mResourceList.get(i).isDirty()) { //while edit add uri and url to imagepath String imagepath = AppUtil.getRealPathFromURI(Uri.parse(mResourceList.get(i).getUri()), context); if (Preferences.DEBUG) Log.d("ObsRequestQ", "***image path:" + imagepath); imageStringPath.add(imagepath); String imageType = AppUtil.GetMimeType(context, Uri.parse(mResourceList.get(i).getUri())); if (Preferences.DEBUG) Log.d("ObsRequestQ", "***image type: " + imageType); mImageType.add(imageType); } else { if (mResourceList.get(i).getUrl() != null) { imageStringPath.add(mResourceList.get(i).getUrl()); mImageType.add("null"); } } } } uploadImage(single, b, context, imageStringPath, mImageType, sp); }
From source file:au.com.wallaceit.reddinator.GlobalObjects.java
public void setItemUpdate(int position, String id, String val) { itemupdate = new Bundle(); itemupdate.putInt("position", position); itemupdate.putString("id", id); itemupdate.putString("val", val); }
From source file:com.seregil13.literarytracker.lightnovel.LightNovelEditFragment.java
/** * Creates a new instance of the fragment in edit mode with all the pertinent data passed in as * parameters.//ww w . j a v a2 s. c o m * * @return An instance of LightNovelEditFragment. */ public static LightNovelEditFragment newEditInstance(int id, String title, String author, String description, String completed, String translatorSite, ArrayList<String> genres) { LightNovelEditFragment fragment = new LightNovelEditFragment(); Bundle arguments = new Bundle(); arguments.putInt(JsonKeys.ID.toString(), id); arguments.putString(JsonKeys.TITLE.toString(), title); arguments.putString(JsonKeys.AUTHOR.toString(), author); arguments.putString(JsonKeys.DESCRIPTION.toString(), description); arguments.putString(JsonKeys.COMPLETED.toString(), completed); arguments.putString(JsonKeys.TRANSLATOR_SITE.toString(), translatorSite); arguments.putStringArrayList(JsonKeys.GENRES.toString(), genres); arguments.putSerializable(CREATE_OR_EDIT_KEY, Mode.EDIT); fragment.setArguments(arguments); return fragment; }
From source file:edu.cwru.apo.Home.java
@Override public void onResume() { super.onResume(); if (!Auth.loggedIn) { Intent nextActivity = new Intent(Home.this, Login.class); Bundle extras = new Bundle(); nextActivity.putExtras(extras);// w ww . j av a 2s.c o m Home.this.startActivity(nextActivity); finish(); } }
From source file:edu.htl3r.schoolplanner.gui.selectScreen.ViewTypeSpinnerOnItemSelectedListener.java
public void fireEvent(int position) { ViewType item = getViewType(position); // Falls kein SpinnerMemory verwendet wird if (spinnerMemory != null) spinnerMemory.setSelectedViewType(item); Bundle bundle = new Bundle(); bundle.putSerializable(BundleConstants.SELECTED_VIEW_TYPE, item); intent.putExtras(bundle);//from www .j a va 2 s. com this.parent.startActivity(intent); }
From source file:com.friedran.appengine.dashboard.client.AppEngineDashboardClient.java
public AppEngineDashboardClient(Account account, Context context, AppEngineDashboardAuthenticator.OnUserInputRequiredCallback onUserInputRequiredCallback, PostExecuteCallback postAuthenticationCallback) { mAccount = account;/*from www. jav a 2 s . co m*/ mApplicationContext = context.getApplicationContext(); mPostAuthenticateCallback = postAuthenticationCallback; mLastRetrievedApplications = new ArrayList<String>(); mHttpClient = new DefaultHttpClient(); mAuthenticator = new AppEngineDashboardAuthenticator(mAccount, mHttpClient, mApplicationContext, onUserInputRequiredCallback, new AppEngineDashboardAuthenticator.PostAuthenticateCallback() { @Override public void run(boolean result) { Bundle bundle = new Bundle(); bundle.putBoolean(KEY_RESULT, result); mPostAuthenticateCallback.onPostExecute(bundle); } }); }