List of usage examples for android.os Bundle putString
public void putString(@Nullable String key, @Nullable String value)
From source file:net.bible.android.control.link.LinkControl.java
private void showAllOccurrences(String ref, SearchBibleSection biblesection, String refPrefix) { Book currentBible = CurrentPageManager.getInstance().getCurrentBible().getCurrentDocument(); Book strongsBible = null;// w w w . ja v a2s . com // if current bible has no Strongs refs then try to find one that has if (currentBible.hasFeature(FeatureType.STRONGS_NUMBERS)) { strongsBible = currentBible; } else { strongsBible = SwordDocumentFacade.getInstance().getDefaultBibleWithStrongs(); } // possibly no Strong's bible or it has not been indexed boolean needToDownloadIndex = false; if (strongsBible == null) { Dialogs.getInstance().showErrorMsg(R.string.no_indexed_bible_with_strongs_ref); return; } else if (currentBible.equals(strongsBible) && !checkStrongs(currentBible)) { Log.d(TAG, "Index status is NOT DONE"); needToDownloadIndex = true; } // The below uses ANY_WORDS because that does not add anything to the search string //String noLeadingZeroRef = StringUtils.stripStart(ref, "0"); String searchText = ControlFactory.getInstance().getSearchControl() .decorateSearchString("strong:" + refPrefix + ref, SearchType.ANY_WORDS, biblesection, null); Log.d(TAG, "Search text:" + searchText); Activity activity = CurrentActivityHolder.getInstance().getCurrentActivity(); Bundle searchParams = new Bundle(); searchParams.putString(SearchControl.SEARCH_TEXT, searchText); searchParams.putString(SearchControl.SEARCH_DOCUMENT, strongsBible.getInitials()); searchParams.putString(SearchControl.TARGET_DOCUMENT, currentBible.getInitials()); Intent intent = null; if (needToDownloadIndex) { intent = new Intent(activity, SearchIndex.class); } else { //If an indexed Strong's module is in place then do the search - the normal situation intent = new Intent(activity, SearchResults.class); } intent.putExtras(searchParams); activity.startActivity(intent); return; }
From source file:com.easy.facebook.android.apicall.RestApi.java
private String setStatusCall(String message, String urlPicture) throws EasyFacebookError { Bundle params = new Bundle(); params.putString("format", "json"); params.putString("method", "status.set"); params.putString("access_token", facebook.getAccessToken()); params.putString("status", message); if (urlPicture != null) params.putString("picture", urlPicture); String jsonResponse = ""; try {//from w w w . jav a2 s. com 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; }
From source file:com.easy.facebook.android.apicall.RestApi.java
private List<Album> getAlbumsCall(String friendID) throws EasyFacebookError { Bundle params = new Bundle(); params.putString("format", "json"); params.putString("method", "photos.getAlbums"); params.putString("access_token", facebook.getAccessToken()); String jsonResponse;//from w w w .jav a 2s.c o m List<Album> albumList = new ArrayList<Album>(); try { jsonResponse = Util.openUrl("https://api.facebook.com/restserver.php", "POST", params); JSONObjectDecode jsonArray = new JSONObjectDecode(jsonResponse); for (int i = 0; i < jsonArray.length(); i++) albumList.add(jsonArray.getAlbum(i)); } catch (MalformedURLException e) { throw new EasyFacebookError(e.toString(), "MalformedURLException"); } catch (IOException e) { throw new EasyFacebookError(e.toString(), "IOException"); } catch (JSONException e) { throw new EasyFacebookError(e.toString(), "JSONException"); } return albumList; }
From source file:com.easy.facebook.android.facebook.FBLoginManager.java
public void logout(Facebook facebook) throws EasyFacebookError { SharedPreferences preferences = this.getActivity().getSharedPreferences(appID, 0); android.content.SharedPreferences.Editor editor = preferences.edit(); editor.putString("accessToken", ""); editor.putString("uid", ""); editor.clear();/*from w w w.j a va2s . c o m*/ editor.commit(); CookieSyncManager.createInstance(activity); CookieManager cookieManager = CookieManager.getInstance(); cookieManager.removeAllCookie(); Bundle params = new Bundle(); params.putString("format", "json"); params.putString("access_token", facebook.getAccessToken()); params.putString("method", "auth.expireSession"); String jsonResponse = ""; try { jsonResponse = Util.openUrl("https://api.facebook.com/restserver.php", "GET", params); if (!jsonResponse.equals("true")) { JSONObject objectJSONErrorCheck = new JSONObject(jsonResponse); if (!objectJSONErrorCheck.isNull("error_msg")) { throw new EasyFacebookError(jsonResponse); } } } catch (MalformedURLException e) { throw new EasyFacebookError(e.toString(), "MalformedURLException"); } catch (IOException e) { throw new EasyFacebookError(e.toString(), "IOException"); } catch (JSONException e) { throw new EasyFacebookError(e.toString(), "JSONException"); } ((LoginListener) activity).logoutSuccess(); }
From source file:com.google.android.apps.muzei.api.internal.SourceState.java
public Bundle toBundle() { Bundle bundle = new Bundle(); if (mCurrentArtwork != null) { bundle.putBundle("currentArtwork", mCurrentArtwork.toBundle()); }/*from w w w . j av a2 s .com*/ bundle.putString("description", mDescription); bundle.putBoolean("wantsNetworkAvailable", mWantsNetworkAvailable); String[] commandsSerialized = new String[mUserCommands.size()]; for (int i = 0; i < commandsSerialized.length; i++) { commandsSerialized[i] = mUserCommands.get(i).serialize(); } bundle.putStringArray("userCommands", commandsSerialized); return bundle; }
From source file:de.wikilab.android.friendica01.FileUploadService.java
private void showFailMsg(Context ctx, String txt) { NotificationManager mNotificationManager = (NotificationManager) getSystemService( Context.NOTIFICATION_SERVICE); Log.e("Andfrnd/UploadFile", "Upload FAILED: " + txt); //Instantiate the Notification: CharSequence tickerText = "Upload failed, please retry!"; Notification notification = new Notification(R.drawable.arrow_up, tickerText, System.currentTimeMillis()); notification.flags |= Notification.FLAG_AUTO_CANCEL; //Define the Notification's expanded message and Intent: Context context = getApplicationContext(); CharSequence contentTitle = "Upload failed, click to retry!"; CharSequence contentText = txt; Intent notificationIntent = new Intent(this, FriendicaImgUploadActivity.class); Bundle b = new Bundle(); b.putParcelable(Intent.EXTRA_STREAM, fileToUpload); b.putString(Intent.EXTRA_SUBJECT, subject); b.putString(EXTRA_DESCTEXT, descText); notificationIntent.putExtras(b);//from w w w . ja v a 2 s. c o m PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0); notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent); //Pass the Notification to the NotificationManager: mNotificationManager.notify(UPLOAD_FAILED_ID, notification); //Toast.makeText(ctx, "Upload failed, please retry:\n" + txt, Toast.LENGTH_LONG).show(); }
From source file:com.easy.facebook.android.apicall.RestApi.java
private String postToFriendCall(String message, String friendID, String urlPicture) throws EasyFacebookError { Bundle params = new Bundle(); params.putString("format", "json"); params.putString("method", "stream.publish"); params.putString("access_token", facebook.getAccessToken()); params.putString("message", message); params.putString("target_id", friendID); if (urlPicture != null) { String pictureName = urlPicture.substring(urlPicture.lastIndexOf('/'), urlPicture.length()); params.putString("attachment", "{\"media\": [{\"type\": \"image\",\"src\": \"" + pictureName + "\", \"href\": \"" + urlPicture + "\"}]}"); }//from w ww . j a v a2 s . c o m String jsonResponse = ""; try { 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.replace("\"", ""); }
From source file:com.easy.facebook.android.apicall.RestApi.java
public List<String> getFriendUIDs() throws EasyFacebookError { Bundle params = new Bundle(); params.putString("format", "json"); params.putString("method", "friends.get"); params.putString("access_token", facebook.getAccessToken()); String jsonResponse;//from w w w. j a va2s .co m List<String> stringList = new ArrayList<String>(); try { jsonResponse = Util.openUrl("https://api.facebook.com/restserver.php", "POST", params); JSONArray jsonArray = new JSONArray(jsonResponse); for (int i = 0; i < jsonArray.length(); i++) stringList.add(jsonArray.get(i).toString().replaceAll("\"", "")); } catch (MalformedURLException e) { throw new EasyFacebookError(e.toString(), "MalformedURLException"); } catch (IOException e) { throw new EasyFacebookError(e.toString(), "IOException"); } catch (JSONException e) { throw new EasyFacebookError(e.toString(), "JSONException"); } return stringList; }
From source file:com.cooperok.socialuser.fb.FbAccount.java
@Override public void postImage(Bitmap image, final PostImageCallback callback) { final Session session = Session.getActiveSession(); if (session != null && session.isOpened()) { Bundle params = new Bundle(); params.putString("message", ""); params.putParcelable("picture", image); params.putParcelable("source", image); Request request = new Request(Session.getActiveSession(), "me/photos", params, HttpMethod.POST); request.setCallback(new Request.Callback() { @Override/*from w w w. ja v a2 s.com*/ public void onCompleted(Response response) { if (response.getError() == null) { String postId = null; try { postId = response.getGraphObject().getInnerJSONObject().getString("post_id"); } catch (JSONException e) { } callback.onImagePosted(FbAccount.this, postId); } else { callback.onImagePostedError(FbAccount.this); } } }); request.executeAsync(); } }
From source file:com.easy.facebook.android.apicall.RestApi.java
private List<Status> getStatusCall(Integer limit) throws EasyFacebookError { Bundle params = new Bundle(); params.putString("format", "json"); params.putString("method", "status.get"); params.putString("access_token", facebook.getAccessToken()); if (limit != null) params.putString("limit", limit.toString()); String jsonResponse;/* www .j a va 2s.c o m*/ List<Status> statusList = new ArrayList<Status>(); try { jsonResponse = Util.openUrl("https://api.facebook.com/restserver.php", "POST", params); JSONObjectDecode jsonArray = new JSONObjectDecode(jsonResponse); for (int i = 0; i < jsonArray.length(); i++) statusList.add(jsonArray.getStatus(i)); } catch (MalformedURLException e) { throw new EasyFacebookError(e.toString(), "MalformedURLException"); } catch (IOException e) { throw new EasyFacebookError(e.toString(), "IOException"); } catch (JSONException e) { throw new EasyFacebookError(e.toString(), "JSONException"); } return statusList; }