I hope you can point me in a right direction,
Im making a Android app that gets content of a website,
At the moment my app loads dat webpage in a webview, but the page is to wide for almost every screen, so i had another idea:
webcontent(html) -> get contents of table with android -> make a listview -> when sliding right you get another day.
the webcontent is a timetable for school, a example is this one http://intranet.staring.nl/toepassingen/rooster/lochem/2W2/2012102920121104/2W01532.htm
what i want is that every day comes in a listview and that a user can swap right or left to change the day there seeing.
Now im getting already stuck on making the listview from the html source, can somebody help me with this?
You should access those data using a webservice...
Because otherwise you'll need to download a LOT of useless HTML code + parse it...
But IF this is the way you want to go, or you have no control over that website, you could read the file and simply parse it using regular expressions I guess.
Here are some tools I found:
JTidy
JSoup
Parsing HTML in Java?
Related
I am creating a mathematics app and have to display mathematical equations in my app. There are many answers related to this but I am not able to conclude how to do this?
As mentioned in the comments above you can use that library MathView or other possibilities are ,
You can go with using the spannable string and can make superscripts
and subscripts easily.
You can also use the HTML.fromHTML(String html) which will give you
the spanned text and that you can set it to the TextView.
Or else show a webview and load the html page that contains the
formulas and solutions. (This will be like creating a dynamic html
files with in the app and showing it in the Webiew)
I'm following this tutorial and I modified the example code to let it work for my XML file, now it renders HTML into a webView and the result is a raw list of items (not very beautiful). I don't understand why it chose a webView to display data. Now I don't know how to go forward, should I follow the original approach adding CSS styles and HTML or should I get data and display them with a native listView? my problem is that the whole example is build on the HTML string composition and it seems quite difficult to modify to get only data and put in a listview.
I have a very precise question:
I want to make an android application that can access this website http://www.cineklik.com/Showing-Now-Movies.aspx and then take the pictures of every movie in the Showing Now section and the title of this movie and put them both in a ListView (image on left and text on right or middle like in this example : http://blog.sptechnolab.com/2011/02/01/android/android-custom-listview-items-and-adapters/).
My main problem is that I don't know how to read data from this page because its source is very complex, so I need help for this particular issue most, but I would appreciate help on anything I can get !
Thanks.
in order to get a website's data you'll have to use an HTTPGet (if there is no API from that site). After that you'd be able to parse the response and use the data
Okay noob of the year question.
I have a website, which has several div. and one of those div I would like to put as the front end of an android app.
I.E, I have this div id
I want to put that entire element as the android application. Of course add buttons for it for various items, but right now that is my main obsticle.
I dont want to hard code the page into the android application, becuase of course that element changes.
Thank you in advance.
You could use a WebView to display a Website inside your application. See this article. If you want to display only one div of a website, you could move this div to another page. This should be the easiest method to achieve your goal.
BTW: There are no stupid questions ;-)
One option would be to code your site so that this DIV has a unique ID assigned to it. You could then download all of the HTML from your site into a string in your app, parse out this individual div you want (by finding the unique ID) and save it in a string named, say, html. Next you can place this DIV inside of a webview using webView.loadData(html, mimeType, encoding); where "html" is a string containing the div you extracted. So long as that DIV has content that has absolute paths to resources (images/links), it should load and display your content properly
I want to display about one or two full screens worth of text in an Android application (like a welcome screen or help screen), and I'm trying to figure out the best way of storing that text in the app. The text does not need formatting, but line breaks and empty lines must be preserved.
So far I have come up with the following alternatives:
Store the text in a long string in an XML file in res/values, access it like any other string and display it in a TextView. But then what is the proper way of handling line breaks, etc?
Store it in a text file in res/raw, read that from the application and display it in a TextView. Again, do I need to consider line breaks, etc, in this case?
Store it in an HTML file and display it in a WebView. Then how and where should I store the HTML file?
And there are likely more ways that I haven't thought of yet.
Is there a common way of achieving this? I would greatly appreciate sample code as well!
IMHO the most effective way would be setting up one or more strings within the strings.xml and using the \n escape sequence to force a linebreak whenever needed.
If you want to display your data directly as a WebView you should consider storing it within res/html.
But storing an extra text file within res/raw and reading it every time you want to access it doesn't seem very efficient.