Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ArrayList<String> list = new ArrayList();
- list.add("http://example.url:8000/uploads/images1.jpg");
- list.add("http://example.url:8000/uploads/images2.jpg");
- list.add("http://example.url:8000/uploads/images3.jpg");
- int index = 0;
- RequestBatch reqBatch = new RequestBatch();
- do {
- Bundle postParams = new Bundle();
- postParams.putString("picture", list.get(index).toString());
- postParams.putString("message", "message");
- Request request = new Request(Session.getActiveSession(),"group_id/feed", postParams, HttpMethod.POST);
- request.setCallback( new Request.Callback() {
- @Override
- public void onCompleted(Response response) {
- Log.d(TAG, ""+response);
- }
- });
- reqBatch.add(request);
- index++;
- }while(list.size()>index);
- reqBatch.executeAsync();
- Bundle params = new Bundle();
- params.putString("name", "name");
- params.putString("caption", "caption");
- params.putString("description", "TEST");
- params.putString("link", "http://image.url/image.jpg");
- params.putString("to", "group_id"); // how to change to group wall???? and how to set 2+ photos???
- WebDialog feedDialog = (
- new WebDialog.FeedDialogBuilder(this,
- Session.getActiveSession(),params)).setOnCompleteListener(new OnCompleteListener() {
- @Override
- public void onComplete(Bundle values, FacebookException error) {
- // TODO Auto-generated method stub
- Log.d(TAG, values.toString());
- }
- })
- .build();
- feedDialog.show();
- protected void share(String nameApp, String imagePath, String text) {
- // TODO Auto-generated method stub
- try {
- List<Intent> targetedShareIntents = new ArrayList<Intent>();
- Intent share = new Intent(android.content.Intent.ACTION_SEND_MULTIPLE);
- share.setType("image/jpeg");
- List<ResolveInfo> resInfo = getActivity().getPackageManager()
- .queryIntentActivities(share, 0);
- if (!resInfo.isEmpty()) {
- for (ResolveInfo info : resInfo) {
- Intent targetedShare = new Intent(
- android.content.Intent.ACTION_SEND_MULTIPLE);
- targetedShare.setType("image/png"); // put here your mime
- // type
- if (info.activityInfo.packageName.toLowerCase().contains(
- nameApp)
- || info.activityInfo.name.toLowerCase().contains(
- nameApp)) {
- targetedShare.putExtra(Intent.EXTRA_SUBJECT, text);
- targetedShare.putExtra(Intent.EXTRA_TEXT, text);
- ArrayList<Uri> files = new ArrayList<Uri>();
- for(int j= 0;j<caminhos.size();j++){
- if(!caminhos.get(j).isEmpty()){
- File file = new File(caminhos.get(j));
- Uri uri = Uri.fromFile(file);
- files.add(uri);
- }
- }
- targetedShare.putParcelableArrayListExtra(Intent.EXTRA_STREAM,
- files);
- targetedShare.setPackage(info.activityInfo.packageName);
- targetedShareIntents.add(targetedShare);
- }
- }
- Intent chooserIntent = Intent.createChooser(
- targetedShareIntents.remove(0), "Select app to share");
- chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS,
- targetedShareIntents.toArray(new Parcelable[] {}));
- startActivity(chooserIntent);
- }
- } catch (Exception e) {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement