其實我已經檢索到保存在Facebook上的圖像,但我沒有得到如何保存圖像到我的模擬器並獲取保存的圖像的路徑位置,因爲我必須保存路徑在sqlite。 在大多數計算器答案的,它只是描述關於保存圖像而不是緊靠檢索路徑保存一個圖像,並在android模擬器上獲取圖像的保存位置
imageURL = "http://graph.facebook.com/"+id+"/picture?type=small";
bitmap = BitmapFactory.decodeStream((InputStream)new URL(imageURL).getContent());
String extStorageDirectory = Environment.getExternalStorageDirectory().toString();
File file = new File(extStorageDirectory, fileName+".jpg");
file.createNewFile();
FileOutputStream fos = new FileOutputStream(file);
bitmap.compress(CompressFormat.JPEG, 75, fos);
fos.flush();
fos.close();
,我甚至已經更新了我的清單文件
uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
沒錯akki,我認爲它能夠更好地保存像this.But圖像在此之後我將如何檢索圖像location.Thanks對您有所幫助。 – 2012-01-30 08:19:51
@Shahzadimam:它會以字符串形式返回uri,您可以使用它來到那裏。 – Akram 2012-01-30 10:44:36