The best practice for creating a text file reader on android? - android

I want to create an app that reads and displays a big text file, so basically, it's a text file reader. There is something specific with the reader is that I would like to show a background image with the text. When the text scrolls, the image moves along with it.
I wondered what is the best practice for this? TextView? WebView? Or using SurficeView to draw the text/animation directly?
Thanks,

I would recommand a WebView. But this would be easier if you already save the large Text as a HTML-Page. You can then use the loadURL()-method to show you'r HTML-File (i guess this is for the help-page?)

Related

Best way to load ~500 paragraphs plus options

I'm just getting started and trying to make a simple app after going through some of the Google Codelabs. I wrote a Choose your own Adventure type of game. It consists of 500 paragraphs, and at the end of each paragraph is usually a choice of the next action to take (ie paragraph to load) and possibly some game logic. For now I am concentrating on the text only.
It seems simpler to make 500 text files and load up whatever file number is necessary, however it makes more sense to load ALL the paragraphs as the entire text takes up roughly 300Kb as a text file.
How would I even attempt this? I know I would need a text array and I file reader. I think it would be more work to format the paragraphs with a delineator to separate them, as it may be simpler to just create 500 files and write a While loop feeding my array.
That should fulfill my current objective, but when I want to add the choices at the end of the paragraphs, it seems as if a JSON or XML file that includes the text and choices would be better. I could not figure out how to even attempt this.
Example Paragraph: "You hear a horseman galloping and spin towards the sound. Do you have the skill of Forest Stealth? If you do, turn to 95. If you do not, turn to 234."

Flow&Dynamic TextView with images inside it

I think that HTML might be a solution. But how can I achieve this:
with multiple screens sizes support?
I have found this library: FlowTextView
But it doesn't provide the way to put images inside text, like html does. And I also want to drag/resize image's inside text :D
Important to keep images on the same place on multipile devices.
So. What is the solution? Must I go ahead with custom View?
What can you recomend?

Android, how to display scores and other texts to look like any other game?

I'm a beginner in android development and i started to code a game few days ago.
I've almost finished it and now i want to have some nice texts in my canvas. I want to display the scores, the bonuses that the player has and some other stuff.
The problem is i have no idea how to make them look nice. I dont want a normal text to be displayed, and i want to make it pop on the screen when an action is done.
Can anybody give me some advice?
I want to make it look like this http://static.appgamer.net/images/articles/screen568x568_2.jpeg
What you're looking for is called bitmap fonts. Here you can find a pretty good article about the technique: http://obviam.net/index.php/using-bitmap-fonts-in-android/
Basically you have to prepare your font as a bitmap composed of separate glyphs. Then load the bitmap and create a description of each glyph (name, position, size). Then you have to just walk through a string you want to draw and draw parts of the font bitmap instead.

Preview image of text file in Android

I would like knowing if it's possible to obtain the preview image (thumbnail) of any text file in Android, like PDF, DOC, TXT, PPT, PPTX, RSS or HTML.
If the response is positive, how do I can make it?
I have the preview images of video and image files, and I want to obtain the same result for text files.
Thanks for your attention, greetings.
This can be quite a problem since you need to handle every file type individually.
TXT, RSS and HTML are simple enough, you can just read them all like a text file and display the text on the screen (first X characters, for instance, either with a TextView or by manually drawing it in the onDraw method. However, if you want to render the HTML, look at this question.
PDF is another story, you need some sort of rendering endine for that, you might want to look at MuPDF.
RSS and HTML Can work the same way as a normal TXT file.
PPT, PPTX and DOC will also need a custom renderer, you might want to look at this question.

Clickable resizable buttons on image android

I am trying to create an application which has a map image in it.
I want to add some areas (or buttons) to it so that when you click them the bubbles with information will appear.
I am new in android programming so asking to explain a bit how to implement it?
Also i need an image to be re-sizable just like a real map.
So should i attach the buttons to specific places on image and how to do so that the buttons will be connected to it when i re-size an image?
Which image type is better to use for this purpose? I heard that SVG would be better but i couldn't even add svg image to an application.
I appreciate any helpful advice.
For your problem you can use this:
http://catchthecows.com/?p=113
I need something similar, but the click on the image should change the content of that part as well.
When I find or implement the final solution I can post it here.

Categories

Resources