This is a concept problem.
I see many text file viewer in android market. They are able to open a txt file with thousand of words. The viewer shows the text content in hundred of pages, and allow go back to previous page, go to next page, etc.
My problem is, as the length of word are different. If you want to go to page 50, do you have to start from page 1 and check how many words is needed to fit in page 1 to page 49, then you know the first English word in page 50?
And when you go back one page, you don't know the first word of page 49. Again, how can I find it out efficiently?
Thank you.
If you don't have experience with text viewers, the best approach is webView based application. You can easily add some HTML/CSS to the text and pass it to web view. WebKit will do all the job. For example, hyphenation. Doing it yourself is kinda tricky, specially for multiple languages. WebKit can do it for your.
Speaking about your concept without WebKit - is it important to let user to change font? If yes, you should re-parse document on every changing, I guess. Anyway, the easiest way is to use percentage and show not exact page, but place that is very near. For example, you can find out the size of one page in pro-cents of the document and use it to get needed portions to show.
Good luck in your research!
Related
After many days, I almost finished my first app but the WebView ruined it in the end. Search functionality is way too slow with it.
The HTML/CSS page I wanted to display, after search, can sometimes become very big in size like one made with looping and concatenation over 7100 records from DB.
This takes forever for WebView to load.
I thought WebView would be easier option to start with as my data was HTML/CSS.
Now, I am considering to use some other way like TextView with ScrollView etc. I read that this needs my text to have all its apostrophe (') etc escaped.
Can anyone please suggest me what way should I take now. Please keep in mind that my data is going to be big. Like a user can search data(Book) that is about 25MB. So chances are something the user searches may be in all records that would be 25MB data needs to be displayed with smooth scrolling.
What is the best way to from here. I just need WebView to be replaced with some other View.
Thank you
EDIT:
I also have Arabic text along with English text, in case en/decoding should be considered.
You should do the search and pagination on the server, and use something like infinite scrolling on the client. The problem is not the technology that you chose but how you use it. Sending 25 MB worth of data to the client, at once, is never going to go well.
Take a look at this:
infinite scroll in android webview
I am looking to create an app that has about 50 pages of static content. I can give an example of what it would look like, so that it will be easy to understand the questions.
Imagine a Jokes app, with tens or hundreds of pages
The user can see a full list of jokes, which shows the headings in a list view
Selecting a joke subject will take them to the joke page
From there they can go 'Next' or 'Previous'
They should also be able to favorite a joke
Going to the Favorites pages, will list the favorites for them
The joke pages are static. I could add more jokes with an app update but there is no dynamic content. So I am planning to have any server side code that the app can call.
Now the questions:
In Android, can I achieve this with a single activity (for the joke display) and switch the content based on selection?
There are several to store the jokes - sqlite, separate html pages or just strings.xml. Which is better for these use cases?
If there are multiple headings within a single joke (i.e. formatting as bold for them to stand out), I need to store the formatting along with the content. So HTML looks like the option?
This may be out of scope, but I want to capture the content in a standard way so that if I build an iOS app for this, I can just worry about the UI part and use the same content. Again HTML is the option?
Thanks for looking.
Yes you can achieve this with a single activity.
This is really up to you but Android provides support for SQL Databases. You may also consider looking into content providers.
Note: I would not use strings.xml because you can't load new jokes into strings.xml. If you are getting your jokes dynamically from a website, then you really should either load your content into a database and have the app display from the database, or else just load each html page individually. The html page will be easier as you will basically just be making a browser app, but the database will certainly be faster and cleaner.
HTML is certainly an option, though this question seems a little bit vague. It really depends on how you want to get your jokes. If you want to grab them as HTML pages and just display them, then the work is done for you. If you want to parse through them and display them as an android specific app, then it will be more work but you have more control on the app side.
Yes if you want your app to work cross platform you can use HTML to standardize your view across multiple devices.
A couple of friends and I are setting up a little app business, and we are creating our general app for finding out all the latest news about our other apps. But we have a small problem.
We have a layout xml file with a table row in it. In the table row we want to show two textviews. One that says Current App version (Which we have done successfully) and the other one will show a few numbers from an HTML page which is live now.
I want to know, how would be able to get the text from the HTML document on the Web to that text view, or any other thing we could use.
(We know that the manifest will have to allow the internet)
Thanks
So in this TextView, you want to show the content of the HTML page? If this is the case, the best thing you could do is to replace the TextView with a WebView, where you could load the HTML page via its url.
If not this is the case, you can make a GET request to that HTML (i.e. using an Async Task), get the results and present them in the TextView.
Hope this helps!
I have a ebook single HTML page having text, video and audios, which I want to display as book pages able to slide left & right to view the previous page and next page respectively.
How do I slice the data to show for a particular page for both
orientations ?
I am trying to use WebView for it. Any other possible options?
Is HTML is a best way to store the content? Other options?
Well if you want to make an ebook reader you have to consider that the user may not be connected always to internet, so a web view implementation might cause frustration.
My advice is to go for a native version that download the text/images and act like a real text book reader. Maybe with android animation you can create effects and a nice look :)
Good luck,
Arkde
Here is my problem:
I need to create an interface, where a user could see a low-quality version of a PDF page, and choose a place to drop a small image onto. After that, I need to get the page number and the coordinates of the top-left corner and the bottom-right corner. I also need to make sure, that there is no way to move the image outside of the PDF.
What I could come up on my own, was to somehow convert the PDF to a bunch of images, which I could then show, and change pages, by just loading the image for the next page. And I could then create some sort of draggable on top of that, and read the coordinates.
So could anyone tell me how to get this done?
As a bonus, could someone help me with some tutorials, links and the sort, to resources that could help me with this?
From where I stand, this could be VERY interesting, but also very resource intensive, since the PDF's should be converted on the fly. Can it be done page by page?
Some technical specs:
Max file size - 4Mb, so the PDF wouldn't be awfully big
Min API - 8. I need it to work on Android 2.2
Ok, I've tried this out, and it all comes grinding to a halt on the PDF to image conversion, which with Open-source libraries takes about 10s for each page, making this a Non-option. A hat tip to Adobe for making it so fast with their app.