Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Create a file Object from Filepath on your SDcard like</p> <pre><code>File ff = new File("Your sdcard file path"); bb = decode(ff); } ByteArrayOutputStream stream = new ByteArrayOutputStream(); bb.compress(Bitmap.CompressFormat.PNG, 100, stream); byte[] byteArray = stream.toByteArray(); Bundle params = new Bundle(); params.putString("method", "photos.upload"); params.putString("caption", msg); params.putByteArray("image", byteArray); try { facebook.request("me/feed", params, "POST"); } catch (FileNotFoundException fileNotFoundException) { fileNotFoundException.printStackTrace(); } catch (MalformedURLException malformedURLException) { malformedURLException.printStackTrace(); } catch (IOException ioException) { ioException.printStackTrace(); } AsyncFacebookRunner mAsyncRunner = new AsyncFacebookRunner(facebook); mAsyncRunner.request(null, params, "POST", new SampleUploadListener(), null); // code for decode method private Bitmap decode(File f) { try { //Decode image size BitmapFactory.Options o = new BitmapFactory.Options(); o.inJustDecodeBounds = true; BitmapFactory.decodeStream(new FileInputStream(f),null,o); //The new size we want to scale to final int REQUIRED_SIZE=70; //Find the correct scale value. It should be the power of 2. int scale=1; while(o.outWidth/scale/2&gt;=REQUIRED_SIZE &amp;&amp; o.outHeight/scale/2&gt;=REQUIRED_SIZE) scale*=2; //Decode with inSampleSize BitmapFactory.Options o2 = new BitmapFactory.Options(); o2.inSampleSize=scale; return BitmapFactory.decodeStream(new FileInputStream(f), null, o2); } catch (FileNotFoundException e) {} return null; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload