我試圖從Amazon S3下載一組.jpg,並將它們存儲到內部存儲器(以便它們不能被惡意用戶複製)。我已經得到這麼多,但現在我被卡住了。我發現了多個與位圖或數組有關的問題,但沒有關於存儲圖像然後再訪問它的問題。任何人都知道我從哪裏出發?序列化對象(jpg)到內部存儲
String itemName = iconNames.getString(iconNames.getColumnIndexOrThrow(DbAdapter.KEY_ICON));
itemName = itemName + ".jpg";
GetObjectRequest getObject = new GetObjectRequest(bucket, itemName);
S3Object icon = mS3Client.getObject(getObject);
InputStream input = icon.getObjectContent();
我在這裏看開發者指南中,它給下面的代碼 http://developer.android.com/guide/topics/data/data-storage.html#filesInternal
String FILENAME = "hello_file";
String string = "hello world!";
FileOutputStream fos = openFileOutput(FILENAME, Context.MODE_PRIVATE);
fos.write(string.getBytes());
fos.close();
但是,這是一個用於存儲字符串,而不是圖像...
工作!謝謝!...現在我必須弄清楚它在做什麼哈哈。 – easycheese