List of usage examples for android.content Intent removeExtra
public void removeExtra(String name)
From source file:com.stasbar.knowyourself.timer.TimerFragment.java
@Override public void onStart() { super.onStart(); // Initialize the page indicators. updatePageIndicators();/*from w w w. j a va 2s . c om*/ boolean createTimer = false; int showTimerId = -1; // Examine the intent of the parent activity to determine which view to display. final Intent intent = getActivity().getIntent(); if (intent != null) { // These extras are single-use; remove them after honoring them. createTimer = intent.getBooleanExtra(EXTRA_TIMER_SETUP, false); intent.removeExtra(EXTRA_TIMER_SETUP); showTimerId = intent.getIntExtra(TimerService.EXTRA_TIMER_ID, -1); intent.removeExtra(TimerService.EXTRA_TIMER_ID); } // Choose the view to display in this fragment. if (showTimerId != -1) { // A specific timer must be shown; show the list of timers. showTimersView(); } else if (!hasTimers() || createTimer || mTimerSetupState != null) { // No timers exist, a timer is being created, or the last view was timer setup; // show the timer setup view. showCreateTimerView(); if (mTimerSetupState != null) { mCreateTimerView.setState(mTimerSetupState); mTimerSetupState = null; } } else { // Otherwise, default to showing the list of timers. showTimersView(); } // If the intent did not specify a timer to show, show the last timer that expired. if (showTimerId == -1) { final Timer timer = DataModel.getDataModel().getMostRecentExpiredTimer(); showTimerId = timer == null ? -1 : timer.getId(); } // If a specific timer should be displayed, display the corresponding timer tab. if (showTimerId != -1) { final Timer timer = DataModel.getDataModel().getTimer(showTimerId); if (timer != null) { final int index = DataModel.getDataModel().getTimers().indexOf(timer); mViewPager.setCurrentItem(index); } } }
From source file:com.android.deskclock.timer.TimerFragment.java
@Override public void onResume() { super.onResume(); // Start watching for page changes away from this fragment. getDeskClock().registerPageChangedListener(this); // Initialize the page indicators. updatePageIndicators();/*from w w w.j av a 2 s . c om*/ boolean createTimer = false; int showTimerId = -1; // Examine the intent of the parent activity to determine which view to display. final Intent intent = getActivity().getIntent(); if (intent != null) { // These extras are single-use; remove them after honoring them. createTimer = intent.getBooleanExtra(EXTRA_TIMER_SETUP, false); intent.removeExtra(EXTRA_TIMER_SETUP); showTimerId = intent.getIntExtra(HandleDeskClockApiCalls.EXTRA_TIMER_ID, -1); intent.removeExtra(HandleDeskClockApiCalls.EXTRA_TIMER_ID); } // Choose the view to display in this fragment. if (showTimerId != -1) { // A specific timer must be shown; show the list of timers. showTimersView(); } else if (!hasTimers() || createTimer || mTimerSetupState != null) { // No timers exist, a timer is being created, or the last view was timer setup; // show the timer setup view. showCreateTimerView(); if (mTimerSetupState != null) { mCreateTimerView.setState(mTimerSetupState); mTimerSetupState = null; } } else { // Otherwise, default to showing the list of timers. showTimersView(); } // If the intent did not specify a timer to show, show the last timer that expired. if (showTimerId == -1) { final Timer timer = DataModel.getDataModel().getMostRecentExpiredTimer(); showTimerId = timer == null ? -1 : timer.getId(); } // If a specific timer should be displayed, display the corresponding timer tab. if (showTimerId != -1) { final Timer timer = DataModel.getDataModel().getTimer(showTimerId); if (timer != null) { final int index = DataModel.getDataModel().getTimers().indexOf(timer); mViewPager.setCurrentItem(index); } } }
From source file:com.duy.pascal.ui.editor.BaseEditorActivity.java
private void loadFileFromIntent() { Intent intent = getIntent(); if (intent != null && intent.getSerializableExtra(CompileManager.EXTRA_FILE) != null) { File file = (File) intent.getSerializableExtra(CompileManager.EXTRA_FILE); //No need save last file because it is the first file addNewPageEditor(file);//from w w w . j a v a 2 s . com //Remove path intent.removeExtra(CompileManager.EXTRA_FILE); } }
From source file:com.stasbar.knowyourself.timer.TimerFragment.java
@Override public void onResume() { super.onResume(); // We may have received a new intent while paused. final Intent intent = getActivity().getIntent(); if (intent != null && intent.hasExtra(TimerService.EXTRA_TIMER_ID)) { // This extra is single-use; remove after honoring it. final int showTimerId = intent.getIntExtra(TimerService.EXTRA_TIMER_ID, -1); intent.removeExtra(TimerService.EXTRA_TIMER_ID); final Timer timer = DataModel.getDataModel().getTimer(showTimerId); if (timer != null) { // A specific timer must be shown; show the list of timers. final int index = DataModel.getDataModel().getTimers().indexOf(timer); mViewPager.setCurrentItem(index); animateToView(mTimersView, null); }/*from w ww . j ava 2 s. c o m*/ } }
From source file:com.androidinspain.deskclock.timer.TimerFragment.java
@Override public void onStart() { super.onStart(); // Initialize the page indicators. updatePageIndicators();//from w ww . j a v a2 s . c o m boolean createTimer = false; int showTimerId = -1; // Examine the intent of the parent activity to determine which view to display. final Intent intent = getActivity().getIntent(); if (intent != null) { // These extras are single-use; remove them after honoring them. createTimer = intent.getBooleanExtra(EXTRA_TIMER_SETUP, false); intent.removeExtra(EXTRA_TIMER_SETUP); showTimerId = intent.getIntExtra(TimerService.EXTRA_TIMER_ID, -1); intent.removeExtra(TimerService.EXTRA_TIMER_ID); } // Choose the view to display in this fragment. if (showTimerId != -1) { // A specific timer must be shown; show the list of timers. showTimersView(FAB_AND_BUTTONS_IMMEDIATE); } else if (!hasTimers() || createTimer || mTimerSetupState != null) { // No timers exist, a timer is being created, or the last view was timer setup; // show the timer setup view. showCreateTimerView(FAB_AND_BUTTONS_IMMEDIATE); if (mTimerSetupState != null) { mCreateTimerView.setState(mTimerSetupState); mTimerSetupState = null; } } else { // Otherwise, default to showing the list of timers. showTimersView(FAB_AND_BUTTONS_IMMEDIATE); } // If the intent did not specify a timer to show, show the last timer that expired. if (showTimerId == -1) { final Timer timer = DataModel.getDataModel().getMostRecentExpiredTimer(); showTimerId = timer == null ? -1 : timer.getId(); } // If a specific timer should be displayed, display the corresponding timer tab. if (showTimerId != -1) { final Timer timer = DataModel.getDataModel().getTimer(showTimerId); if (timer != null) { final int index = DataModel.getDataModel().getTimers().indexOf(timer); mViewPager.setCurrentItem(index); } } }
From source file:com.androidinspain.deskclock.timer.TimerFragment.java
@Override public void onResume() { super.onResume(); // We may have received a new intent while paused. final Intent intent = getActivity().getIntent(); if (intent != null && intent.hasExtra(TimerService.EXTRA_TIMER_ID)) { // This extra is single-use; remove after honoring it. final int showTimerId = intent.getIntExtra(TimerService.EXTRA_TIMER_ID, -1); intent.removeExtra(TimerService.EXTRA_TIMER_ID); final Timer timer = DataModel.getDataModel().getTimer(showTimerId); if (timer != null) { // A specific timer must be shown; show the list of timers. final int index = DataModel.getDataModel().getTimers().indexOf(timer); mViewPager.setCurrentItem(index); animateToView(mTimersView, null, false); }//from w w w . j av a 2 s . c o m } }
From source file:com.duy.pascal.ui.editor.BaseEditorActivity.java
@Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); DLog.d(TAG, "onNewIntent() called with: intent = [" + intent + "]"); if (intent.getSerializableExtra(CompileManager.EXTRA_FILE) != null) { File file = (File) intent.getSerializableExtra(CompileManager.EXTRA_FILE); if (!file.exists()) { Toast.makeText(this, R.string.file_not_found, Toast.LENGTH_SHORT).show(); return; }// www.j a v a2 s . c o m addNewPageEditor(file); //remove path intent.removeExtra(CompileManager.EXTRA_FILE); } }
From source file:fr.tvbarthel.apps.simpleweatherforcast.MainActivity.java
@Override protected void onResume() { super.onResume(); final String lastKnownWeather = SharedPreferenceUtils.getLastKnownWeather(getApplicationContext()); final Intent intent = getIntent(); SharedPreferenceUtils.registerOnSharedPreferenceChangeListener(this, this); if (lastKnownWeather == null) { // There is no forecast, it should be the first launch mProgressBar.setVisibility(View.VISIBLE); } else if (mLoadedWeather != lastKnownWeather) { // Load the last known weather loadDailyForecast(lastKnownWeather); } else if (intent != null && intent.hasExtra(EXTRA_PAGE_POSITION)) { final int position = intent.getIntExtra(EXTRA_PAGE_POSITION, 0); mViewPager.setCurrentItem(position, true); intent.removeExtra(EXTRA_PAGE_POSITION); }/*ww w. ja v a2 s.c o m*/ //Check if the last known weather is out dated. if (SharedPreferenceUtils.isWeatherOutdated(this, false) || lastKnownWeather == null) { DailyForecastUpdateService.startForUpdate(this); } }
From source file:com.scigames.registration.LoginActivity.java
public void onResultsSucceeded(String[] serverResponseStrings, JSONObject serverResponseJSON) throws JSONException { setProgressBarIndeterminateVisibility(false); Log.d(TAG, "LOGIN SUCCEEDED: "); for (int i = 0; i < serverResponseStrings.length; i++) { //just print everything returned as a String[] for fun Log.d(TAG, "[" + i + "] " + serverResponseStrings[i]); }/*from ww w . j a v a 2 s . c o m*/ JSONObject thisStudent = serverResponseJSON.getJSONObject("student"); String cartLevel = thisStudent.getString("cart_game_level"); String slideLevel = thisStudent.getString("slide_game_level"); String mass = thisStudent.getString("mass"); String photoUrl = thisStudent.getString("photo"); String firstName = thisStudent.getString("first_name"); fNameGlobal = firstName; String lastName = thisStudent.getString("last_name"); lNameGlobal = lastName; String email = thisStudent.getString("email"); String pw = thisStudent.getString("pw"); String classId = thisStudent.getString("class_id"); String rfid = thisStudent.getString("current_rfid"); Log.d(TAG, "this student: "); Log.d(TAG, thisStudent.toString()); //if(debug){ // alertDialog.setTitle("incoming:"); // alertDialog.setMessage("active: " + serverResponseStrings[2] + // " cartLevel: " + cartLevel + // " slideLevel: " + slideLevel + // " mass: " + mass + // " firstName: " + firstName + // " lastName: " + lastName + // " pw: " + pw + // " classId: " + classId + // " rfid: " + rfid // ); // alertDialog.show(); //{ if (serverResponseStrings[2].equals("false")) { //check active state. if inactive for today, get RFID Log.d(TAG, "off to RFID page!"); /****** RFID ACTIVITY INTENT ******/ Intent i = new Intent(LoginActivity.this, Registration2RfidMass_AdkServiceActivity.class); Log.d(TAG, "new Intent"); Log.d(TAG, "sending:"); Log.d(TAG, firstName); Log.d(TAG, lastName); i.putExtra("needsRfid", "yes"); i.putExtra("rfid", ""); i.putExtra("mass", ""); i.putExtra("fName", firstName); i.putExtra("lName", lastName); i.putExtra("studentId", serverResponseStrings[0]); i.putExtra("visitId", serverResponseStrings[1]); LoginActivity.this.startActivity(i); Log.d(TAG, "...startActivity"); i.removeExtra("fName"); i.removeExtra("lName"); i.removeExtra("rfid"); i.removeExtra("studentId"); i.removeExtra("visitId"); i.removeExtra("needsRfid"); i.removeExtra("mass"); Log.d(TAG, "...removeExtras"); /**********************************/ } else if (thisStudent.get("mass").equals(null)) { //no mass recorded Log.d(TAG, "off to mass page!"); /****** MASS ACTIVITY INTENT ******/ //Intent i = new Intent(LoginActivity.this, Registration3MassActivity.class); //THIS IS CORRECT Intent i = new Intent(LoginActivity.this, Registration2RfidMass_AdkServiceActivity.class); Log.d(TAG, "new Intent"); i.putExtra("needsRfid", "no"); i.putExtra("fName", firstName); i.putExtra("lName", lastName); i.putExtra("rfid", ""); i.putExtra("mass", ""); i.putExtra("studentId", serverResponseStrings[0]); i.putExtra("visitId", serverResponseStrings[1]); LoginActivity.this.startActivity(i); Log.d(TAG, "...startActivity"); /**********************************/ } else if (thisStudent.get("photo").equals(null)) { //no photo recorded //send to photo activity Log.d(TAG, "off to photo page!"); /****** PHOTO ACTIVITY INTENT ******/ Intent i = new Intent(LoginActivity.this, Registration4PhotoActivity.class); Log.d(TAG, "new Intent"); i.putExtra("fName", firstName); i.putExtra("lName", lastName); i.putExtra("studentId", serverResponseStrings[0]); i.putExtra("visitId", serverResponseStrings[1]); LoginActivity.this.startActivity(i); Log.d(TAG, "...startActivity"); /**********************************/ } // **no email for now** // // else if(thisStudent.get("email").equals(null)){ //no email recorded // //send to email activity // Log.d(TAG, "off to email page!"); // // /****** EMAIL ACTIVITY INTENT ******/ // Intent i = new Intent(LoginActivity.this, Registration5EmailActivity.class); // Log.d(TAG,"new Intent"); // i.putExtra("fName",firstName); // i.putExtra("lName",lastName); // i.putExtra("studentId",serverResponseStrings[0]); // i.putExtra("visitId",serverResponseStrings[1]); // LoginActivity.this.startActivity(i); // Log.d(TAG,"...startActivity"); // /**********************************/ // } else { //send directly to their profile, they're all registered. /****** PROFILE ACTIVITY INTENT ******/ Intent i = new Intent(LoginActivity.this, ProfileActivity.class); Log.d(TAG, "new Intent"); i.putExtra("fName", firstName); i.putExtra("lName", lastName); i.putExtra("photoUrl", photoUrl); i.putExtra("mass", mass); i.putExtra("cartLevel", cartLevel); i.putExtra("slideLevel", cartLevel); i.putExtra("email", email); i.putExtra("rfid", rfid); i.putExtra("password", pw); i.putExtra("classId", classId); i.putExtra("studentId", serverResponseStrings[0]); i.putExtra("visitId", serverResponseStrings[1]); LoginActivity.this.startActivity(i); Log.d(TAG, "...startActivity"); /****** PROFILE ACTIVITY INTENT ******/ } }
From source file:com.todoroo.astrid.activity.TaskListActivity.java
private void newListFromLaunch() { Intent thisIntent = getIntent(); Intent newTagIntent = TagsPlugin.newTagDialog(this); newTagIntent.putExtra(TagSettingsActivity.TOKEN_AUTOPOPULATE_MEMBERS, thisIntent.getStringExtra(TOKEN_CREATE_NEW_LIST_MEMBERS)); newTagIntent.putExtra(TagSettingsActivity.TOKEN_AUTOPOPULATE_NAME, thisIntent.getStringExtra(TOKEN_CREATE_NEW_LIST_NAME)); thisIntent.removeExtra(TOKEN_CREATE_NEW_LIST_MEMBERS); thisIntent.removeExtra(TOKEN_CREATE_NEW_LIST_NAME); startActivityForResult(newTagIntent, FilterListFragment.REQUEST_NEW_LIST); }