Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Build a Simple Android App (retired 2014) Getting Started with Android Android Setup and the Crystal Ball Project

website to api

hi i wish to convert a website to .api file to keep in play store. how to do that. i don't want to have any ads wen i keep in playstore.

3 Answers

I'm semi-confused. If you were meaning a .apk file then I have the answer, if not then I can't help because I'm not familiar with that.

But to convert a website to an android application what you would do is create an instance of a WebView. This allows for ordinary html to go inside. You will need to look at the documentation and figure out what the static method is that tells the operating system that you don't wish to utilize nor provide a prompt to the user for the default web browser. Instead all of your web content will be viewed inside of your own ViewGroup container native to your application. There is also some constant you'll need to pass to the operating system to also state that for any hyperlinks...you wish to launch those inside of the layout as well and not the system's currently configured default browser. Good luck!

Also it might be worth trying to take advantage of the localization feature that Android provides which may be a great advantage to implementing a website with its' content and code encapsulated within your Android application because you can have the opportunity to have a website that adapts to the each respective user's locale setting on their mobile device. In order to do that you will need to spend a lot of time adding a lot of String elements with their values for different languages I'd imagine. However I do have absolutely no experience in what I am talking about but in my opinion I would try to fit as much of the content as possible in this String file. You may even consider cramming for example all the text content of a "p" element in the html code under one string element. Definitely try to include any navigational strings required to use the application if the off chance you decide to not utilize symbols and instead go with text for your list items in your ul in the nav element for example ( html5 I don't know I guess you would use a div if you don't like html5...All I learned ;))

Here you go. I found some good resources for you. http://developer.android.com/guide/webapps/index.html