A aligol Member Feb 18, 2023 #1 Hi I have saved about 30 words pronunciation with mp3 format in DirAssets and wrote audioes file name next to their words and meanings in my database. I read words and meanings by cursor at two lables but don't know how to play theirs pronunciation by clicking in a button. Can someone give me a hand? How can i handle that?
Hi I have saved about 30 words pronunciation with mp3 format in DirAssets and wrote audioes file name next to their words and meanings in my database. I read words and meanings by cursor at two lables but don't know how to play theirs pronunciation by clicking in a button. Can someone give me a hand? How can i handle that?
M Mahares Expert Licensed User Longtime User Feb 19, 2023 #2 aligol said: Can someone give me a hand? Click to expand... This is how I envision it. Suppose you have a database in xui.defaultfolder with a table that has 2 columns: FileName and Description: 1. You can use a select query to populate an xCustomlistview from the database located in internal with an item layout that has 2 labels. One label shows the fileName, the other the Description. The xCLV returned value needs to be the text of the 1st label, exple: CustomListView1.Add(Pnl, Label1.Text) 2. In the CustomListView1_ItemClick you have this code: Code: Copy Private Sub CustomListView1_ItemClick (Index As Int, Value As Object) Dim s As String = Value s = $"${s}.mp3"$ 'note I add the extension of the file in Assets MP.Load(File.DirAssets, s) MP.play End Sub You declare the media player in Sub Class_Globals if you use a B4XPages project: Private MP As MediaPlayer. You initialize it in Sub B4XPage_Created with: MP.Initialize2("MP") The files ' names in the Assets folder have the same name as the FileName column in the SQLite table. example: the assets shows sample1.mp3, but the table FileName has sampl1 without the extension. So when you click the xCLV item it adds the .mp3 extension as shown in the above code. If you still have difficulty, post some sample files or your project, you will get help. Upvote 0
aligol said: Can someone give me a hand? Click to expand... This is how I envision it. Suppose you have a database in xui.defaultfolder with a table that has 2 columns: FileName and Description: 1. You can use a select query to populate an xCustomlistview from the database located in internal with an item layout that has 2 labels. One label shows the fileName, the other the Description. The xCLV returned value needs to be the text of the 1st label, exple: CustomListView1.Add(Pnl, Label1.Text) 2. In the CustomListView1_ItemClick you have this code: Code: Copy Private Sub CustomListView1_ItemClick (Index As Int, Value As Object) Dim s As String = Value s = $"${s}.mp3"$ 'note I add the extension of the file in Assets MP.Load(File.DirAssets, s) MP.play End Sub You declare the media player in Sub Class_Globals if you use a B4XPages project: Private MP As MediaPlayer. You initialize it in Sub B4XPage_Created with: MP.Initialize2("MP") The files ' names in the Assets folder have the same name as the FileName column in the SQLite table. example: the assets shows sample1.mp3, but the table FileName has sampl1 without the extension. So when you click the xCLV item it adds the .mp3 extension as shown in the above code. If you still have difficulty, post some sample files or your project, you will get help.
A aligol Member Feb 20, 2023 #3 Thanks for your attention but Actually i confused, I'll be appreciate if you take a glance at my attachment project. One more problem is with my designer layout, when I load Item of my disigner views that their position assigned by cording to a panel that i created for showing them , they display smaller than their actual size at designer. Upvote 0
Thanks for your attention but Actually i confused, I'll be appreciate if you take a glance at my attachment project. One more problem is with my designer layout, when I load Item of my disigner views that their position assigned by cording to a panel that i created for showing them , they display smaller than their actual size at designer.
M Mahares Expert Licensed User Longtime User Feb 20, 2023 #4 aligol said: I'll be appreciate if you take a glance at my attachment project. Click to expand... Where is your attachment. You did not include it for members to take a look. Upvote 0
aligol said: I'll be appreciate if you take a glance at my attachment project. Click to expand... Where is your attachment. You did not include it for members to take a look.
A aligol Member Feb 20, 2023 #5 Mahares said: Where is your attachment. You did not include it for members to take a look. Click to expand... Upvote 0
Mahares said: Where is your attachment. You did not include it for members to take a look. Click to expand...
M Mahares Expert Licensed User Longtime User Feb 20, 2023 #6 aligol said: but Actually i confused, Click to expand... You still have not exported your project. You need to zip it and export it to the forum. Upvote 0
aligol said: but Actually i confused, Click to expand... You still have not exported your project. You need to zip it and export it to the forum.