List of usage examples for android.os Bundle get
@Nullable
public Object get(String key)
From source file:com.lvlstudios.android.gtmessage.C2DMReceiver.java
@Override public void onMessage(Context context, Intent intent) { Bundle extras = intent.getExtras(); if (extras != null) { String url = (String) extras.get("url"); String title = (String) extras.get("title"); String sel = (String) extras.get("sel"); String debug = (String) extras.get("debug"); Log.d(TAG, String.format("C2DMReceiver.onMessage: url='%s', title='%s', sel='%s'", url, title, sel)); if (debug != null) { // server-controlled debug - the server wants to know we received the message, and when. // This is not user-controllable, // we don't want extra traffic on the server or phone. Server may // turn this on for a small percentage of requests or for users // who report issues. DefaultHttpClient client = new DefaultHttpClient(); HttpGet get = new HttpGet(AppEngineClient.BASE_URL + "/debug?id=" + extras.get("collapse_key")); // No auth - the purpose is only to generate a log/confirm delivery // (to avoid overhead of getting the token) try { client.execute(get);//from w w w. jav a 2s . com } catch (ClientProtocolException e) { // ignore } catch (IOException e) { // ignore } } if (title != null && url != null && url.startsWith("http")) { SharedPreferences settings = Prefs.get(context); Intent launchIntent = LauncherUtils.getLaunchIntent(context, title, url, sel); // Notify and optionally start activity if (settings.getBoolean("launchBrowserOrMaps", true) && launchIntent != null) { try { context.startActivity(launchIntent); LauncherUtils.playNotificationSound(context); } catch (ActivityNotFoundException e) { return; } } else { if (sel != null && sel.length() > 0) { // have selection LauncherUtils.generateNotification(context, sel, context.getString(R.string.copied_desktop_clipboard), launchIntent); } else { LauncherUtils.generateNotification(context, url, title, launchIntent); } } // Record history (for link/maps only) if (launchIntent != null && launchIntent.getAction().equals(Intent.ACTION_VIEW)) { HistoryDatabase.get(context).insertHistory(title, url); } } } }
From source file:com.binil.pushnotification.GcmIntentService.java
@Override public void onMessageReceived(String from, Bundle extras) { Log.i(TAG, "from = " + from); for (String key : extras.keySet()) { Log.i(TAG, "key = " + key + ", value = " + extras.get(key)); }//from w w w . j a v a 2s. c o m sendNotification(extras); Log.i(TAG, "Received: " + extras.toString()); }
From source file:edu.cwru.apo.Login.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.login);//from w ww . j ava 2s .c om Bundle extras = getIntent().getExtras(); if (extras.get("msg") != null) { Toast message = Toast.makeText(getApplicationContext(), extras.getString("msg"), Toast.LENGTH_SHORT); message.show(); } // map the login button to the layout login_btn = (Button) findViewById(R.id.login); login_btn.setOnClickListener(this); // map the forgot password button to the layout forgot_btn = (Button) findViewById(R.id.forgot_password); forgot_btn.setOnClickListener(this); username = (EditText) findViewById(R.id.username); password = (EditText) findViewById(R.id.password); }
From source file:com.costrella.cemetery.activity.MapActivity.java
private void goToSector() { Intent intent = getIntent();/* w w w .ja v a 2 s. com*/ Bundle bundle = intent.getExtras(); if (bundle != null) { LatLng latLng = (LatLng) bundle.get("personLatLng"); String name = (String) bundle.get("personName"); String deathDate = (String) bundle.get("personDeathDate"); mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 18)); sector = mMap.addMarker(new MarkerOptions().position(latLng).title(name).snippet(deathDate) .icon(BitmapDescriptorFactory.fromResource(R.drawable.arrow)).infoWindowAnchor(0.5f, 0.5f)); } }
From source file:com.syncano.gcmsample.MyGcmListenerService.java
/** * Called when message is received.//ww w . java 2 s . c om * * @param from SenderID of the sender. * @param data Data bundle containing message data as key/value pairs. * For Set of keys use data.keySet(). */ @Override public void onMessageReceived(String from, Bundle data) { StringBuilder sb = new StringBuilder(); for (String key : data.keySet()) { sb.append(key); sb.append(':'); sb.append(data.get(key).toString()); sb.append(' '); } String receivedData = sb.toString(); Log.d(TAG, "From: " + from); Log.d(TAG, "Message: " + receivedData); showNotification(receivedData); }
From source file:no.uka.findmyapp.android.rest.client.RestIntentService.java
@Override protected void onHandleIntent(Intent intent) { Log.v(debug, "Inside onHandleIntent"); Log.v(debug, "" + new Date() + ", In onHandleIntent for thread id = " + Thread.currentThread().getId()); Bundle bundle = intent.getExtras(); Log.v(debug, "onHandleIntent bundle recived"); ServiceModel serviceModel = (ServiceModel) bundle.get(IntentMessages.SERVICE_MODEL_PACKAGE); Credentials credentials = (Credentials) bundle.get(IntentMessages.CREDENTIALS_PACKAGE); createRestProcessor(credentials);// www . ja v a 2 s . c o m String userToken = ""; if (bundle.containsKey(IntentMessages.USER_TOKEN_PACKAGE)) { userToken = (String) bundle.get(IntentMessages.USER_TOKEN_PACKAGE); } Log.v(debug, "onHandleIntent: Sending " + serviceModel + " to the rest processor"); restProcessor.callRest(serviceModel, userToken); Log.v(debug, "" + new Date() + ", This thread is waked up."); }
From source file:com.example.postory.ImagePagerActivity.java
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.ac_image_pager); Bundle bundle = getIntent().getExtras(); assert bundle != null; PhotoInfo result = (PhotoInfo) bundle.get("IMAGES"); int pagerPosition = bundle.getInt("postion"); location = result.getlocation_name(); url = result.getbigger_photo_url();/*from w ww. j a v a 2 s .c o m*/ author = result.getauthor(); if (savedInstanceState != null) { pagerPosition = savedInstanceState.getInt(STATE_POSITION); } options = new DisplayImageOptions.Builder().showStubImage(R.drawable.ic_stub) .showImageForEmptyUri(R.drawable.ic_empty).showImageOnFail(R.drawable.ic_error).cacheInMemory() .cacheOnDisc().build(); ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext()) .defaultDisplayImageOptions(options).build(); imageLoader.init(config); pager = (ViewPager) findViewById(R.id.pager); pager.setAdapter(new ImagePagerAdapter(url)); pager.setCurrentItem(pagerPosition); }
From source file:com.eyekabob.CheckinSearchList.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.adlistactivity); VenueListAdapter adapter = new VenueListAdapter(getApplicationContext()); ListView lv = (ListView) findViewById(R.id.adList); lv.setOnItemClickListener(listItemListener); lv.setAdapter(adapter);//from w w w . j av a2 s. c o m Bundle extras = (Bundle) getIntent().getExtras(); Location location = null; if (extras != null) { location = (Location) extras.get("location"); } if (location == null) { location = EyekabobHelper.getLocation(this); } Map<String, String> params = new HashMap<String, String>(); params.put("ll", location.getLatitude() + "," + location.getLongitude()); params.put("radius", "3000"); // 3km seems like a reasonable checkin distance. String uri = EyekabobHelper.Foursquare.getUri("venues/search", params); new JSONRequestTask().execute(uri); }
From source file:com.example.ajklen.lostandfound.ContentFragment.java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); Bundle args = getArguments(); if (args != null) { final String LINK = "http://138.51.236.172/project-118/"; if (args.get(KEY_TITLE).equals("Lost")) { new DownloadTask(this).execute(LINK + "lost_items.php?user_id=1"); }/*w w w . j av a 2 s . c o m*/ /*TextView title = (TextView) view.findViewById(R.id.item_title); title.setText("Title: " + args.getCharSequence(KEY_TITLE)); int indicatorColor = args.getInt(KEY_INDICATOR_COLOR); TextView indicatorColorView = (TextView) view.findViewById(R.id.item_indicator_color); indicatorColorView.setText("Indicator: #" + Integer.toHexString(indicatorColor)); indicatorColorView.setTextColor(indicatorColor); int dividerColor = args.getInt(KEY_DIVIDER_COLOR); TextView dividerColorView = (TextView) view.findViewById(R.id.item_divider_color); dividerColorView.setText("Divider: #" + Integer.toHexString(dividerColor)); dividerColorView.setTextColor(dividerColor);*/ } }
From source file:com.example.gcmandroid.GcmService.java
@Override public void onMessageReceived(String from, Bundle data) { JSONObject jsonObject = new JSONObject(); Set<String> keys = data.keySet(); for (String key : keys) { try {/*from ww w. j a va2 s . c o m*/ jsonObject.put(key, data.get(key)); } catch (JSONException e) { e.printStackTrace(); } } try { sendNotification("Received: " + jsonObject.toString(5)); } catch (JSONException e) { e.printStackTrace(); } }