List of usage examples for android.os Bundle putString
public void putString(@Nullable String key, @Nullable String value)
From source file:com.digitalbuana.smiles.ui.ContactAdd.java
@Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putString(SAVED_ACCOUNT, AccountManager.getInstance().getAccountKu()); outState.putString(SAVED_USER, userView.getText().toString()); outState.putString(SAVED_NAME, nameView.getText().toString()); }
From source file:com.feedhenry.sdk.api.FHAuthRequest.java
private void startAuthIntent(final JSONObject pJsonRes, final FHActCallback pCallback) throws Exception { String url = pJsonRes.getString("url"); FHLog.v(LOG_TAG, "Got oAuth url back, url = " + url + ". Open it in new intent."); Bundle data = new Bundle(); data.putString("url", url); data.putString("title", "Login"); Intent i = new Intent(mPresentingActivity, FHOAuthIntent.class); mReceiver = new OAuthURLRedirectReceiver(pCallback); IntentFilter filter = new IntentFilter(FHOAuthWebView.BROADCAST_ACTION_FILTER); mPresentingActivity.registerReceiver(mReceiver, filter); i.putExtra("settings", data); mPresentingActivity.startActivity(i); }
From source file:com.adkdevelopment.e_contact.ui.presenters.ProfilePresenter.java
/** * Retrieves profile photos and saves the profile and photos * to the database//from www. ja va2 s . c o m * Updates View on completion * @param profileRealm for which photos are required */ private void getPhotos(final ProfileRealm profileRealm) { GraphRequest request = new GraphRequest(mAccessToken, "/" + profileRealm.getId() + PARAM_PHOTOS, null, HttpMethod.GET, new GraphRequest.Callback() { public void onCompleted(GraphResponse response) { RealmList<ProfilePhotosRealm> photosRealms = new RealmList<>(); try { JSONArray photos = response.getJSONObject().getJSONArray(RESP_DATA); for (int i = 0, n = photos.length(); i < n; i++) { ProfilePhotosRealm photoRealm = new ProfilePhotosRealm(); JSONObject object = photos.getJSONObject(i); String id = object.getString(RESP_ID); if (object.has(RESP_NAME)) { String description = object.getString(RESP_NAME); photoRealm.setDescription(description); } if (object.has(RESP_CREATED)) { String createdTime = object.getString(RESP_CREATED); photoRealm.setCreatedTime(createdTime); } if (object.has(RESP_IMAGE)) { String link = object.getJSONArray(RESP_IMAGE).getJSONObject(0) .getString(RESP_SOURCE); photoRealm.setUrl(link); } photoRealm.setId(id); photosRealms.add(photoRealm); } } catch (JSONException e) { Log.e(TAG, "Error: " + e); } profileRealm.setPhotos(photosRealms); getMvpView().showData(profileRealm); // add to the database and confirm that is was successfully // added to the db while debugging mSubscription .add(mDataManager.saveProfile(profileRealm).subscribe(new Subscriber<Boolean>() { @Override public void onCompleted() { Log.d(TAG, "onCompleted: "); } @Override public void onError(Throwable e) { Log.e(TAG, "Error: " + e); } @Override public void onNext(Boolean aBoolean) { Log.d(TAG, "onNext: " + aBoolean); } })); } }); Bundle parameters = new Bundle(); parameters.putString(PARAM_FIELDS, TextUtils.join(",", new String[] { RESP_ID, RESP_NAME, RESP_LINK, RESP_URL, RESP_PICTURE, RESP_IMAGE })); request.setParameters(parameters); request.executeAsync(); }
From source file:com.nloko.android.syncmypix.facebook.FacebookApi.java
private void setHighResPhotos(String uids, Map<String, SocialNetworkUser> userMap) throws ClientProtocolException, IOException { if (uids == null) { throw new IllegalArgumentException("uids"); }/*from w w w . j ava 2 s . com*/ Map<String, String> params = new HashMap<String, String>(); Bundle bparams = new Bundle(); bparams.putString("method", "fql.query"); bparams.putString("query", "select src_big,owner from photo where pid in (select cover_pid from album where name=\"Profile Pictures\" and owner IN (SELECT uid2 FROM friend WHERE uid1 = me()))"); String fqlResponse = client.request(bparams); /*String pid_query = "SELECT owner, cover_pid, aid, name FROM album " + "WHERE owner IN (%s) AND " + "name IN (\"Profile Pictures\")"; pid_query = String.format(pid_query, uids); String photo = "SELECT owner, src_big FROM photo " + "WHERE pid IN (SELECT cover_pid FROM #query1) ";*/ SocialNetworkUser user = null; String url = null; String uid = null; try { /*JSONObject queries = new JSONObject(); queries.put("query1", pid_query); queries.put("query2", photo); params.put("queries", queries.toString());*/ FacebookJSONResponse jr = new FacebookJSONResponse(0, fqlResponse);//(FacebookJSONResponse) client.getData("Fql.multiquery", params); JSONArray array = new JSONArray(jr.data); if (array.length() > 1) { JSONObject obj;// = array.getJSONObject(1); //array = obj.getJSONArray("fql_result_set"); for (int i = 0; i < array.length(); i++) { obj = array.getJSONObject(i); uid = obj.getString("owner"); if (userMap.containsKey(uid)) { url = obj.getString("src_big"); user = userMap.get(uid); user.picUrl = url; } } } } catch (JSONException e) { Log.e(null, android.util.Log.getStackTraceString(e)); } }
From source file:com.android.providers.contacts.ContactsSyncAdapter.java
public static void updateSubscribedFeeds(ContentResolver cr, String account) { Set<String> feedsToSync = Sets.newHashSet(); feedsToSync.add(getGroupsFeedForAccount(account)); addContactsFeedsToSync(cr, account, feedsToSync); Cursor c = SubscribedFeeds.Feeds.query(cr, sSubscriptionProjection, SubscribedFeeds.Feeds.AUTHORITY + "=? AND " + SubscribedFeeds.Feeds._SYNC_ACCOUNT + "=?", new String[] { Contacts.AUTHORITY, account }, null); try {/*from w ww .j a v a2 s .c om*/ if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "scanning over subscriptions with authority " + Contacts.AUTHORITY + " and account " + account); } c.moveToNext(); while (!c.isAfterLast()) { String feedInCursor = c.getString(1); if (feedsToSync.contains(feedInCursor)) { feedsToSync.remove(feedInCursor); c.moveToNext(); } else { c.deleteRow(); } } c.commitUpdates(); } finally { c.close(); } // any feeds remaining in feedsToSync need a subscription for (String feed : feedsToSync) { SubscribedFeeds.addFeed(cr, feed, account, Contacts.AUTHORITY, ContactsClient.SERVICE); // request a sync of this feed Bundle extras = new Bundle(); extras.putString(ContentResolver.SYNC_EXTRAS_ACCOUNT, account); extras.putString("feed", feed); cr.startSync(Contacts.CONTENT_URI, extras); } }
From source file:edu.mit.mobile.android.locast.accounts.AbsLocastAuthenticator.java
/** * {@inheritDoc}/* w w w . j a v a2 s .c o m*/ */ @Override public Bundle getAuthToken(AccountAuthenticatorResponse response, Account account, String authTokenType, Bundle loginOptions) { if (!authTokenType.equals(getAuthTokenType())) { final Bundle result = new Bundle(); result.putString(AccountManager.KEY_ERROR_MESSAGE, "invalid authTokenType"); return result; } final AccountManager am = AccountManager.get(mContext); final String password = am.getPassword(account); if (password != null) { final Bundle accountData = onlineConfirmPassword(account, password); if (accountData != null) { final Bundle result = new Bundle(); result.putString(AccountManager.KEY_ACCOUNT_NAME, account.name); result.putString(AccountManager.KEY_ACCOUNT_TYPE, getAccountType()); result.putString(AccountManager.KEY_AUTHTOKEN, password); return result; } } // the password was missing or incorrect, return an Intent to an // Activity that will prompt the user for the password. final Intent intent = getAuthenticator(mContext); intent.putExtra(AbsLocastAuthenticatorActivity.EXTRA_USERNAME, account.name); intent.putExtra(AbsLocastAuthenticatorActivity.EXTRA_AUTHTOKEN_TYPE, authTokenType); intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response); final Bundle bundle = new Bundle(); bundle.putParcelable(AccountManager.KEY_INTENT, intent); return bundle; }
From source file:it.openyoureyes.test.panoramio.Panoramio.java
public List<GeoItem> examinePanoramio(Location current, double distance, Drawable myImage, Intent intent) { ArrayList<GeoItem> result = new ArrayList<GeoItem>(); /*/*from w w w .j av a2s . c o m*/ * var requiero_fotos = new Json.Remote( * "http://www.panoramio.com/map/get_panoramas.php?order=popularity& * set= * full&from=0&to=10&minx=-5.8&miny=42.59&maxx=-5.5&maxy=42.65&size= * medium " */ Location loc1 = new Location("test"); Location loc2 = new Location("test_"); AbstractGeoItem.calcDestination(current.getLatitude(), current.getLongitude(), 225, distance / 2, loc1); AbstractGeoItem.calcDestination(current.getLatitude(), current.getLongitude(), 45, distance / 2, loc2); try { URL url = new URL( "http://www.panoramio.com/map/get_panoramas.php?order=popularity&set=full&from=0&to=10&minx=" + loc1.getLongitude() + "&miny=" + loc1.getLatitude() + "&maxx=" + loc2.getLongitude() + "&maxy=" + loc2.getLatitude() + "&size=thumbnail"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setDoInput(true); conn.connect(); InputStream is = conn.getInputStream(); String line; BufferedReader reader = new BufferedReader(new InputStreamReader(is)); StringBuffer buf = new StringBuffer(); while ((line = reader.readLine()) != null) { buf.append(line + " "); } reader.close(); is.close(); conn.disconnect(); // while (is.read(buffer) != -1); String jsontext = buf.toString(); Log.d("Json Panoramio", jsontext); JSONObject entrie = new JSONObject(jsontext); JSONArray arr = entrie.getJSONArray("photos"); for (int i = 0; i < arr.length(); i++) { JSONObject panoramioObj = arr.getJSONObject(i); double longitude = panoramioObj.getDouble("longitude"); double latitude = panoramioObj.getDouble("latitude"); String urlFoto = panoramioObj.getString("photo_file_url"); String idFoto = panoramioObj.getString("photo_id"); Bundle bu = intent.getExtras(); if (bu == null) bu = new Bundle(); bu.putString("id", idFoto); intent.replaceExtras(bu); BitmapDrawable bb = new BitmapDrawable(downloadFile(urlFoto)); PanoramioItem item = new PanoramioItem(latitude, longitude, false, bb, intent); result.add(item); } } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (JSONException e) { e.printStackTrace(); } return result; }
From source file:edu.mit.mobile.android.locast.accounts.Authenticator.java
/** * {@inheritDoc}//w w w. j a va2s . c o m */ @Override public Bundle getAuthToken(AccountAuthenticatorResponse response, Account account, String authTokenType, Bundle loginOptions) { if (!authTokenType.equals(AuthenticationService.AUTHTOKEN_TYPE)) { final Bundle result = new Bundle(); result.putString(AccountManager.KEY_ERROR_MESSAGE, "invalid authTokenType"); return result; } final AccountManager am = AccountManager.get(mContext); final String password = am.getPassword(account); if (password != null) { final Bundle accountData = onlineConfirmPassword(account, password); if (accountData != null) { final Bundle result = new Bundle(); result.putString(AccountManager.KEY_ACCOUNT_NAME, account.name); result.putString(AccountManager.KEY_ACCOUNT_TYPE, AuthenticationService.ACCOUNT_TYPE); result.putString(AccountManager.KEY_AUTHTOKEN, password); return result; } } // the password was missing or incorrect, return an Intent to an // Activity that will prompt the user for the password. final Intent intent = new Intent(mContext, AuthenticatorActivity.class); intent.putExtra(AuthenticatorActivity.EXTRA_USERNAME, account.name); intent.putExtra(AuthenticatorActivity.EXTRA_AUTHTOKEN_TYPE, authTokenType); intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response); final Bundle bundle = new Bundle(); bundle.putParcelable(AccountManager.KEY_INTENT, intent); return bundle; }
From source file:com.adithya321.sharesanalysis.fragments.DetailFragment.java
public DetailFragment newInstance(String shareName) { DetailFragment fragment = new DetailFragment(); Bundle args = new Bundle(); args.putString(ARG_SHARE_NAME, shareName); fragment.setArguments(args);//from w w w .j a v a 2 s . c o m return fragment; }
From source file:com.easy.facebook.android.apicall.RestApi.java
private String inviteEventCall(String eventID, String userID, String message) throws EasyFacebookError { Bundle params = new Bundle(); params.putString("method", "events.invite"); params.putString("format", "json"); params.putString("access_token", facebook.getAccessToken()); params.putString("eid", eventID); params.putString("uids", userID); params.putString("personal_message", message); String jsonResponse = ""; try {//from w w w . jav a 2 s . co m jsonResponse = Util.openUrl("https://api.facebook.com/restserver.php", "POST", params); } catch (MalformedURLException e) { throw new EasyFacebookError(e.toString(), "MalformedURLException"); } catch (IOException e) { throw new EasyFacebookError(e.toString(), "IOException"); } return jsonResponse; }