If the "Image Name" in the database matches the "Image Name" in the directory, display the images in a gridview

I am new to android and programming concepts, I am a bit stuck in something atma and could do it with a push in the right direction.

I am developing an application that has a function that allows users to capture an image, save this image in the file system of the application and store the link to this image in the sqlite database. I explain it HERE and received good reviews on how I am going to store the link in the database ... I decided to just save the image name file .

The real problem here is that I don’t know how to go get the link to the image from the database and display the images in a grid . The way I think this might work is to have something like:

IF (image name in the database == image name in the file system) {Show only these images}

I do not know how to implement this, any help or understanding will be very grateful, thanks!

+1
source share
1 answer

you can do something like this:

get all image names from the database, and then check if they exist in the file system or not.

if(new File(FOLDERPATH + File.separator + file_name_in_db).exists()) {
   // add file to list to be set in grid view adapter
}
+1
source

Source: https://habr.com/ru/post/1527657/


All Articles