1
我試圖從我的數據庫在線獲取圖片,在我的「圖片鏈接」這是我的表中的數據字段,我把那裏我上傳的圖片的網址,但不幸的是它給了我這個錯誤。BitmapFactory無法解碼流:Android中的java.io.FileNotFoundException
02-08 15:05:29.432 14364-14364/com.example.jithea.testlogin E/BitmapFactory﹕ Unable to decode stream: java.io.FileNotFoundException: /http:/agustiniancampusevents.site40.net/newsDB/images/Visual%20Report%20Filipino%20Final-12%20copy.JPG: open failed: ENOENT (No such file or directory)
這是我在onPostExecute代碼:
protected void onPostExecute(String file_url) {
// dismiss the dialog after getting all products
pDialog.dismiss();
// updating UI from Background Thread
runOnUiThread(new Runnable() {
public void run() {
/**
* Updating parsed JSON data into ListView
* */
ListAdapter adapter = new SimpleAdapter(
NewsActivity.this, productsList,
R.layout.news_list_item, new String[]{TAG_PID, TAG_IMAGELINK,
TAG_NEWSTITLE, TAG_DESCRIPTION},
new int[]{R.id.pid, R.id.imageView, R.id.newstitle, R.id.description});
// updating listview
setListAdapter(adapter);
}
});
}
請顯示一些代碼! – AADProgramming 2015-02-08 07:22:17
這將是因爲文件「/http:/agustiniancampusevents.site40.net/newsDB/images/Visual%20Report%20Filipino%20Final-12%20copy.JPG」不存在。您是否將URL傳遞給從文件讀取的方法? (URL不是文件) – immibis 2015-02-08 07:22:59
如何將url傳遞給讀取文件的方法? – 2015-02-08 07:25:15