2015-11-10 85 views
-1

我想從Facebook獲得的圖像,並上傳在服務器上,但我無法得到的圖像...我怎樣才能做到這一點?`如何從Facebook獲取圖片並在服務器上上傳?

try { 
            String imageURL="http://graph.facebook.com/"+ userFbId+ "/picture?type=large"; 
            URL image_value = new URL(imageURL); 

            try { 
             bm270 = BitmapFactory.decodeStream(image_value.openConnection().getInputStream()); 
            } catch (IOException e) { 
             e.printStackTrace(); 
            } 
            //userPicture.setImageBitmap(bm270); 
           } catch (MalformedURLException e) { 
            e.printStackTrace(); 
           } 
+0

使用滑翔或Passico或一般圖片下載器,幫助您加載圖像。 –

+0

我對此沒有任何意見......請你通過代碼解釋一下嗎? –

+0

我認爲沒有人能回答我的問題 –

回答

0

add library

download image

1.在您中添加compile 'com.github.bumptech.glide:glide:3.6.1'build.gradle

2.Download圖像:

String imageURL="http://i9.baidu.com/it/u=4155509453,935829176&fm=96&s=CF86AC45FACB2F6C1C9CB5000300E093"; 
Glide.with(ActivityA.this).load(imageURL).downloadOnly(new SimpleTarget<File>() { 
    @Override 
    public void onResourceReady(File resource, GlideAnimation<? super File> glideAnimation) { 
     Glide.with(ActivityA.this).load(resource).into(m); 
    } 
});