List of usage examples for android.os Bundle putString
public void putString(@Nullable String key, @Nullable String value)
From source file:net.idlesoft.android.apps.github.activities.CommitsList.java
@Override public void onSaveInstanceState(final Bundle savedInstanceState) { if (mCommitsJSON != null) { savedInstanceState.putString("commitsJson", mCommitsJSON.toString()); }//from ww w .ja v a 2 s.c o m super.onSaveInstanceState(savedInstanceState); }
From source file:com.amazon.adobepass.auth.AdobeAuthenticationActivity.java
/** * {@inheritDoc}// w ww . j a v a 2 s . c o m * Method to get authentication token for the device. * The method retries on its own to take care of failed calls, caller does not need to retry. */ @Override public void getAuthenticationToken() { try { getSubmitButton().setEnabled(false); if (NetworkUtils.isConnectedToNetwork(this)) { AdobepassRestClient.getAuthenticationTokenRequest(this, new JsonHttpResponseHandler() { @Override public void onSuccess(int statusCode, Header[] headers, JSONObject response) { super.onSuccess(statusCode, headers, response); Log.i(TAG, "getAuthenticationTokenRequest succeeded"); getSubmitButton().setEnabled(true); try { String mvpd = response.getString(AuthenticationConstants.MVPD); Log.d(TAG, "Logged in with the following provider: " + mvpd); Intent intent = new Intent(); Bundle bundle = new Bundle(); bundle.putString(AuthenticationConstants.MVPD, mvpd); setResult(RESULT_OK, intent.putExtra(AuthenticationConstants.MVPD_BUNDLE, bundle)); } catch (Exception e) { Log.e(TAG, "There was an exception when getting mvpd name.", e); setResult(RESULT_OK); } finish(); } @Override public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { super.onFailure(statusCode, headers, throwable, errorResponse); Log.e(TAG, "There was an error authenticating the user on second " + "screen. Status code: " + statusCode + " Error: " + errorResponse, throwable); getSubmitButton().setEnabled(true); setResultAndReturn(throwable, AuthenticationConstants.AUTHENTICATION_ERROR_CATEGORY); } }); } else { getSubmitButton().setEnabled(true); setResultAndReturn(null, AuthenticationConstants.NETWORK_ERROR_CATEGORY); } } catch (Exception e) { Log.e(TAG, "There was an exception when requesting the authentication token. ", e); getSubmitButton().setEnabled(true); } }
From source file:com.krayzk9s.imgurholo.activities.ImgurHoloActivity.java
public void imageSelected(ArrayList<JSONParcelable> data, int position) { FrameLayout displayFrag = (FrameLayout) findViewById(R.id.frame_layout_child); if (displayFrag == null) { // DisplayFragment (Fragment B) is not in the layout (handset layout), // so start DisplayActivity (Activity B) // and pass it the info about the selected item if (getApiCall().settings.getBoolean("ImagePagerEnabled", false) == false) { Intent intent = new Intent(); intent.putExtra("id", data.get(position)); Log.d("data", data.get(position).toString()); intent.setAction(ImgurHoloActivity.IMAGE_INTENT); intent.addCategory(Intent.CATEGORY_DEFAULT); startActivity(intent);/*from w ww.j a v a 2s . c o m*/ } else { Intent intent = new Intent(); intent.putExtra("ids", data); intent.putExtra("start", position); intent.setAction(ImgurHoloActivity.IMAGE_PAGER_INTENT); intent.addCategory(Intent.CATEGORY_DEFAULT); startActivity(intent); } } else { // DisplayFragment (Fragment B) is in the layout (tablet layout), // so tell the fragment to update try { if (data.get(position).getJSONObject().has("is_album") && data.get(position).getJSONObject().getBoolean("is_album")) { ImagesFragment fragment = new ImagesFragment(); Bundle bundle = new Bundle(); bundle.putString("imageCall", "3/album/" + data.get(position).getJSONObject().getString("id")); bundle.putString("id", data.get(position).getJSONObject().getString("id")); bundle.putParcelable("albumData", data.get(position)); fragment.setArguments(bundle); FragmentManager fragmentManager = getSupportFragmentManager(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); fragmentTransaction.replace(R.id.frame_layout_child, fragment).commitAllowingStateLoss(); } else { SingleImageFragment singleImageFragment = new SingleImageFragment(); Bundle bundle = new Bundle(); bundle.putBoolean("gallery", true); bundle.putParcelable("imageData", data.get(position)); singleImageFragment.setArguments(bundle); FragmentManager fragmentManager = getSupportFragmentManager(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); fragmentTransaction.replace(R.id.frame_layout_child, singleImageFragment) .commitAllowingStateLoss(); } } catch (JSONException e) { Log.e("Error!", e.toString()); } } }
From source file:luan.com.flippit.GcmIntentService.java
private void fileNotification(final String fileName, String msg, String msgId) { Log.i(MyActivity.TAG, getClass().getName() + ": " + "File transfer."); mBuilder.setContentTitle("FlippIt").setContentText("Downloading...").setSmallIcon(R.drawable.action_icon); String email = mPrefs.getString("email", ""); String url = GeneralUtilities.SERVER_PATH + "uploads/" + email + "/" + fileName; Bundle extras = new Bundle(); extras.putString("email", email); extras.putString("filename", fileName); extras.putString("msg", msg); extras.putString("msgId", msgId); DownloadFiles downloadFiles = new DownloadFiles(mContext); Callback fileCallback = new FileCallback(mContext); downloadFiles.getFileFromServer_v2(url, extras, fileCallback); }
From source file:de.lebenshilfe_muenster.uk_gebaerden_muensterland.activities.MainActivity.java
private void showSignVideo(Sign sign) { Log.d(TAG, "showSignVideo() " + hashCode()); final Intent intent = new Intent(this, LevelOneActivity.class); final Bundle bundle = new Bundle(); bundle.putString(LevelOneActivity.FRAGMENT_TO_SHOW, SignVideoFragment.class.getSimpleName()); bundle.putParcelable(SignVideoFragment.SIGN_TO_SHOW, sign); intent.putExtra(LevelOneActivity.EXTRA, bundle); startActivity(intent);/* ww w .j a va 2s. c o m*/ }
From source file:com.mirasense.scanditsdk.plugin.ScanditSDKActivity.java
@Override public void didScan(ScanSession session) { Log.e("ScanditSDK", "didScan 1"); if (session.getNewlyRecognizedCodes().size() > 0) { Log.e("ScanditSDK", "didScan 2"); if (!mContinuousMode) { Log.e("ScanditSDK", "didScan 2.5"); session.stopScanning();/*from ww w . ja v a2 s . co m*/ Log.e("ScanditSDK", "didScan 3"); Intent intent = new Intent(); intent.putExtra("barcode", session.getNewlyRecognizedCodes().get(0).getData()); intent.putExtra("symbology", session.getNewlyRecognizedCodes().get(0).getSymbologyName()); Log.e("ScanditSDK", "didScan 4"); setResult(SCAN, intent); Log.e("ScanditSDK", "didScan 5"); finish(); Log.e("ScanditSDK", "called finish"); } else { Log.e("ScanditSDK", "didScan 6"); Bundle bundle = new Bundle(); bundle.putString("barcode", session.getNewlyRecognizedCodes().get(0).getData()); bundle.putString("symbology", session.getNewlyRecognizedCodes().get(0).getSymbologyName()); ScanditSDKResultRelay.onResult(bundle); Log.e("ScanditSDK", "not finish"); } } }
From source file:com.QuarkLabs.BTCeClient.fragments.OrdersBookFragment.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.action_refresh: Bundle bundle = new Bundle(); bundle.putString("pair", mPairsSpinner.getSelectedItem().toString()); getLoaderManager().restartLoader(LOADER_ID, bundle, this); break;//from w ww .ja v a2 s .c om default: break; } return super.onOptionsItemSelected(item); }
From source file:com.brodev.socialapp.view.BlogDetail.java
/** Called when the activity is first created. */ @Override/*from w w w .ja v a2 s . c o m*/ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.blog_content_view); getSupportActionBar().setDisplayHomeAsUpEnabled(true); Bundle bundle = getIntent().getExtras(); blog = (Blog) bundle.get("blog"); user = (User) getApplicationContext(); colorView = new ColorView(getApplicationContext()); this.imageGetter = new ImageGetter(getApplicationContext()); if (android.os.Build.VERSION.SDK_INT > 9) { StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy); } if (blog.getTime_stamp().equals("0")) { this.getBlogAdapter(); } initView(); // get comment fragment Bundle comment = new Bundle(); comment.putString("type", "blog"); comment.putInt("itemId", blog.getBlog_id()); comment.putInt("totalComment", blog.getTotal_comment()); comment.putInt("total_like", blog.getTotal_like()); comment.putBoolean("no_share", blog.getShare()); comment.putBoolean("is_liked", blog.getIs_like()); comment.putBoolean("can_post_comment", blog.isCanPostComment()); CommentFragment commentFragment = new CommentFragment(); commentFragment.setArguments(comment); getSupportFragmentManager().beginTransaction().add(R.id.commentfragment_wrap, commentFragment).commit(); }
From source file:com.irccloud.android.fragment.AcceptListFragment.java
@Override public void onSaveInstanceState(Bundle state) { state.putInt("cid", cid); state.putString("event", event.toString()); }
From source file:com.brodev.socialapp.view.VideoPlay.java
/** Called when the activity is first created. */ @Override//w w w .jav a 2s .c om public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.video_player); if (android.os.Build.VERSION.SDK_INT > 9) { StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy); } getSupportActionBar().setDisplayHomeAsUpEnabled(true); user = (User) getApplication().getApplicationContext(); phraseManager = new PhraseManager(getApplicationContext()); colorView = new ColorView(getApplicationContext()); Bundle bundle = getIntent().getExtras(); video = (Video) bundle.get("video"); getSupportActionBar().setTitle(phraseManager.getPhrase(getApplicationContext(), "video.video")); if (video.getTime_stamp().equals("0")) { this.getVideoAdapter(); } initView(); // get comment fragment Bundle comment = new Bundle(); comment.putString("type", "video"); comment.putInt("itemId", video.getVideo_id()); comment.putInt("totalComment", video.getTotal_comment()); comment.putInt("total_like", video.getTotal_like()); comment.putBoolean("is_liked", video.getIs_like()); comment.putBoolean("can_post_comment", video.getCan_post_comment()); CommentFragment commentFragment = new CommentFragment(); commentFragment.setArguments(comment); getSupportFragmentManager().beginTransaction().add(R.id.commentfragment_wrap, commentFragment).commit(); }