abstractclassFacebookPageImageWrapper{/* * This is the class that will take care of getting the page * with image etc etc. * *//** * * @param pageID * * THis is your page id. Page who's images you want */privateStringPageID="",/** * * @param AppID * * This is your appid you created on fb */AppID="",/** * * @param AppSecret * * Your secret. */AppSecret="";privateArrayList<Bitmap>pics_B;privateArrayList<Drawable>pics_D;privateStringprofilePicUrl="";publicFacebookPageImageWrapper(StringpageID,StringappID,StringappSecret){PageID=pageID;this.AppID=appID;this.AppSecret=appSecret;newThread(newRunnable(){@Overridepublicvoidrun(){pics_B=newArrayList<Bitmap>();try{Stringurl=IOUtils.toString(newURL("https://graph.facebook.com/"+PageID+"?fields=picture").openStream());JSONObjectjson=newJSONObject(url);json=json.getJSONObject("picture");json=json.getJSONObject("data");profilePicUrl=json.getString("url");url=IOUtils.toString(newURL("https://graph.facebook.com/"+PageID+"?fields=photos&access_token="+AppID+"|"+AppSecret).openStream());JSONArrayjsona=newJSONObject(url).getJSONObject("photos").getJSONArray("data");for(inti=0;i<jsona.length();i++){url=IOUtils.toString(newURL("https://graph.facebook.com/"+jsona.getJSONObject(i).getString("id")+"?fields=images&access_token="+AppID+"|"+AppSecret).openStream());StringLink=newJSONObject(url).getJSONArray("images").getJSONObject(0).getString("source");Log.v("link",Link);pics_B.add(BitmapFactory.decodeStream(newURL(Link).openStream()));}PagePictures_B(newArrayList<Bitmap>(pics_B));PageProfilePicture(BitmapFactory.decodeStream(newURL(profilePicUrl).openStream()));}catch(Exceptione){e.printStackTrace();}}}).start();}publicabstractvoidPageProfilePicture(Bitmapbitmap);publicabstractvoidPagePictures_B(ArrayList<Bitmap>photos);publicArrayList<Bitmap>getPagePictures_B(){returnpics_B;}}
Comments (0)
HTTPSSSH
You can clone a snippet to your computer for local editing.
Learn more.