List of usage examples for android.os Bundle putInt
public void putInt(@Nullable String key, int value)
From source file:com.hackensack.umc.activity.ProfileSelfieManualCropActivity.java
@Override public void onClick(View v) { switch (v.getId()) { case R.id.proceed_btn: profileInsuranceInfoFragment = new ProfileInsuranceInfoFragment(); FragmentManager fragmentManager = getSupportFragmentManager(); android.support.v4.app.FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); fragmentTransaction.add(R.id.fragmentIcContainer, profileInsuranceInfoFragment, "IsuranceFragment"); fragmentTransaction.addToBackStack(null); fragmentTransaction.commit();//from w w w .j ava 2 s. co m break; case R.id.manual_btn: Intent intent = new Intent(ProfileSelfieManualCropActivity.this, RegistrationDetailsActivity.class); Bundle b = new Bundle(); b.putInt(Constant.REGISTRATION_MODE, Constant.MANUAL); intent.putExtra(Constant.BUNDLE, b); startActivity(intent); break; case R.id.selfie_img: selectedImageView = Constant.SELFIE; imageUri = CameraFunctionality.dispatchTakePictureIntent(ProfileSelfieManualCropActivity.this, 1, Constant.SELFIE); break; } }
From source file:edu.mit.mobile.android.locast.net.NetworkClient.java
public static Bundle jsonObjectToBundle(JSONObject jsonObject, boolean allStrings) { final Bundle b = new Bundle(); for (@SuppressWarnings("unchecked") final Iterator<String> i = jsonObject.keys(); i.hasNext();) { final String key = i.next(); final Object value = jsonObject.opt(key); if (value == null) { b.putSerializable(key, null); } else if (allStrings) { b.putString(key, String.valueOf(value)); } else if (value instanceof String) { b.putString(key, (String) value); } else if (value instanceof Integer) { b.putInt(key, (Integer) value); }/* w w w . j a v a 2 s .c om*/ } return b; }
From source file:com.layer8apps.CalendarHandler.java
/************ * PURPOSE: Handles the primary thread in the service * ARGUMENTS: Intent intent/*ww w .j ava 2 s . c o m*/ * RETURNS: VOID * AUTHOR: Devin Collins <agent14709@gmail.com> *************/ @Override protected void onHandleIntent(Intent intent) { // Get our stored data from the intent username = intent.getStringExtra("username"); password = intent.getStringExtra("password"); messenger = (Messenger) intent.getExtras().get("handler"); calID = intent.getIntExtra("calendarID", -1); String url = getApplicationContext().getResources().getString(R.string.url); // Create variables to be used through the application List<String[]> workDays = null; ConnectionManager conn = ConnectionManager.newConnection(); /************ * Once we verify that we have a valid token, we get the actual schedule *************/ updateStatus("Logging in..."); String tempToken = conn.getData(url + "/etm/login.jsp"); if (tempToken != null) { loginToken = parseToken(tempToken); } else { showError("Error connecting to MyTLC, make sure you have a valid network connection"); return; } String postResults = null; // This creates our login information List<NameValuePair> parameters = createParams(); if (loginToken != null) { // Here we send the information to the server and login postResults = conn.postData(url + "/etm/login.jsp", parameters); } else { showError("Error retrieving your login token"); return; } if (postResults != null && postResults.toLowerCase().contains("etmmenu.jsp") && !postResults.toLowerCase().contains("<font size=\"2\">")) { updateStatus("Retrieving schedule..."); postResults = conn.getData(url + "/etm/time/timesheet/etmTnsMonth.jsp"); } else { String error = parseError(postResults); if (error != null) { showError(error); } else { showError("Error logging in, please verify your username and password"); } return; } // If we successfully got the information, then parse out the schedule to read it properly String secToken = null; if (postResults != null) { updateStatus("Parsing schedule..."); workDays = parseSchedule(postResults); secToken = parseSecureToken(postResults); wbat = parseWbat(postResults); } else { showError("Could not obtain user schedule"); return; } if (secToken != null) { parameters = createSecondParams(secToken); postResults = conn.postData(url + "/etm/time/timesheet/etmTnsMonth.jsp", parameters); } else { String error = parseError(postResults); if (error != null) { showError(error); } else { showError("Error retrieving your security token"); } return; } List<String[]> secondMonth = null; if (postResults != null) { secondMonth = parseSchedule(postResults); } else { showError("Could not obtain user schedule"); return; } if (secondMonth != null) { if (workDays == null) { workDays = secondMonth; } else { workDays.addAll(secondMonth); } finalDays = workDays; } else { String error = parseError(postResults); if (error != null) { showError(error); } else { showError("There was an error retrieving your schedule"); } return; } // Add our shifts to the calendar updateStatus("Adding shifts to calendar..."); int numShifts = addDays(); if (finalDays != null && numShifts > -1) { // Report back that we're successful! Message msg = Message.obtain(); Bundle b = new Bundle(); b.putString("status", "DONE"); b.putInt("count", numShifts); msg.setData(b); try { messenger.send(msg); } catch (Exception e) { // Nothing } } else { showError("Couldn't add your shifts to your calendar"); } }
From source file:com.hackensack.umc.activity.ProfileActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getSupportActionBar().setDisplayHomeAsUpEnabled(true); setContentView(R.layout.activity_profile); if (savedInstanceState == null) { showAlert(ProfileActivity.this, getString(R.string.msg_easy_data), "Easy Data Entry"); } else {/* w w w . j a v a 2s . c om*/ } imgIdFront = (ImageView) findViewById(R.id.dl_front); imgIdBack = (ImageView) findViewById(R.id.dl_back); imgIcFront = (ImageView) findViewById(R.id.ic_front); imgIcBack = (ImageView) findViewById(R.id.ic_back); imgSelfie = (ImageView) findViewById(R.id.selfie_img); imgIdFront.setOnClickListener(this); imgIdBack.setOnClickListener(this); imgIcFront.setOnClickListener(this); imgIcBack.setOnClickListener(this); imgSelfie.setOnClickListener(this); ((Button) findViewById(R.id.proceed_btn)).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // startActivity(new Intent(ProfileActivity.this, RegistrationDetailsActivity.class)); // startRegistrationActivity(); if (checkValidationsBeforeCall()) { if (Util.ifNetworkAvailableShowProgressDialog(ProfileActivity.this, getString(R.string.scanning_images), true)) { new GetAccessTokenCallDataMotion().execute(); } } } }); ((Button) findViewById(R.id.manual_btn)).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // startActivity(new Intent(ProfileActivity.this, RegistrationDetailsActivity.class)); Intent intent = new Intent(ProfileActivity.this, RegistrationDetailsActivity.class); Bundle b = new Bundle(); b.putInt(Constant.REGISTRATION_MODE, Constant.MANUAL); intent.putExtra(Constant.BUNDLE, b); startActivity(intent); } }); initialisevariables(); }
From source file:com.zia.freshdocs.widget.adapter.CMISAdapter.java
/** * Download the content for the given NodeRef * /*from w ww .j ava2s. c o m*/ * @param ref * @param handler */ protected void downloadContent(final NodeRef ref, final Handler handler) { startProgressDlg(false); mProgressDlg.setMax(Long.valueOf(ref.getContentLength()).intValue()); mDlThread = new ChildDownloadThread(handler, new Downloadable() { public Object execute() { File f = null; try { CMISApplication app = (CMISApplication) getContext().getApplicationContext(); URL url = new URL(ref.getContent()); String name = ref.getName(); long fileSize = ref.getContentLength(); f = app.getFile(name, fileSize); if (f != null && f.length() != fileSize) { Thread.currentThread().setPriority(Thread.MIN_PRIORITY); FileOutputStream fos = new FileOutputStream(f); InputStream is = mCmis.get(url.getPath()); byte[] buffer = new byte[BUF_SIZE]; int len = is.read(buffer); int total = len; Message msg = null; Bundle b = null; while (len != -1) { msg = handler.obtainMessage(); b = new Bundle(); b.putInt("progress", total); msg.setData(b); handler.sendMessage(msg); fos.write(buffer, 0, len); len = is.read(buffer); total += len; if (Thread.interrupted()) { fos.close(); f = null; throw new InterruptedException(); } } fos.flush(); fos.close(); } } catch (Exception e) { Log.e(CMISAdapter.class.getSimpleName(), "", e); } return f; } }); mDlThread.start(); }
From source file:com.buddi.client.dfu.DfuActivity.java
@Override protected void onSaveInstanceState(final Bundle outState) { super.onSaveInstanceState(outState); outState.putInt(DATA_FILE_TYPE, mFileType); outState.putInt(DATA_FILE_TYPE_TMP, mFileTypeTmp); outState.putString(DATA_FILE_PATH, mFilePath); outState.putParcelable(DATA_FILE_STREAM, mFileStreamUri); outState.putParcelable(DATA_DEVICE, mSelectedDevice); outState.putBoolean(DATA_STATUS, mStatusOk); }
From source file:com.hackensack.umc.activity.ProfileActivity.java
private void startRegistrationActivity(DataForAutoRegistration dataTosend) { Intent intent = new Intent(ProfileActivity.this, RegistrationDetailsActivity.class); Bundle b = new Bundle(); b.putSerializable(Constant.REG_REQUIRED_DATA, dataTosend); b.putInt(Constant.REGISTRATION_MODE, Constant.AUTO); b = putUrlValuesInBundle(b);//from ww w. ja v a2s . c o m intent.putExtra(Constant.BUNDLE, b); startActivity(intent); }
From source file:com.dwdesign.tweetings.fragment.UserListDetailsFragment.java
public void getUserListInfo(final boolean init, final long account_id, final int list_id, final String list_name, final long user_id, final String screen_name) { mAccountId = account_id;//from w ww. java 2 s . co m mUserListId = list_id; mUserName = screen_name; getLoaderManager().destroyLoader(0); if (!isMyActivatedAccount(getActivity(), mAccountId)) { mListContainer.setVisibility(View.GONE); mErrorRetryContainer.setVisibility(View.GONE); return; } if (list_id > 0 || list_name != null && (user_id > 0 || screen_name != null)) { } else { mListContainer.setVisibility(View.GONE); mErrorRetryContainer.setVisibility(View.GONE); return; } final Bundle args = new Bundle(); args.putLong(INTENT_KEY_ACCOUNT_ID, account_id); args.putLong(INTENT_KEY_USER_ID, user_id); args.putInt(INTENT_KEY_LIST_ID, list_id); args.putString(INTENT_KEY_LIST_NAME, list_name); args.putString(INTENT_KEY_SCREEN_NAME, screen_name); if (init) { getLoaderManager().initLoader(0, args, this); } else { getLoaderManager().restartLoader(0, args, this); } }
From source file:com.hackensack.umc.activity.ProfileSelfieManualCropActivity.java
private void startRegistrationActivity(DataForAutoRegistration dataTosend) { Intent intent = new Intent(ProfileSelfieManualCropActivity.this, RegistrationDetailsActivity.class); Bundle b = new Bundle(); b.putSerializable(Constant.REG_REQUIRED_DATA, dataTosend); b.putInt(Constant.REGISTRATION_MODE, Constant.AUTO); b = putUrlValuesInBundle(b);/*from w w w . jav a 2 s . c om*/ intent.putExtra(Constant.BUNDLE, b); startActivity(intent); }
From source file:com.cttapp.bby.mytlc.layer8apps.CalendarHandler.java
/************ * PURPOSE: Handles the primary thread in the service * ARGUMENTS: Intent intent//from ww w. jav a 2s . c om * RETURNS: VOID * AUTHOR: Devin Collins <agent14709@gmail.com> *************/ @Override protected void onHandleIntent(Intent intent) { // Get our stored data from the intent username = intent.getStringExtra("username"); password = intent.getStringExtra("password"); messenger = (Messenger) intent.getExtras().get("handler"); calID = intent.getIntExtra("calendarID", -1); String url = getApplicationContext().getResources().getString(R.string.url); // Create variables to be used through the application List<String[]> workDays = null; ConnectionManager conn = ConnectionManager.newConnection(); /************ * Once we verify that we have a valid token, we get the actual schedule *************/ updateStatus("Logging in..."); String tempToken = conn.getData(url + "/etm/login.jsp"); if (tempToken != null) { loginToken = parseToken(tempToken); } else { showError("Error connecting to MyTLC, make sure you have a valid network connection"); return; } String postResults = null; // This creates our login information List<NameValuePair> parameters = createParams(); if (loginToken != null) { // Here we send the information to the server and login postResults = conn.postData(url + "/etm/login.jsp", parameters); } else { showError("Error retrieving your login token"); return; } if (postResults != null && postResults.toLowerCase().contains("etmmenu.jsp") && !postResults.toLowerCase().contains("<font size=\"2\">")) { updateStatus("Retrieving schedule..."); postResults = conn.getData(url + "/etm/time/timesheet/etmTnsMonth.jsp"); } else { String error = parseError(postResults); if (error != null) { showError(error); } else { showError("Error logging in, please verify your username and password"); } return; } // If we successfully got the information, then parse out the schedule to read it properly String secToken = null; if (postResults != null) { updateStatus("Parsing schedule..."); workDays = parseSchedule(postResults); secToken = parseSecureToken(postResults); wbat = parseWbat(postResults); } else { showError("Could not obtain user schedule"); return; } if (secToken != null) { parameters = createSecondParams(secToken); postResults = conn.postData(url + "/etm/time/timesheet/etmTnsMonth.jsp", parameters); } else { String error = parseError(postResults); if (error != null) { showError(error); } else { showError("Error retrieving your security token"); } return; } List<String[]> secondMonth = null; if (postResults != null) { secondMonth = parseSchedule(postResults); } else { showError("Could not obtain user schedule"); return; } if (secondMonth != null) { if (workDays == null) { workDays = secondMonth; } else { workDays.addAll(secondMonth); } finalDays = workDays; } else { String error = parseError(postResults); if (error != null) { showError(error); } else { showError("There was an error retrieving your schedule"); } return; } // Add our shifts to the calendar updateStatus("Adding shifts to calendar..."); int numShifts = addDays(); if (finalDays != null && numShifts > -1) { // Report back that we're successful! Message msg = Message.obtain(); Bundle b = new Bundle(); b.putString("status", "DONE"); b.putInt("count", numShifts); msg.setData(b); try { messenger.send(msg); } catch (Exception e) { // Nothing } } else { showError("Couldn't add your shifts to your calendar"); } }