rleiman Well-Known Member Licensed User Longtime User Jul 25, 2015 #1 Hi Everyone, I would like to get the file name of the image that's loaded in an ImageView. I have tried this but the coding is not correct. Can you show me the correct syntax to do it? It tells me "Types do not match" Thanks. B4X: If ImageViewQuarterPastChimes.Bitmap = "light-on-icon.png" Then ' Do something. Else ' Do something else. End If
Hi Everyone, I would like to get the file name of the image that's loaded in an ImageView. I have tried this but the coding is not correct. Can you show me the correct syntax to do it? It tells me "Types do not match" Thanks. B4X: If ImageViewQuarterPastChimes.Bitmap = "light-on-icon.png" Then ' Do something. Else ' Do something else. End If
Erel B4X founder Staff member Licensed User Longtime User Jul 26, 2015 #2 The file name is not stored anywhere. You can use ImageView.Tag to store the file name. Upvote 0
Z zcc New Member Jul 10, 2024 #3 You can set the image file name by: B4X: ImageViewQuarterPastChimes.Bitmap = = LoadBitmap (File.DirAssets, "light-on-icon.png") Make sure you add the new file to the project from: Windows Menu ---> File Manager Upvote 0
You can set the image file name by: B4X: ImageViewQuarterPastChimes.Bitmap = = LoadBitmap (File.DirAssets, "light-on-icon.png") Make sure you add the new file to the project from: Windows Menu ---> File Manager
Andrew (Digitwell) Well-Known Member Licensed User Longtime User Jul 10, 2024 #4 zcc said: You can set the image file name by: B4X: [CODE=b4x]ImageViewQuarterPastChimes.Tag = "light-on-icon.png" B4X: ImageViewQuarterPastChimes.tag = "light-on-icon.png" [/CODE] Make sure you add the new file to the project from: Windows Menu ---> File Manager Click to expand... However once the file is loaded, as Erel says there is no way to get the filename from the imageview directly unless you add something like: B4X: ImageViewQuarterPastChimes.tag = "light-on-icon.png" then later you can do B4X: private filename as string = ImageViewQuarterPastChimes.tag 'or as in the example from post 1 If (ImageViewQuarterPastChimes.tag.as(string).compareto("light-on-icon.png") = 0) Then ' Do something. Else ' Do something else. End If edited to use example from post 1 Upvote 0
zcc said: You can set the image file name by: B4X: [CODE=b4x]ImageViewQuarterPastChimes.Tag = "light-on-icon.png" B4X: ImageViewQuarterPastChimes.tag = "light-on-icon.png" [/CODE] Make sure you add the new file to the project from: Windows Menu ---> File Manager Click to expand... However once the file is loaded, as Erel says there is no way to get the filename from the imageview directly unless you add something like: B4X: ImageViewQuarterPastChimes.tag = "light-on-icon.png" then later you can do B4X: private filename as string = ImageViewQuarterPastChimes.tag 'or as in the example from post 1 If (ImageViewQuarterPastChimes.tag.as(string).compareto("light-on-icon.png") = 0) Then ' Do something. Else ' Do something else. End If edited to use example from post 1
aeric Expert Licensed User Longtime User Jul 10, 2024 #5 This thread is almost 9 years old. One should not post in an old thread. Upvote 0
mangojack Expert Licensed User Longtime User Jul 11, 2024 #6 Got me .. thought Erel had just replied and gave him a Like ... Upvote 0