How to change string resource xml values in Android programatically?
Is there any possibility to Edit String.xml values in Android? Please suggest me the possible ways.
I want to provide Enable/Disable option for my App. To accomplish this I can use SQLite database. But I doesn't like to Use DB for a single variable value.
Thanks in Advance.
With Regards,
Raghavendra K.
Asked by: Cherry857 | Posted: 24-01-2022
Answer 1
You aren't going to be able to edit String.xml directly. However there is a middle ground, look into using SharedPreferences. Those are great when you just have a couple values to store and don't feel like dealing with a full database.
Answered by: Roland471 | Posted: 25-02-2022Similar questions
android - Programatically change icon resource on click
I am trying to change the source of the Intent.EXTRA_SHORTCUT_ICON_RESOURCE
public class ShortcutActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// The meat of our shortcut
final Intent shortcutIntent = new Intent(this, ShortcutResult.class);
ShortcutIconResource iconResource = Intent.ShortcutIconResource
...
android - Can I set the string resource to a different language programatically?
I have a arabic strings.xml file. I also have an English one.
In my settings activity, I want to be able to change the language used by the user. Like, is there a method like setStringResource(string.xml-ar)?
java - Android programatically add layout resource to view
I have a scrollview in an activity that I want to populate. Each item I want to add to the list is made up of several views (text view, image view, etc). Instead of programmatically creating each view, and adding it to a linear layout, and then adding that to the containing layout, is it possible to instead create a predefined layout resource with these items and instead add it to the view and programmatically change the...
android - How to loop through xml resource to set ID programatically
Does somebody here have experienced how to loop through xml resource file to get ID from there and set it to view Programmaticaly.
i have already tried to research but nothing seems close to my problem
private fun createImageView(){
newView = ImageView(this)
coordinatorLayout.addView(newView)
newView.id = NewViewAssignedID //This is how i set up ID rightnow
newView.layoutParams....
android - How to change custom component height programatically
I've prepared custom component based on LinearLayout. Whole component is defined in XML. Currently to use it you have to write:
<com.xxx.android.components.TopMenu
android:layout_width="fill_parent"
android:layout_height="44dp"
/>
Is it possible to set width and height in the java constructor? So it would be possible to write just:
<com.xxx.android.compo...
android - How to scroll programatically a ScrollView?
I have a little problem with a ScrollView. I have a layout for an activity which is made with a ScrollView. This scrollview contains two ListViews.
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rootViewGroup" android:layout_width="fill_parent"
android:layout_height="wrap_content" ...
Android: (Newb Question) Programatically creating views based on xml
Sorry for the Newb-ness.
I want to create a list of view elements in a LinearLayout (vertical). I created an xml layout that is a TableLayout called "category_list.xml"
<TableLayout>
<TableRow>
<ImageView />
<TextView />
<CheckBox />
</TableRow>
</TableLayout>
I want to iterate an array, on each itera...
registry - Android: Programatically changing phone settings and getting lost calls
Is it possible in Android to programatically change the phone internet settings (proxies also), email settings and other similar? Is there some kind of registry?
and what about getting the lost/received/etc calls? is it possible to get that info?
Programatically send SMS to email using Verizon Motorola Droid on Android
I was wondering if anyone knew the proper way to send an SMS message to an e-mail address using Verizon's CDMA Motorola Droid phone.
The internal messaging application appears to automagically do this. While 3rd party applications like SMSPopup don't seem to be able to properly reply to e-mail addresses unless you compose the message inside the messaging application.
When the internal messaging applicatio...
java - After making a call programatically, my android app crashes
The title explains all... I have this snippet of code in my application:
String url = createTelUrl("3112007315");
Intent intent = new Intent(Intent.ACTION_CALL);
intent.setData(Uri.parse(url));
context.startActivity(intent);
It does make a call, but once the call ends, my application crashes. I'd like to return to my application once the call has finished, but I read
android - Programatically detect presence of hardware call/hang up keys
One of my clients wants a code method that returns a boolean. True if the Android phone has hardware red/green call/hang up keys and false if it does not.
Sonething like this :
public void keyFeedbackFromInput(KeyEvent event) {
if (event.getAction() == KeyEvent.ACTION_DOWN
&& (event.getFlags() & KeyEvent.FLAG_VIRTUAL_HARD_KEY) != 0) {
// perform your logic here
}
}
dtmf - How to Programatically Dial a Phone number in the Android SDK?
How do you programatically do this in the Android SDK:
Dial a phone number
Bypass the keypad screen
Send additional DTMF after the number is dialed
Bypass the send DTMF tone prompt
I have managed to do 1 till 3 by dialing +555-1212w1234 but I am wondering if anyone knows how to bypass the send DTMF tone prompt.
android - Creating an ImageView with a certain style programatically
I want to do this programatically:
<ImageView style="@style/TitleBarSeparator" />
Where TitleBarSeparator is:
<style name="TitleBarSeparator">
<item name="android:layout_width">1px</item>
<item name="android:layout_height">fill_parent</item>
<item name="android:background">@color/title_separator</item>...
android - How to connect to internet programatically?
HI,
I'm building an Android application requiring internet connection, and I'm using ConnectivityManager to check whether the device is connected to internet or not. Now, what's the best strategy if it's not connected? Should I quit the application and tell the user to first connect to internet? or is there any way to ask the user if he wants to get connected and connect programatically?
Thanks
Jul
Still can't find your answer? Check out these communities...
Android Google Support | Android Community | Android Community (Facebook) | Dev.io Android