How to show SD Card image in Feed Dialog



Question:

I am writing a program in which I am allowing user to post a message along with image on their [Friend & User] Wall, and i am using SD Card image to post, but whenever i see my Feed Dialog in place of my SD Card's image i am getting Google's Logo, because in link parameter i used www.google.com, so it's picking that image, see below:
enter image description here
I tried with some other web links, and found it is picking any image from that link....
So here my question, why i am not getting SD Card image there
public void onItemClick(AdapterView<?> adapterView, View view,              final int position, long id) {            try {              friendId = jsonArray.getJSONObject(position).getLong("uid");              String name = jsonArray.getJSONObject(position).getString("name");              new AlertDialog.Builder(this)              .setTitle(R.string.post_on_wall_title)              .setMessage(              String.format(getString(R.string.post_on_wall),              name)).setPositiveButton(R.string.yes,              new DialogInterface.OnClickListener() {              @Override                      public void onClick(DialogInterface dialog,int which) {              try                       {             String myPath  = Environment.getExternalStorageDirectory()            .getAbsolutePath() + "/Pictures/Facebook/flower1.jpg";               File f = new File(myPath);             FileInputStream fis = new FileInputStream(f);                Log.d("onItemClick", "fis ::--" + fis);                Bitmap bi = BitmapFactory.decodeStream(fis);              Log.d("onItemClick", "bi ::--" + bi);              ByteArrayOutputStream baos = new ByteArrayOutputStream();              Log.d("onItemClick", "baos ::--" + baos);                  bi.compress(Bitmap.CompressFormat.JPEG, 100, baos);              data = baos.toByteArray();                  Log.d("onItemClick", "data ::--" + data);                      } catch (FileNotFoundException e) {                e.printStackTrace();                  Log.d("onCreate", "debug error  e = " + e.toString());                                     }                         Bundle params = new Bundle();                  params.putString("to", String.valueOf(friendId));                      params.putString("caption", getString(R.string.app_name));              params.putString("description", getString(R.string.app_desc));              params.putString("link", "http://www.google.com");                params.putString("method", "photos.upload");               params.putByteArray("picture", data);                  Log.d("onItemClick", "params.putByteArray ::--" + data);              params.putString("name", getString(R.string.app_action));                                                                  FacebookUtility.facebook.dialog(FriendsList.this, "feed",                       params, (DialogListener) newPostDialogListener());                                                          }                }).setNegativeButton(R.string.no, null).show();          } catch (JSONException e) {              showToast("Error: " + e.getMessage());          }      }  
I have also given these permission in Manifest:
<uses-permission       android:name="android.permission.WRITE_EXTERNAL_STORAGE" />    <uses-permission       android:name="android.permission.READ_EXTERNAL_STORAGE" />  


Solution:2

hey why dont you try absolute path
String myPath = sdcardEnvironment.getExternalStorageDirectory().getAbsolutePath() + "/Pictures/Facebook/flower1.jpg";  
Also check that you have provide Permission in manifest file for external read write
try this


Solution:3

The feed dialog does not support uploading images, it only allows you to supply a url for the "picture" parameter.
See the full docs here: https://developers.facebook.com/docs/reference/dialogs/feed/

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »