A WebView loads HTML page from the /assets dir. When a user enters some data into a text field in that HTML file, can my WebView catch/save that data once a user preses some button or link?
Also, when a user returns to that page, can I fill the text field with the data he previously entered?
I am trying to create a way to save temporary data between HTML pages in /assets dir.
Related
I have a appData.db file which I collected form .apk file.
Now when I open this file into 'DB Browser for SQLite', some fields are not showing properly. It contains bangle text.
This field working good
This field is not working, this is actually bangla text
To do:
I want to modify the HTML file's content and put my own values in it. The HTML file has JS dependencies (saved locally to reduce network usage).
Already tried:
I opened the file as a String and performed necessary String operations to put my values in place, the I pulled the String to WebView using loadData, it doesn't work as the internally referenced JS files cant be found.
I can't seem to save the file after editing due to android's regulations.
What to do?
I am looking to put this d3js gauge in the Android app.
Any suggestion on how to efficiently pull this would be highly appreciated
What worked
Read the HTML file with InputStreamReader as a string
Perform String operations to modify the contents for the desirable outcome
Now load the String in the WebView as:
webView.loadDataWithBaseURL(null, str, "text/html", "utf-8",
null);
Where str is the HTML file's modified String.
This way we can load the HTML file from assets, modify it as per our needs, use local resources in the HTML code to speed up operations.
I'm developing a strategy game that will have a country full of kingdoms. I want to be able to store and read back in the information of the kingdomgs. I've looked at tutorials online but they just aren't specific to what I'm looking for. So basically:
-Where to store a text file which holds string values.
-The correct file path.
-And how to read from that text file, and check if it is empty.
You can store text data in string resource file:
https://developer.android.com/guide/topics/resources/string-resource.html
Also you can use asset to store text
https://developer.android.com/reference/android/content/res/AssetManager.html
And there is diffrenece:
Difference between /res and /assets directories
I have a paragraph of text with a url at the end of it. I have the text and link in the strings.xml. Is there anyway to get it to load a new Activity from the strings.xml file? I'm assuming I'll have to break up the paragraph text and link, but thought I'd check.
strings.xml:
The quick brown fox can be found at: http://thequickbrownfox.com\n more text here
I need to change the hardcoded url "http://thequickbrownfox.com" to load a screen inside my app instead of a page on the web.
strings.xml is purely an abstraction mechanism used for string lookup to facilitate multi language support etc; you cannot use it to load activities or do anything else programatically. It sounds like you are actually talking about parsing the url out of a particular paragraph stored within strings.xml and then depending on what that url is, you invoke a corresponding activity.
If this is the case then you can either parse out the url from the paragraph and respond accordingly.
OR
you can store your paragraph as one item in strings.xml and your url as another item and combine them programmatically in your code.
Either approach can be fine depending on what you are doing.
Having done some basic tutorials, I started making my first real android app in eclipse. I want this app to check if the text in an EditText matches the text on a PDFpage (this one: http://www.augustinianum.eu/roosterwijzigingen/14062012.pdf (it contains my school's schedule changes)). I've found out how to make the app check if the text in the EditText matches a string (with the method contains()), so now the only thing I need to do is to download all of the text of that PDFpage to a string. But I have no idea how to. Or is there maybe a method which I can check with if a PDFpage contains a certain word without downloading the entire website to a string?
Thank You!
A PDF is not a text-file, it is a binary file. Therefore you should not download the data into a string but into a byte array. Then you must extract the text data from the PDF using some PDF library. In that text you then can search your keyword.
The most interesting part will be to extract the text from the PDF. You may look around this site for other questions which tried the same. Here is a quick search or this.