List of usage examples for android.os Bundle getString
@Nullable
public String getString(@Nullable String key)
From source file:at.alladin.rmbt.android.fragments.result.QoSCategoryPagerFragment.java
@Override public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); //final Bundle args = getArguments(); if (savedInstanceState != null && savedInstanceState.containsKey(BUNDLE_QOS_RESULTS)) { try {// www .j a va 2s . c om setQoSResult(new QoSServerResultCollection( new JSONArray(savedInstanceState.getString(BUNDLE_QOS_RESULTS)))); setDetailType(DetailType.valueOf(savedInstanceState.getString(BUNDLE_DETAIL_TYPE))); } catch (JSONException e) { //e.printStackTrace(); } } //DetailType detailType = DetailType.valueOf(args.getString(ARG_DETAIL_TYPE)); pagerAdapter = new QoSCategoryPagerAdapter((RMBTMainActivity) getActivity(), handler, results); }
From source file:mx.itdurango.rober.siitdocentes.ActivityAlumnos.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_alumnos); //Se recibe un parametro llamado "resultado" el cual contiene el html de la pgina en cuestin Bundle bundle = getIntent().getExtras(); String resultado = bundle.getString("resultado"); //GridView que maneja el listado de alumnos lvAlumnos = (GridView) findViewById(R.id.lvAlumnos); //Spinner que controla el listado de unidades spn_unidad = (Spinner) findViewById(R.id.spn_unidad); //establece el evento que se llevar a cabo al seleccionar una unidad spn_unidad.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override/*from www . ja v a 2s . c o m*/ public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { unidad = position; cambiaCalificaciones(unidad); } @Override public void onNothingSelected(AdapterView<?> parent) { } }); //Parser que descompone el cdigo que se recibi como parmetro y llena los elementos de la vista llenaAlumnos(resultado); }
From source file:com.anstar.fieldwork.CaptureSignatureFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle b = getArguments(); if (b != null) { if (b.containsKey("cutomer")) { signtype = b.getString("cutomer"); }// w w w. ja v a2 s . co m if (b.containsKey("tech")) { signtype = b.getString("tech"); } if (b.containsKey(Const.Appointment_Id)) { a_id = b.getInt(Const.Appointment_Id); } } m_points = new ArrayList<>(); appointment_info = AppointmentModelList.Instance().getAppointmentById(a_id); }
From source file:com.khoahuy.phototag.HomeActivity.java
@Override protected void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); mCurrentPhotoPath = savedInstanceState.getString("mCurrentPhotoPath"); Intent intent = getIntent();// w ww. j av a 2 s .c o m if (intent != null && Intent.EXTRA_UID.equals(intent.getAction())) { setIntent(null); } }
From source file:com.anstar.fieldwork.CaptureSignatureActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.capture_siganture); ActionBar action = getSupportActionBar(); action = getSupportActionBar();//from w ww . j a v a 2 s .c o m // action.setTitle("Signature"); action.setTitle(Html .fromHtml("<font color='" + getString(R.string.header_text_color) + "'>Capture Signature</font>")); action.setHomeButtonEnabled(true); action.setDisplayHomeAsUpEnabled(true); Bundle b = getIntent().getExtras(); if (b != null) { if (b.containsKey("cutomer")) { signtype = b.getString("cutomer"); } if (b.containsKey("tech")) { signtype = b.getString("tech"); } if (b.containsKey(Const.Appointment_Id)) { a_id = b.getInt(Const.Appointment_Id); } } appointment_info = AppointmentModelList.Instance().getAppointmentById(a_id); llSignCanvas = (LinearLayout) findViewById(R.id.llSignCanvas); txtSignType = (TextView) findViewById(R.id.txtSignatureType); txtSignName = (TextView) findViewById(R.id.txtSignName); txtLicInfo = (TextView) findViewById(R.id.txtSignLic); btnCancel = (Button) findViewById(R.id.btnCancel); btnClear = (Button) findViewById(R.id.btnClear); btnSave = (Button) findViewById(R.id.btnSave); m_points = new ArrayList<SignaturePoints>(); loadView load = new loadView(); load.execute(); btnCancel.setOnClickListener(this); btnClear.setOnClickListener(this); btnSave.setOnClickListener(this); }
From source file:com.desarrollodroide.youtubeincardlibs.extrasyoutube.YouTubeFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { //Picasso.with(getActivity()).setDebugging(true); View rootView = inflater.inflate(R.layout.demo_extras_fragment_picasso, container, false); // restore the playlist after an orientation change if (savedInstanceState != null) { mPlaylist = new Gson().fromJson(savedInstanceState.getString(PLAYLIST_KEY), Playlist.class); }/*from w w w.j a v a 2 s . c o m*/ // ensure the adapter and listview are initialized if (mPlaylist != null) { mCardArrayAdapter = null; cards.clear(); mListCount = 0; mPlaylist = null; } // start loading the first page of our playlist new GetYouTubePlaylistAsyncTask() { @Override public EtagCache getEtagCache() { return mEtagCache; } @Override public void onPostExecute(JSONObject result) { handlePlaylistResult(result); } }.execute(YOUTUBE_PLAYLIST, null); return rootView; }
From source file:com.geozen.demo.foursquare.jiramot.Util.java
/** * Connect to an HTTP URL and return the response as a string. * /*from w w w. ja v a 2s. c o m*/ * Note that the HTTP method override is used on non-GET requests. (i.e. * requests are made as "POST" with method specified in the body). * * @param url * - the resource to open: must be a welformed URL * @param method * - the HTTP method to use ("GET", "POST", etc.) * @param params * - the query parameter for the URL (e.g. access_token=foo) * @return the URL contents as a String * @throws MalformedURLException * - if the URL format is invalid * @throws IOException * - if a network problem occurs */ public static String openUrl(String url, String method, Bundle params) throws MalformedURLException, IOException { // random string as boundary for multi-part http post String strBoundary = "3i2ndDfv2rTHiSisAbouNdArYfORhtTPEefj3q2f"; String endLine = "\r\n"; OutputStream os; if (method.equals("GET")) { url = url + "?" + encodeUrl(params); } Log.d("Foursquare-Util", method + " URL: " + url); HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection(); conn.setRequestProperty("User-Agent", System.getProperties().getProperty("http.agent") + " GeoZen"); if (!method.equals("GET")) { Bundle dataparams = new Bundle(); for (String key : params.keySet()) { if (params.getByteArray(key) != null) { dataparams.putByteArray(key, params.getByteArray(key)); } } // use method override if (!params.containsKey("method")) { params.putString("method", method); } if (params.containsKey("access_token")) { String decoded_token = URLDecoder.decode(params.getString("access_token")); params.putString("access_token", decoded_token); } conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "multipart/form-data;boundary=" + strBoundary); conn.setDoOutput(true); conn.setDoInput(true); conn.setRequestProperty("Connection", "Keep-Alive"); conn.connect(); os = new BufferedOutputStream(conn.getOutputStream()); os.write(("--" + strBoundary + endLine).getBytes()); os.write((encodePostBody(params, strBoundary)).getBytes()); os.write((endLine + "--" + strBoundary + endLine).getBytes()); if (!dataparams.isEmpty()) { for (String key : dataparams.keySet()) { os.write(("Content-Disposition: form-data; filename=\"" + key + "\"" + endLine).getBytes()); os.write(("Content-Type: content/unknown" + endLine + endLine).getBytes()); os.write(dataparams.getByteArray(key)); os.write((endLine + "--" + strBoundary + endLine).getBytes()); } } os.flush(); } String response = ""; try { response = read(conn.getInputStream()); } catch (FileNotFoundException e) { // Error Stream contains JSON that we can parse to a FB error response = read(conn.getErrorStream()); } return response; }
From source file:com.joefernandez.irrduino.android.remote.IrrduinoRemoteActivity.java
/** Called when the activity is first created. */ @Override/*from w ww. j ava 2 s . com*/ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Spinner spinnerRunTime = (Spinner) findViewById(R.id.spinner_runtimes); spinnerRunTime.setAdapter(getSpinnerAdapter()); spinnerRunTime.setOnItemSelectedListener(new RuntimeItemSelectedListener()); statusText = (EditText) findViewById(R.id.status_text); Bundle extras = getIntent().getExtras(); if (extras != null) { String value = extras.getString("taskResult"); if (value != null && value.length() > 0) { statusText.setText(value); } } Button allOff = (Button) findViewById(R.id.button_all_stop); allOff.setOnClickListener(new OnClickListener() { public void onClick(View v) { statusText.setText("Sending..."); new IrrduinoCommandTask().execute(getControllerAddress() + CMD_ALL_OFF); } }); Button zone1 = (Button) findViewById(R.id.button_garden); zone1.setOnClickListener(new OnClickListener() { public void onClick(View v) { sendZoneRunCommand(ZONE_GARDEN, zoneRunTime); } }); Button zone2 = (Button) findViewById(R.id.button_backyard_lawn_1); zone2.setOnClickListener(new OnClickListener() { public void onClick(View v) { sendZoneRunCommand(ZONE_BACK_LAWN1, zoneRunTime); } }); Button zone3 = (Button) findViewById(R.id.button_backyard_lawn_2); zone3.setOnClickListener(new OnClickListener() { public void onClick(View v) { sendZoneRunCommand(ZONE_BACK_LAWN2, zoneRunTime); } }); Button zone4 = (Button) findViewById(R.id.button_backyard_lawn_3); zone4.setOnClickListener(new OnClickListener() { public void onClick(View v) { sendZoneRunCommand(ZONE_BACK_LAWN3, zoneRunTime); } }); Button zone5 = (Button) findViewById(R.id.button_patio_plants); zone5.setOnClickListener(new OnClickListener() { public void onClick(View v) { sendZoneRunCommand(ZONE_PATIO, zoneRunTime); } }); // Zone 6 (backyard left side flower beds, is not hooked up) // Button zone6 = (Button) findViewById(R.id.button_patio_plants); // zone6.setOnClickListener(new OnClickListener() { // public void onClick(View v) { // sendZoneRunCommand(ZONE_FLOWER_BED, zoneRunTime); // } // }); Button zone7 = (Button) findViewById(R.id.button_frontyard_lawn_1); zone7.setOnClickListener(new OnClickListener() { public void onClick(View v) { sendZoneRunCommand(ZONE_FRONT_LAWN1, zoneRunTime); } }); Button zone8 = (Button) findViewById(R.id.button_frontyard_lawn_2); zone8.setOnClickListener(new OnClickListener() { public void onClick(View v) { sendZoneRunCommand(ZONE_FRONT_LAWN2, zoneRunTime); } }); // Request global status from controller (run *last*) requestSystemStatus(); }
From source file:com.google.zxing.client.android.history.HistoryActivity.java
@Override protected void onCreate(Bundle icicle) { super.onCreate(icicle); pegaScreenResolution();/* ww w . j av a 2s . c o m*/ this.historyManager = new HistoryManager(this); adapter = new HistoryItemAdapter(this); setListAdapter(adapter); View listview = getListView(); registerForContextMenu(listview); originalTitle = getTitle(); Intent intent = getIntent(); Bundle bundle = intent.getExtras(); String txt = bundle.getString("envia_dados"); if (txt.equals("envia_dados")) { Toast.makeText(this, R.string.toast_envia_dado_acima, Toast.LENGTH_LONG).show(); } }
From source file:net.potterpcs.recipebook.ImporterActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); data = ((RecipeBook) getApplication()).getData(); // Read the location from the Bundle's state, if any, or get it // straight from the Intent. String path;/*w ww . ja v a2 s . co m*/ if (savedInstanceState != null) { path = savedInstanceState.getString(IMPORT_PATH_EXTRA); } else { path = getIntent().getDataString(); } // All of the work will be done by the worker thread, // because the recipebook file may be online, and 3.0+ // apps can't access the network in the UI thread. try { importedRecipes = new DownloadHelperTask(this).execute(path).get(); } catch (InterruptedException e) { importedRecipes = new ArrayList<Recipe>(); } catch (ExecutionException e) { importedRecipes = new ArrayList<Recipe>(); } }