Android Question Which element for clicking a value

Shelby

Well-Known Member
Licensed User
Longtime User
In my SQLite app, I want to be able to click a value in a column to bring up an image in a new panel/window, etc. Eventually, I want to encrypt the entire app, so which library and, or filetype shall I learn about to find the code to perform this function of displaying? I'm not sure if I should have my stored images in an internal or external repository; can you address that also? I have 3 columns for now and 433 images.
Thanks
 
Last edited:

Shelby

Well-Known Member
Licensed User
Longtime User
Thank you,
I'll study that unless I find a better direction.
 
Last edited:
Upvote 0

Mahares

Expert
Licensed User
Longtime User
Thank you,
I'll study that.
Could you elaborate on what exactly you want to do. Based on what I have seen from your previous threads that mention 443 images, you wanted to display the SQLite table data on a B4XTable or flexible table and that you want to display an image on a panel or page after clicking a cell that matches the image on a given column. If that is the case post code or project. If not the case, then, I hope the B4XDialog will do what you want.
 
Upvote 0

Shelby

Well-Known Member
Licensed User
Longtime User
OK,
As is the case now, I have a 443 records SQLite app with page numbers where the individual table would be found in a 900 page book. Each record describes one of the 443 tables from that book. I want the user (who can never change any values) to be able to view the individual table which is a simple image to be looked at with again, no ability to edit anything in that individual table.
Thanks Mahares
 

Attachments

  • SS2021V11New2.zip
    56.2 KB · Views: 191
Upvote 0

Shelby

Well-Known Member
Licensed User
Longtime User
Here is one of the images of the 433 table images.
 

Attachments

  • AG101.1 pg3.png
    96.7 KB · Views: 211
Upvote 0

klaus

Expert
Licensed User
Longtime User
Where are the images located?
In which column of the table is the information for getting the images.

You can use the CellClick event.
You get the col and row indexes therefor you know which cell was clicked and add the code to display the image..
B4X:
Private Sub tblItems_CellClick(col As Int, row As Int)
    Log("col = " & col & "  row = " & row)
End Sub
 
Upvote 0

Shelby

Well-Known Member
Licensed User
Longtime User
Thanks Klaus,
I don't know if I want to have a new 4th column for the click process or if I might use the column with the image name already in column 2 entitled Table. Perhaps a new column is most effective where the column header says: Click for image, or each value could be: Click for specific image.
Do you (or you Mahares) have a suggestion on which you think is most intuitive? That's to use the new column or use column 2 where image name and table name are already synonymous?
 
Last edited:
Upvote 0

Shelby

Well-Known Member
Licensed User
Longtime User
OK, I think I should use column 2 and add text: "click for image" in the header of the column which I can easily do. I'll try to learn how to use the CellClick event.
Thanks again to both of you.
 
Last edited:
Upvote 0

Shelby

Well-Known Member
Licensed User
Longtime User
Does either of you have a suggestion on my using an internal images repository or external (on my website)? Remember, nothing is to be editable and eventually, encrypted.
 
Last edited:
Upvote 0

Shelby

Well-Known Member
Licensed User
Longtime User
I also wonder if the index number (which is now not visible as a separate column), might be important. The row 2 names are identical to the image names; consequently, I assume that the index is not needed unless you think my synchronizing the image to an index column is easier.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
I also wonder if the index number (which is now not visible as a separate column), might be important.
I do not know.
If the index value is the same as the row index it is OK.
If the content of the cells in column 2 is the name or part of the image name you can use it directly.
I gave you possible solutions, but not knowing exactly your data organization it is impossible to give a concrete advice.
Below the code to get the cell value.
B4X:
Private Sub tblItems_CellClick(col As Int, row As Int)
    If col = 1 Then
        Log(tblItems.GetValue(col, row))       
    End If
End Sub
 
Upvote 0

Shelby

Well-Known Member
Licensed User
Longtime User
I still don't know where to put my images repository. Can I put the folder of images in my project files? I don't know how to put the suggestions into action, or which module; but I figure I'll study and test adding code, then fail, and test, etc.....
 
Last edited:
Upvote 0

Mahares

Expert
Licensed User
Longtime User
I don't know how to put the suggestions into action, but I figure I'll study and test adding code and fail and test, etc.....
You shouldn't mark it as 'Solved', if you still have not figure it out. When people see 'Solved', they think you got it and will refrain from any additional posts. Your project seems to use FlexibleTable or Table. But, I work with B4XTable. If you hit a wall and want to explore B4Xtable, I think I can come up with a sample B4XPages project that gets you close to where you want to go.
 
Upvote 0

Shelby

Well-Known Member
Licensed User
Longtime User
OK,
The following code is from my last sub in my project table module. I guess that means that some B4X is used in my B4A project. However, it's the only instance of B4X in the entire project. I'll be more than happy for you to continue with your assistance, i.e. a sample B4XPages project.
Thanks

B4X:
Public Sub SnapShot As Bitmap
    Private bmpSnapshot As Bitmap
    Private xpnlTable As B4XView
 
    xpnlTable = pnlTable
    bmpSnapshot = xpnlTable.Snapshot
 
    Return bmpSnapshot
End Sub
 
Last edited:
Upvote 0

klaus

Expert
Licensed User
Longtime User
The routine you show is in the Table class.
It returns a bitmap of the visible part of the Table, not useful in your case.

To be able to help you you need to give us more information.
Again, where are the image files located?
What are the names of the images?
What is the size of the image files?

Making a few assumptions, attached a modified project showing an image when clicking on the second row.
Assumptions:
- The image filename is the content of the cells in the second column with the .png extension.

- I added one image R702.4.2.png into the Assets folder, this one is then copied into the ImageDir folder, look in the code.
This image is yours from post #6, but renamed. There is no entry in the second column matching with the original name.
For additional image files you can add those directly into the folder on the device, the folder name is displayed in the Logs.
You could, maybe, leave the files in the File.DirAssets folder, but this might make the apk file very huge.

- The image is displayed in a ZoomImageView.
You need to download the ZoomImageView.b4xlib file into your AdditionalLibraries folder.

- To go back from the displayed image I use your button.

I'll be more than happy for you to continue with your assistance, i.e. a sample B4XPages project.
You mean this project as a B4XPages project or any other.
If it is this project, do you want it working on all three platforms or only with B4A?
For any other, you might have a look at the B4XPages Cross-platform projects booklets, it contains examples.
 

Attachments

  • SS2021V11_k.zip
    142.5 KB · Views: 173
Upvote 0

Shelby

Well-Known Member
Licensed User
Longtime User
All the images are in a folder on my desktop; the folder contains 43.4 MB. Every value in row two of the project is a name of one of the now 424 images (I'm editing) with a .png extension. The sizes of the images vary; perhaps you will require that I resize all the images to be the same size?
There is an image R702.4.2 but the one in post #6 is named AG101.1. Each name is directly at the top of the image itself and in column 2. I'm now in the process of trying to find the AG101.1 which I may have removed from the project recently. Sorry about that discrepancy. As to your comment and your question above,(If it is this project, do you want it working on all three platforms or only with B4A?) I was answering Mahare's message. Eventually, I would like to have all three platforms for the project.
Shelb
P.S. I removed that AG101.1 image in the project intentionally but left it in the images folder by error. I just removed it from the image folder but I guess that won't help you.
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…