Discussion Forums  >  Uncategorized

Replies: 3    Views: 207

creedifee
Aspiring developer
Profile
Posts: 19
Reg: Jan 11, 2012
Tyler, TX
190
01/16/12 06:33 AM (14 years ago)

Javascript dynamic link opens new webpage, but wont open an .mp3 URL

Hi, I am building an Android app using BT 1.4, and am wanting a single link to open a different mp3 file each day. I have this working nicely with some javascript (see http://appcontent.biblespoken.com/apptest.html), but would like to have the javascript in a custom html page of the app. I have tried this, but when I do, it will not open the mp3 file specified. However, if I replace the mp3 URL with a webpage URL, it will load the webpage. Any ideas on how to fix this? Many thanks!
 
creedifee
Aspiring developer
Profile
Posts: 19
Reg: Jan 11, 2012
Tyler, TX
190
like
01/16/12 10:11 PM (14 years ago)
Solved by putting the html file into the assets folder in Eclipse, and referencing it as described below. ---------------------------------------------------------- In 1.4 Android (I don't think 1.5 is out yet even for early adopters but either way this will should always work). If you have a custom html view and want to pull images or other resources locally for performance put them in the /assets directory of your project. You can then refer to them via 'file:///android_asset/' in your html. So /assets/foo.gif in your project gets pulled locally as <img src='file:///android_asset/foo.gif' /> in your custom html. This works for a custom url also, instead of linking to an external url in the box in buzztouch admin page put in a url to an html file preceded by file:///android_asset/ and so long as you put the html file in you assets directory it will load in a blink of an eye ;) Not sure how this forum deals with html so hopefully the html entities I used above will make this clear. I will be hacking a webpage based game I wrote in 1999 to run in an Android app without having to change hardly any of the html or JavaScript and I will put up a couple of blog posts and link to them here to show what customizations I used on the base Buzztouch project. All in all I think this is a great platform to demystify mobile app development :)
 
COOKUP
Aspiring developer
Profile
Posts: 259
Reg: Aug 02, 2011
Coral Sprigs, F...
7,140
like
01/18/12 11:36 AM (14 years ago)
hey Tyler! Thanks for the input. I was wondering how you would put a custom url in the asset folder as a url is just a adress, if theres a way i would certainly appreciate the input!
 
COOKUP
Aspiring developer
Profile
Posts: 259
Reg: Aug 02, 2011
Coral Sprigs, F...
7,140
like
01/18/12 11:38 AM (14 years ago)
oops! didn't read the post correctly, you did explain, Sorry tyler, and thanx!!!
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.