List of usage examples for android.content Intent getStringExtra
public String getStringExtra(String name)
From source file:edu.mit.media.funf.configured.ConfiguredPipeline.java
@Override protected void onHandleIntent(Intent intent) { String action = intent.getAction(); if (ACTION_RELOAD.equals(action)) { reload();//from w w w .ja va2 s.c om } else if (ACTION_UPDATE_CONFIG.equals(action)) { String config = intent.getStringExtra(CONFIG); String configUrl = intent.getStringExtra(CONFIG_URL); String configFilePath = intent.getStringExtra(CONFIG_FILE); if (config != null) { updateConfig(config); } else if (configFilePath != null) { File file = new File(configFilePath); updateConfig(file); } else if (configUrl != null) { try { updateConfig(new URL(configUrl)); } catch (MalformedURLException e) { Log.e(TAG, "Unable to parse config url."); } } else { updateConfig(); } } else if (ACTION_UPLOAD_DATA.equals(action)) { uploadData(); } else if (ACTION_ARCHIVE_DATA.equals(action)) { archiveData(); } else if (ACTION_ENABLE.equals(action)) { setEnabled(true); } else if (ACTION_DISABLE.equals(action)) { setEnabled(false); } else if (Probe.ACTION_DATA.equals(action)) { onDataReceived(intent.getExtras()); } else if (Probe.ACTION_STATUS.equals(action)) { onStatusReceived(new Probe.Status(intent.getExtras())); } else if (Probe.ACTION_DETAILS.equals(action)) { onDetailsReceived(new Probe.Details(intent.getExtras())); } }
From source file:it.feio.android.omninotes.async.DataBackupIntentService.java
synchronized private void importData(Intent intent) { // Gets backup folder String backupName = intent.getStringExtra(INTENT_BACKUP_NAME); File backupDir = StorageHelper.getBackupDir(backupName); // Database backup importDB(backupDir);/*from w w w. j ava 2s. c om*/ // importNotes(backupDir); // Attachments backup importAttachments(backupDir); // Settings restore importSettings(backupDir); // Reminders restore resetReminders(); String title = getString(R.string.data_import_completed); String text = getString(R.string.click_to_refresh_application); createNotification(intent, this, title, text, backupDir); }
From source file:gov.nasa.arc.geocam.talk.service.TalkServer.java
@Override protected void onHandleIntent(Intent intent) { sharedPrefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); if (intent.getAction().contentEquals(TalkServerIntent.INTENT_SYNCHRONIZE.toString())) { handleSynchronizeIntent();/*from w w w . j a v a 2 s . c o m*/ } else if (intent.getAction().contentEquals(TalkServerIntent.INTENT_STORE_C2DM_ID.toString())) { String registrationId = intent.getStringExtra(TalkServerIntent.EXTRA_REGISTRATION_ID.toString()); handleStoreRegistrationIdIntent(registrationId); } else if (intent.getAction().contentEquals(TalkServerIntent.INTENT_PUSHED_MESSAGE.toString())) { String messageId = intent.getStringExtra(TalkServerIntent.EXTRA_MESSAGE_ID.toString()); handlePushedMessageIntent(messageId); } else if (intent.getAction().contentEquals(TalkServerIntent.INTENT_LOGIN.toString())) { handleLogin(); } }
From source file:it.feio.android.omninotes.async.DataBackupIntentService.java
synchronized private void exportData(Intent intent) { // Gets backup folder String backupName = intent.getStringExtra(INTENT_BACKUP_NAME); File backupDir = StorageHelper.getBackupDir(backupName); // Directory clean in case of previously used backup name StorageHelper.delete(this, backupDir.getAbsolutePath()); // Directory is re-created in case of previously used backup name (removed above) backupDir = StorageHelper.getBackupDir(backupName); // Database backup exportDB(backupDir);/*from w ww .ja va 2 s . c o m*/ // exportNotes(backupDir); // Attachments backup exportAttachments(backupDir); // Settings if (intent.getBooleanExtra(INTENT_BACKUP_INCLUDE_SETTINGS, true)) { exportSettings(backupDir); } // Notification of operation ended String title = getString(R.string.data_export_completed); String text = backupDir.getPath(); createNotification(intent, this, title, text, backupDir); }
From source file:net.olejon.mdapp.NotesEditActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == MEDICATION_REQUEST_CODE && data != null) { if (resultCode == RESULT_OK) { String name = data.getStringExtra("name"); String manufacturer = data.getStringExtra("manufacturer"); try { JSONObject patientMedicationJsonObject = new JSONObject( "{\"name\":\"" + name + "\",\"manufacturer\":\"" + manufacturer + "\"}"); mPatientMedicationsJsonArray.put(patientMedicationJsonObject); getMedications();// www . ja v a 2s . c om } catch (Exception e) { Log.e("NotesEditActivity", Log.getStackTraceString(e)); } } } }
From source file:com.dycody.android.idealnote.async.DataBackupIntentService.java
synchronized private void deleteData(Intent intent) { // Gets backup folder String backupName = intent.getStringExtra(INTENT_BACKUP_NAME); File backupDir = StorageHelper.getBackupDir(backupName); // Backup directory removal StorageHelper.delete(this, backupDir.getAbsolutePath()); String title = getString(com.dycody.android.idealnote.R.string.data_deletion_completed); String text = backupName + " " + getString(com.dycody.android.idealnote.R.string.deleted); createNotification(intent, this, title, text, backupDir); }
From source file:com.lovejoy777sarootool.rootool.fragments.BrowserFragment.java
private void initDirectory(Bundle savedInstanceState, Intent intent) { String defaultdir;/* w ww . j a v a2s . co m*/ if (savedInstanceState != null) { // get directory when you rotate your phone defaultdir = savedInstanceState.getString("location"); } else { try { File dir = new File(intent.getStringExtra(BrowserActivity.EXTRA_SHORTCUT)); if (dir.exists() && dir.isDirectory()) { defaultdir = dir.getAbsolutePath(); } else { if (dir.exists() && dir.isFile()) listItemAction(dir); // you need to call it when shortcut-dir not exists defaultdir = Settings.defaultdir; } } catch (Exception e) { defaultdir = Settings.defaultdir; } } File dir = new File(defaultdir); if (dir.exists() && dir.isDirectory()) navigateTo(dir.getAbsolutePath()); }
From source file:com.swetha.easypark.GetIndividualParkingSpotDetails.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.i("GetIndividualParkingSpotDetails", "Before Set ContentView"); mContext = this.getApplicationContext(); this.requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.listvacantparkingspots); Log.i("GetIndividualParkingSpotDetails", "After Set ContentView"); Intent thisIntent = getIntent(); parkingLotId = thisIntent.getStringExtra("individualParkingLotId"); fromTime = thisIntent.getLongExtra(GetParkingLots.FROMTIME, 0); toTime = thisIntent.getLongExtra(GetParkingLots.TOTIME, 0); Log.i("GetIndividualParkingSpotDetails", "After getting from intent" + fromTime + toTime + parkingLotId); /* Test Data//from ww w .j a va 2 s. co m * parkingSpotMapList = new ArrayList<LinkedHashMap<String, String>>(); LinkedHashMap<String, String> parkingSpotMap = new LinkedHashMap<String, String>(); parkingSpotMap.put("parkingspotid", parkingLotId); Log.i("GetIndividualParkingSpotDetails", "PArking lot id" +parkingLotId); parkingSpotMap.put("vacantspotdisplay", "A5"); LinkedHashMap<String, String> parkingSpotMap2 = new LinkedHashMap<String, String>(); parkingSpotMap2.put("parkingspotid", "2"); parkingSpotMap2.put("vacantspotdisplay", "A6"); parkingSpotMapList.add(parkingSpotMap); parkingSpotMapList.add(parkingSpotMap2);*/ new GetParkingSpotsFromWebService(this, fromTime, toTime).execute(); Log.i("GetIndividualParkingSpotDetails", "After adding to hashmap list"); btn_next = (Button) findViewById(R.id.single_selection_btn_first); btn_next.setClickable(true); btn_next.setFocusable(true); Log.i("GetIndividualParkingSpotDetails", "After firstbutton focussable"); btn_next.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { //ListView l = getListView(); //TextSelectedView l_v = (TextSelectedView)v; HashMap<String, String> hmap = parkingSpotMapList.get(mSelectedItem); Log.i("GetIndividualParkingSpotDetails", "The value of mSelectedItem:" + mSelectedItem); theParkingSpotName = hmap.get("vacantspotdisplay"); theParkingSpotId = hmap.get("parkingspotid"); Log.i("GetIndividualParkingSpotDetails", "The selected parking spot is " + theParkingSpotName); Log.i("GetIndividualParkingSpotDetails", "The selected parking spotid is " + theParkingSpotId); chk_default = (CheckBox) findViewById(R.id.single_selection_chkbox_default); new UpdateParkingSpotThroughWebService(GetIndividualParkingSpotDetails.this, theParkingSpotId, fromTime, toTime).execute(); } }); Log.i("GetIndividualParkingSpotDetails", "After settOnClickListener first button"); btn_back = (Button) findViewById(R.id.single_selection_btn_second); btn_back.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { //close the activity finish(); } }); Log.i("GetIndividualParkingSpotDetails", "After settOnClickListener second button"); chk_default = (CheckBox) findViewById(R.id.single_selection_chkbox_default); chk_default.setChecked(false); Log.i("GetIndividualParkingSpotDetails", "After checkbox"); //tv_ins = (TextView) this.findViewById(R.id.single_selection_chkbox_default_text); //tv_ins.setText("Test"); Log.i("GetIndividualParkingSpotDetails", "After textView end of oncreate"); }
From source file:net.olejon.mdapp.DiseasesAndTreatmentsSearchActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Connected? if (!mTools.isDeviceConnected()) { mTools.showToast(getString(R.string.device_not_connected), 1); finish();//from ww w . jav a2 s.co m return; } // Intent final Intent intent = getIntent(); mSearchLanguage = intent.getStringExtra("language"); final String searchString = intent.getStringExtra("string"); // Layout setContentView(R.layout.activity_diseases_and_treatments_search); // Toolbar mToolbar = (Toolbar) findViewById(R.id.diseases_and_treatments_search_toolbar); mToolbar.setTitle(getString(R.string.diseases_and_treatments_search_search) + ": \"" + searchString + "\""); setSupportActionBar(mToolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); // Progress bar mProgressBar = (ProgressBar) findViewById(R.id.diseases_and_treatments_search_toolbar_progressbar); mProgressBar.setVisibility(View.VISIBLE); // Spinner mSpinner = (Spinner) findViewById(R.id.diseases_and_treatments_search_spinner); ArrayAdapter<CharSequence> arrayAdapter; if (mSearchLanguage.equals("")) { arrayAdapter = ArrayAdapter.createFromResource(mContext, R.array.diseases_and_treatments_search_spinner_items_english, R.layout.activity_diseases_and_treatments_search_spinner_header); } else { arrayAdapter = ArrayAdapter.createFromResource(mContext, R.array.diseases_and_treatments_search_spinner_items_norwegian, R.layout.activity_diseases_and_treatments_search_spinner_header); } arrayAdapter.setDropDownViewResource(R.layout.activity_diseases_and_treatments_search_spinner_item); mSpinner.setAdapter(arrayAdapter); mSpinner.setOnItemSelectedListener(this); // Refresh mSwipeRefreshLayout = (SwipeRefreshLayout) findViewById( R.id.diseases_and_treatments_search_swipe_refresh_layout); mSwipeRefreshLayout.setColorSchemeResources(R.color.accent_blue, R.color.accent_green, R.color.accent_purple, R.color.accent_orange); mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { search(mSearchLanguage, searchString, false); } }); // Recycler view mRecyclerView = (RecyclerView) findViewById(R.id.diseases_and_treatments_search_cards); mRecyclerView.setHasFixedSize(true); mRecyclerView.setAdapter(new DiseasesAndTreatmentsSearchAdapter(mContext, new JSONArray(), "")); mRecyclerView.setLayoutManager(new LinearLayoutManager(mContext)); // Search search(mSearchLanguage, searchString, true); // Correct RequestQueue requestQueue = Volley.newRequestQueue(mContext); try { JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.GET, getString(R.string.project_website_uri) + "api/1/correct/?search=" + URLEncoder.encode(searchString, "utf-8"), new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject response) { try { final String correctSearchString = response.getString("correct"); if (!correctSearchString.equals("")) { new MaterialDialog.Builder(mContext) .title(getString(R.string.correct_dialog_title)) .content(Html.fromHtml(getString(R.string.correct_dialog_message) + ":<br><br><b>" + correctSearchString + "</b>")) .positiveText(getString(R.string.correct_dialog_positive_button)) .negativeText(getString(R.string.correct_dialog_negative_button)) .callback(new MaterialDialog.ButtonCallback() { @Override public void onPositive(MaterialDialog dialog) { ContentValues contentValues = new ContentValues(); contentValues.put( DiseasesAndTreatmentsSQLiteHelper.COLUMN_STRING, correctSearchString); SQLiteDatabase sqLiteDatabase = new DiseasesAndTreatmentsSQLiteHelper( mContext).getWritableDatabase(); sqLiteDatabase.delete(DiseasesAndTreatmentsSQLiteHelper.TABLE, DiseasesAndTreatmentsSQLiteHelper.COLUMN_STRING + " = " + mTools.sqe(searchString) + " COLLATE NOCASE", null); sqLiteDatabase.insert(DiseasesAndTreatmentsSQLiteHelper.TABLE, null, contentValues); sqLiteDatabase.close(); mToolbar.setTitle(getString( R.string.diseases_and_treatments_search_search) + ": \"" + correctSearchString + "\""); mProgressBar.setVisibility(View.VISIBLE); search(mSearchLanguage, correctSearchString, true); } }).contentColorRes(R.color.black).positiveColorRes(R.color.dark_blue) .negativeColorRes(R.color.black).show(); } } catch (Exception e) { Log.e("DiseasesAndTreatments", Log.getStackTraceString(e)); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { Log.e("DiseasesAndTreatments", error.toString()); } }); jsonObjectRequest.setRetryPolicy(new DefaultRetryPolicy(10000, DefaultRetryPolicy.DEFAULT_MAX_RETRIES, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT)); requestQueue.add(jsonObjectRequest); } catch (Exception e) { Log.e("DiseasesAndTreatments", Log.getStackTraceString(e)); } }
From source file:com.dycody.android.idealnote.async.DataBackupIntentService.java
synchronized private void importData(Intent intent) { // Gets backup folder String backupName = intent.getStringExtra(INTENT_BACKUP_NAME); File backupDir = StorageHelper.getBackupDir(backupName); // Database backup importDB(backupDir);//from w w w. j ava 2s . co m // importNotes(backupDir); // Attachments backup importAttachments(backupDir); // Settings restore importSettings(backupDir); // Reminders restore resetReminders(); String title = getString(com.dycody.android.idealnote.R.string.data_import_completed); String text = getString(com.dycody.android.idealnote.R.string.click_to_refresh_application); createNotification(intent, this, title, text, backupDir); }