Android Question button with html code

ibra939

Active Member
Licensed User
Longtime User
i create button ande the code as following

WebView1.LoadHtml("<a href="url">link text</a> ")


but when i test the link not opening the link .mp3 directly will open?
 

ibra939

Active Member
Licensed User
Longtime User
no replay ?
 
Upvote 0

udg

Expert
Licensed User
Longtime User
Hi ibra,

try the following code:
B4X:
WebView1.LoadHtml("<a href="&QUOTE& url &QUOTE&">link test</a>")

where url is a string variable.

Umberto
 
Upvote 0

ibra939

Active Member
Licensed User
Longtime User
Hi ibra,

try the following code:
B4X:
WebView1.LoadHtml("<a href="&QUOTE& url &QUOTE&">link test</a>")

where url is a string variable.

Umberto

i will test the code thanks
 
Upvote 0

NJDude

Expert
Licensed User
Longtime User
There's no need to add QUOTE, you can do this:
B4X:
WebView1.LoadHtml("<a href='" &  url  & "'>link test</a>")
However, if you are linking to an MP3 (or any other media) Android won't play the media, you will have to download it first.
 
Upvote 0

ibra939

Active Member
Licensed User
Longtime User
There's no need to add QUOTE, you can do this:
B4X:
WebView1.LoadHtml("<a href='" &  url  & "'>link test</a>")
However, if you are linking to an MP3 (or any other media) Android won't play the media, you will have to download it first.

i want to download it but not working the link .mp3 direct ?
 
Upvote 0

NJDude

Expert
Licensed User
Longtime User
This is one way of doing it.

Note that recent versions of Android might play the MP3 automatically, but that might vary from device to device, this code will work on any version.
 

Attachments

  • Sample.zip
    10.8 KB · Views: 164
Upvote 0

ibra939

Active Member
Licensed User
Longtime User
This is one way of doing it.

Note that recent versions of Android might play the MP3 automatically, but that might vary from device to device, this code will work on any version.

so thanks i will tested now :);)
 
Upvote 0

ibra939

Active Member
Licensed User
Longtime User
Error ?o_O:eek:


Parsing code. 0.00
Compiling code. 0.02
Compiling layouts code. 0.00
Generating R file. Error
res\values-v14\theme.xml:7: error: Error: No resource found that matches the given name: attr 'android:windowTranslucentNavigation'.
res\values-v14\theme.xml:6: error: Error: No resource found that matches the given name: attr 'android:windowTranslucentStatus'.

The following objects added permissions (duplicates are ignored):
WebView:
android.permission.INTERNET
File.DirRootExternal / File.DirDefaultExternal:
android.permission.WRITE_EXTERNAL_STORAGE
HttpClient:
android.permission.INTERNET
 
Upvote 0

ibra939

Active Member
Licensed User
Longtime User
OK tested again ....
 
Upvote 0

ibra939

Active Member
Licensed User
Longtime User
the same error
error #5 variable declaration type is missing . string type will used
 
Upvote 0

ibra939

Active Member
Licensed User
Longtime User
It works fine on my devices.

Have you re downloaded and reinstalled the sample?

I jest open and test debug .

should i add any libs or something?
 
Upvote 0

ibra939

Active Member
Licensed User
Longtime User
the problem is
res\values-v14\theme.xml:7: error: Error: No resource found that matches the given name: attr 'android:windowTranslucentNavigation'.
res\values-v14\theme.xml:6: error: Error: No resource found that matches the given name: attr 'android:windowTranslucentStatus'.

Objects not read it fine in floder values-v14 > res > theme.xml
 
Upvote 0

ibra939

Active Member
Licensed User
Longtime User
Ok :( you main extract the file = RE INSTALL
 
Upvote 0
Top