List of usage examples for android.os Bundle containsKey
public boolean containsKey(String key)
From source file:com.cloudbees.gasp.activity.GaspRESTLoaderActivity.java
@Override public Loader<RESTLoader.RESTResponse> onCreateLoader(int id, Bundle args) { if (args != null && args.containsKey(ARGS_URI) && args.containsKey(ARGS_PARAMS)) { Uri action = args.getParcelable(ARGS_URI); Bundle params = args.getParcelable(ARGS_PARAMS); return new RESTLoader(this, RESTLoader.HTTPVerb.GET, action, params); }/*from www . j ava 2 s .co m*/ return null; }
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 {//from w w w. j av a 2 s.c o m 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:de.golov.zeitgeistreich.ZeitGeistReichActivity.java
/** Called when the activity is first created. */ @Override//from w w w .jav a 2s . c o m public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); final ImageView imagePreview = (ImageView) findViewById(R.id.ImagePreview); Intent intent = getIntent(); Bundle extras = intent.getExtras(); Uri mImageUri = null; if (Intent.ACTION_SEND.equals(intent.getAction()) && extras != null) { if (extras.containsKey(Intent.EXTRA_STREAM)) { mImageUri = (Uri) extras.getParcelable(Intent.EXTRA_STREAM); if (mImageUri != null) { int origId = Integer.parseInt(mImageUri.getLastPathSegment()); Bitmap bitmap = MediaStore.Images.Thumbnails.getThumbnail(getContentResolver(), origId, MediaStore.Images.Thumbnails.MINI_KIND, (BitmapFactory.Options) null); imagePreview.setImageBitmap(bitmap); } } } ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_dropdown_item_1line, tag_suggests); final MultiAutoCompleteTextView textView = (MultiAutoCompleteTextView) findViewById(R.id.TagEditView); textView.setAdapter(adapter); textView.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer()); final Button button = (Button) findViewById(R.id.ZeitgeistSubmit); button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { submitImage(textView.getText().toString()); } }); }
From source file:com.openerp.addons.note.AddFollowerFragment.java
public void onStart() { super.onStart(); Bundle bundle = getArguments(); if (bundle.containsKey("res_id")) { record_id = bundle.getInt("res_id"); message = bundle.getString("message"); }/*from w w w. jav a 2 s .c om*/ getPartnersFromLocal(); }
From source file:com.meetingninja.csse.user.ProfileFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { pageView = inflater.inflate(R.layout.fragment_profile, container, false); setupViews(pageView);/*from ww w . ja v a 2s . c o m*/ session = SessionManager.getInstance(); Bundle extras = getArguments(); displayedUser = new User(); if (extras != null && extras.containsKey(Keys.User.PARCEL)) { displayedUser = ((UserParcel) extras.getParcelable(Keys.User.PARCEL)).getUser(); try { System.out.println(JsonUtils.getObjectMapper().writeValueAsString(displayedUser)); } catch (JsonProcessingException e) { // TODO Auto-generated catch block e.printStackTrace(); } } else { Log.v(TAG, "Displaying Current User"); displayedUser.setID(session.getUserID()); } if (extras != null && extras.containsKey("notMine")) { menu = R.menu.menu_profile; } else { menu = R.menu.menu_view_profile; } setHasOptionsMenu(true); fetchUserInfo(displayedUser.getID()); return pageView; }
From source file:com.facebook.android.Util.java
/** * Connect to an HTTP URL and return the response as a string. * * 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/*from w w w . j av a2 s.c o m*/ * @throws MalformedURLException - if the URL format is invalid * @throws IOException - if a network problem occurs */ @Deprecated public static String openUrl(String url, String method, Bundle params) throws 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); } Utility.logd("Facebook-Util", method + " URL: " + url); HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection(); conn.setRequestProperty("User-Agent", System.getProperties().getProperty("http.agent") + " FacebookAndroidSDK"); if (!method.equals("GET")) { Bundle dataparams = new Bundle(); for (String key : params.keySet()) { Object parameter = params.get(key); if (parameter instanceof byte[]) { dataparams.putByteArray(key, (byte[]) parameter); } } // 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()); try { 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(); } finally { os.close(); } } 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:cc.softwarefactory.lokki.android.services.LocationService.java
@Override public int onStartCommand(Intent intent, int flags, int startId) { Log.e(TAG, "onStartCommand invoked"); if (intent == null) { return START_STICKY; }/* w w w .j a v a2s . c om*/ Bundle extras = intent.getExtras(); if (extras == null) { return START_STICKY; } if (extras.containsKey(RUN_1_MIN)) { Log.e(TAG, "onStartCommand RUN_1_MIN"); setTemporalTimer(); } else if (extras.containsKey(ALARM_TIMER)) { Log.e(TAG, "onStartCommand ALARM_TIMER"); stopSelf(); } return START_STICKY; }
From source file:com.facebook.android.library.Util.java
/** * Connect to an HTTP URL and return the response as a string. * /* w w w. j a va2 s.c om*/ * 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); } Util.logd("Facebook-Util", method + " URL: " + url); HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection(); conn.setRequestProperty("User-Agent", System.getProperties().getProperty("http.agent") + " FacebookAndroidSDK"); if (!method.equals("GET")) { Bundle dataparams = new Bundle(); for (String key : params.keySet()) { if (params.get(key) instanceof byte[]) { 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:org.mifos.androidclient.main.LastRepaymentReportActivity.java
@Override public void onCreate(Bundle bundle) { super.onCreate(bundle); setContentView(R.layout.last_repayment_report); if (bundle != null && bundle.containsKey(CustomersData.BUNDLE_KEY)) { mLastRepayments = Arrays.asList((LastRepayment[]) bundle.getSerializable(LastRepayment.BUNDLE_KEY)); }/*from w ww .j a va 2s.c o m*/ mFilterBox = (EditText) findViewById(R.id.lastRepayment_filter_box); mLastLoanList = (ExpandableListView) findViewById(R.id.lastRepayment_list); mContent = (LinearLayout) findViewById(R.id.lastRepayment_content); mMessage = (TextView) findViewById(R.id.lastRepayment_noDataMessage); mCustomerService = new CustomerService(this); }
From source file:de.golov.zeitgeistreich.ZeitGeistReichActivity.java
protected void submitImage(String tags) { Intent intent = getIntent();/*from w w w . jav a 2 s. co m*/ Bundle extras = intent.getExtras(); Uri mImageUri = null; File mFilename = null; if (Intent.ACTION_SEND.equals(intent.getAction()) && extras != null) { if (extras.containsKey(Intent.EXTRA_STREAM)) { mImageUri = (Uri) extras.getParcelable(Intent.EXTRA_STREAM); if (mImageUri != null) { Cursor cursor = getContentResolver().query(mImageUri, null, null, null, null); if (cursor.moveToFirst()) { mFilename = new File(cursor.getString(cursor.getColumnIndexOrThrow(ImageColumns.DATA))); } cursor.close(); if (mFilename != null) { ZeitGeistReichUploaderTask task = new ZeitGeistReichUploaderTask(); ZeitGeistObject o = new ZeitGeistObject(mFilename, tags); task.execute(o); } } } } }