i have a local sqlite database in my android application that include links to some images when the user try to delete the specific image the url in database will be deleted but the image is still showing and when user goes to the another activity in comes back it will not showing that image. so what is problem? here is my code:
getFileList();
G.database.execSQL("DELETE FROM favourites WHERE fav_url='" + imageList.get(counter).Url + "'");
imageList.remove(counter);
getFileList();
URL url;
try {
url = new URL("http://ift.tt/1z3St7G" + imageList.get(counter + 2).Url);
bitmap = BitmapFactory.decodeStream(url.openConnection().getInputStream());
imgShowImage.setImageBitmap(bitmap);
and getFileList() method:
private void getFileList() {
Cursor cursor = G.database.rawQuery("SELECT * FROM favourites", null);
while (cursor.moveToNext()) {
StructImages image = new StructImages();
image.Url = cursor.getString(cursor.getColumnIndex("fav_url"));
imageList.add(image);
}
cursor.close();
}
Aucun commentaire:
Enregistrer un commentaire