Saving changes of xml - android

I have an application that can edit the content of a XMl, pictures text audio, my problem is every time i exit the apps the content backs to its default value. Is there anyway to save the changes xml through runtime?

Related

How to modify a text view in app on user request

I'm trying to make a app with some nice features. One of them is :
I want to modify the text that you see in my app on user request. By this I mean if you see the MENU name in my app and want to display it as MAIN MENU or MY MENU etc you press a button, open an edit interface, write the name,click ok and that's it, text changed.
Here is little part of my aplication, it's shows up Slide to change the brightness, but user want to change it to “Brighness changer” . Any ideeas how to do that ?
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Slide to change the brightness"
android:id="#+id/textView"
I know that all my names are saved in a strings.xml file , problems is that i don't want to recompile my app everytime user will make a change..that's the main problem. I need a way to do it to avoid this .
Thanks in advance !
You store the string they want to use in a shared preference. When you display this layout, read the value from the shared preference and call setText on the TextView to set the text. Use the existing string as the default, of course.

How to display a change in the text in a textview while the activity is active?

I am having some huge issues and i looked through alot of post about it, but i have yet to find a solution..
I am making a logger activity which appends strings to a .txt on the sdcard. I then abstracts the txt and displays it in a TextView.
Heres the catch. While i can append changes while running, the textview do not want to display the changes in the textview before i go to another activity and then go back again to the log activity. I cannot understand how something so basic as displaying updates text can cause me so much problems.. and also its a very fundamental thing for my application.
try textView.refreshDrawableState();
Ok My Bad, dint read the question properly.Because you are displaying the text from the file on the sd card, you will have to populate the text every time to the text view, when you change the value in file.
textView.setText(getTextFromFile()); where getTextFromFile() is a method to fetch the text from the file.I hope you have already done the part to get the text from the file.If not, please tell.

capture the change in .xml file dynamically in android

is it possible to save the .xml file from the screen to main.xml?
my requirement is to.. first i create a xml files with some files
the user selects the required fields and select the save button.
from next onwards the application directly show the user specified fields only
. directly by saving the selected field in the xml and remaining fields should be invisible the main.xml code is directly change to newly userspecified view....
Have you considered using SharedPreferences? From what I've read from your description I think it should cover your needs.

How is my EditText content being saved?

I created a simple app that has nothing except an EditText element. When I run the app, I type text into the element and then press Ctrl-F11 to change the emulator's orientation. I've added logging information to make sure that the activity gets destroyed and re-created when I change orientation. I haven't added any code to save the text in the EditText element and yet, after the change of orientation, the text that I typed stays in the EditText element. What mechanism in Android is saving and then restoring the element's text (is it savedInstanceState) and how can I see for myself the details of this saving operation?
onSaveInstanceState()/onRestoreInstanceState() along with unique widget IDs. Some links that utilize:
Saving Android Activity state using Save Instance State
http://groups.google.com/group/android-developers/browse_thread/thread/5d7fd8da11c8e971

How to display large amounts of text on Android

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.

Categories

Resources