在我的數據庫中,我有一行存儲來自Internet的圖像的鏈接。 在下面的代碼中,我取了名字並放入了每行的ListView。 現在,KEY_LINK保存圖像的鏈接,我如何將此數組轉換爲位圖,並在ListView中更改每個KEY_NAME?從數據庫到位圖的字符串數組
@SuppressWarnings("deprecation")
private void populate(){
Cursor cursor = entry.getAllRows();
String[] from = new String[] {SQLHelper.KEY_NAME, SQLHelper.KEY_LINK};
int[] to = new int[] {R.id.textView1, R.id.textView2};
SimpleCursorAdapter nameAdapter;
nameAdapter = new SimpleCursorAdapter(getBaseContext(), R.layout.item_list, cursor, from, to);
ListView mylist = (ListView)findViewById(R.id.listView1);
mylist.setAdapter(nameAdapter);
}
那是不錯,但我搜索多一點,發現通用圖像裝載機,它可能適合我在這種情況下需要 – he4dless
哇,wonderful.this項目也可以爲他人[通用圖像裝載機(樂於助人https://github.com/nostra13/Android-Universal-Image-Loader) – sakiM
無論如何,我不知道如果我問這裏或提出另一個問題,但我如何從數據庫中獲取內容到一個字符串數組,或者數組列表? – he4dless