List of usage examples for android.content Intent getIntExtra
public int getIntExtra(String name, int defaultValue)
From source file:com.abhijitvalluri.android.fitnotifications.AppSettingsActivity.java
@Override public void onActivityResult2(int requestCode, Intent data) { int hour = data.getIntExtra(TimePickerFragment.EXTRA_HOUR, 0); int minute = data.getIntExtra(TimePickerFragment.EXTRA_MINUTE, 0); java.text.DateFormat timeFormat = DateFormat.getTimeFormat(this); String formattedTime = timeFormat.format(Func.convertHourMinute2Date(hour, minute)); int time = hour * 60 + minute; if (requestCode == START_TIME_REQUEST) { mStartTimeHour = hour;/*from w w w . j av a 2 s . c om*/ mStartTimeMinute = minute; mStartTimeButton.setText(formattedTime); int stopTime = mStopTimeHour * 60 + mStopTimeMinute; if (time > stopTime) { mNextDay.setVisibility(View.VISIBLE); } else { mNextDay.setVisibility(View.INVISIBLE); } } else if (requestCode == STOP_TIME_REQUEST) { mStopTimeHour = hour; mStopTimeMinute = minute; mStopTimeButton.setText(formattedTime); int startTime = mStartTimeHour * 60 + mStartTimeMinute; if (time < startTime) { mNextDay.setVisibility(View.VISIBLE); } else { mNextDay.setVisibility(View.INVISIBLE); } } }
From source file:cn.tycoon.lighttrans.fileManager.AbstractFilePickerActivity.java
@Override @SuppressWarnings("unchecked") protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_filepicker); Intent intent = getIntent(); if (intent != null) { startPath = intent.getStringExtra(EXTRA_START_PATH); mode = intent.getIntExtra(EXTRA_MODE, mode); allowCreateDir = intent.getBooleanExtra(EXTRA_ALLOW_CREATE_DIR, allowCreateDir); allowMultiple = intent.getBooleanExtra(EXTRA_ALLOW_MULTIPLE, allowMultiple); }//ww w .ja va2 s. c o m FragmentManager fm = getSupportFragmentManager(); AbstractFilePickerFragment<T> fragment = (AbstractFilePickerFragment<T>) fm.findFragmentByTag(TAG); if (fragment == null) { fragment = getFragment(startPath, mode, allowMultiple, allowCreateDir); } if (fragment != null) { fm.beginTransaction().replace(R.id.fragment, fragment, TAG).commit(); } // Default to cancelled setResult(Activity.RESULT_CANCELED); }
From source file:com.binoy.vibhinna.CustomIntentService.java
/** * You should not override this method for your IntentService. Instead, * override {@link #onHandleIntent}, which the system calls when the * IntentService receives a start request. * /*from ww w.j ava 2 s . c o m*/ * @see android.app.Service#onStartCommand */ @Override public int onStartCommand(Intent intent, int flags, int startId) { ContentValues values = new ContentValues(); if (intent.getIntExtra(VibhinnaService.TASK_TYPE, -1) == VibhinnaService.TASK_TYPE_NEW_VFS) values.put(DatabaseHelper.TASK_VS, VibhinnaUtils .avoidDuplicateFile(new File(intent.getStringExtra(VibhinnaService.FOLDER_PATH))).getName()); else values.put(DatabaseHelper.TASK_VS, new File(intent.getStringExtra(VibhinnaService.FOLDER_PATH)).getName()); values.put(DatabaseHelper.TASK_TYPE, intent.getIntExtra(VibhinnaService.TASK_TYPE, -1)); values.put(DatabaseHelper.TASK_STATUS, TasksAdapter.TASK_STATUS_WAITING); values.put(DatabaseHelper.TASK_MESSAGE, getString(R.string.task_message_waiting)); mLocalBroadcastManager = LocalBroadcastManager.getInstance(this); tasksUpdatedIntent = new Intent(); tasksUpdatedIntent.setAction(VibhinnaService.ACTION_TASK_QUEUE_UPDATED); mLocalBroadcastManager.sendBroadcast(tasksUpdatedIntent); vfsListUpdatedIntent = new Intent(VibhinnaService.ACTION_VFS_LIST_UPDATED); long id = Long .parseLong(getContentResolver().insert(TasksProvider.CONTENT_URI, values).getLastPathSegment()); intent.putExtra(BaseColumns._ID, id); onStart(intent, startId); return mRedelivery ? START_REDELIVER_INTENT : START_NOT_STICKY; }
From source file:com.droid080419.droid080419.elevenfifty_nine.EditTaskActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_alt_add_task); //get CalendarData to be updated Intent intent = getIntent(); int position = intent.getIntExtra(CalendarViewActivity.data_holder, -1); dat = CalendarGlobals.eventsList.get(position); //getting views eName = (EditText) findViewById(R.id.eventName); eDesc = (EditText) findViewById(R.id.description); eStartDate = (TextView) findViewById(R.id.startDate); eStartTime = (TextView) findViewById(R.id.startTime); eEndDate = (TextView) findViewById(R.id.endDate); eEndTime = (TextView) findViewById(R.id.endTime); cAllDay = (CheckBox) findViewById(R.id.allDayBox); //getting fields from CalendarData startDate = dat.getStartDate();/*from w w w . j ava2s .com*/ endDate = dat.getEndDate(); startTime = dat.getStartDate(); endTime = dat.getEndDate(); name = dat.getName(); coords = new LatLng(dat.getLatitude(), dat.getLongitude()); //updating views with data eName.setText(name); eStartDate.setText(CalendarGlobals.stringDate(startDate)); eStartTime.setText(CalendarGlobals.stringTime(startTime)); eEndDate.setText(CalendarGlobals.stringDate(endDate)); eEndTime.setText(CalendarGlobals.stringTime(endTime)); sdf = new SimpleDateFormat("MMMM dd, yyyy - h:mm a"); }
From source file:com.kevelbreh.steamchat.activity.AuthenticationActivity.java
@Override protected void onNewIntent(Intent intent) { setIntent(intent);/*from w w w .j av a 2 s. c o m*/ switch (intent.getIntExtra("result", -500)) { // Login was successful! case Language.Result.OK: startActivity(new Intent(this, InteractionsActivity.class)); finish(); break; // Steam requires the user to provide the Steam Guard code emailed to their email address // registered on Steam. case Language.Result.ACCOUNT_LOGON_DENIED: setupGuardState(); break; // Some other error occurred. Display this to the user for their viewing. Possibly reset // the login screen. default: setupNormalState(); Toast.makeText(this, "Something went wrong.", Toast.LENGTH_LONG).show(); } }
From source file:com.irccloud.android.activity.QuickReplyActivity.java
@Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); cid = intent.getIntExtra("cid", -1); bid = intent.getIntExtra("bid", -1); to = intent.getStringExtra("to"); server = new ServersDataSource.Server(); server.cid = cid;/*from w w w .ja v a 2s. c om*/ setTitle("Reply to " + to + " (" + intent.getStringExtra("network") + ")"); }
From source file:eu.codebits.plasmas.services.PlayerService.java
@Override protected void onHandleIntent(Intent intent) { originalIntent = intent;//from w w w.jav a 2 s. c om //Log.d(TAG, "Starting player service"); if (alerts != null) { new PlayerTask().execute(intent.getIntExtra(PARAM_PLAYLIST_INDEX, alertsIndex)); } else { new PlayerTask().execute(intent.getIntExtra(PARAM_PLAYLIST_INDEX, playlistIndex)); } }
From source file:com.amfontai.cmput301asn1.NoteDetail.java
/** * On creation of the note, the {@link android.app.Activity} * gets the {@link ndroid.content.Intent} * passed to it by the parent window/* ww w . ja v a 2s . c o m*/ * and looks for an {@link mId} number to seach {@link NotesDb} for. * * If there is no ID in the intent, the ID defaults to -1, * and the entries are filled with the default: * * Subject: Blank, * Date: The current date, * Content: Blank * * @see android.app.Activity#onCreate(android.os.Bundle) */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_note_detail); // Show the Up button in the action bar. setupActionBar(); Intent intent = getIntent(); mId = intent.getIntExtra("com.amfontai.cmput301asn1.id", -1); Button date = (Button) findViewById(R.id.date); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); /* * If there is an ID in the intent, query the database and fill * the fields with the saved data. */ if (-1 != mId) { mNote = mDb.getNoteById(mId); EditText subject = (EditText) findViewById(R.id.subject); subject.setText(mNote.getSubject()); date.setText(mNote.getDate()); EditText content = (EditText) findViewById(R.id.content); content.setText(mNote.getContent()); } /* * If not, set the date to the current date and * leave the other fields blank */ else { date.setText(format.format(new Date())); mNote = new Note(); } }
From source file:com.carOCR.activity.OptionActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_option); Intent intent = getIntent(); m_iSelOptionPage = (int) intent.getIntExtra("OptionPage", OPTION_SELECTZOOM); selectOptionPage(m_iSelOptionPage);//from ww w . ja va 2 s .c om // helper = new MyDbHelper(this, DB_NAME, 1); }
From source file:com.beasty.transitionold.DetailActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_detail); Intent intent = getIntent(); if (intent != null) { title = intent.getStringExtra(EXTRA_TITLE); avatarUrl = intent.getStringExtra(EXTRA_AVATAR_URL); id = intent.getIntExtra(EXTRA_ID, 0); }//from w w w . j a va 2s. co m mapUi(); initValue(); }