Android :: Alter Resource Values In APK After Creating It?
Apr 1, 2009Is it possible to alter the string values(in resources) in APK after creating it.
View 5 RepliesIs it possible to alter the string values(in resources) in APK after creating it.
View 5 RepliesWhen I make a new android project and I go to res/values/string.xml I get a screen to add android resources instead of a XML document. I keeps getting the error about : java.lang.NullPointerException.
Is there a way to just alter a XML file (like suggested in tutorials)?
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.
View 1 Replies View RelatedI'm sure this is simple, but I've got myself confused over it.I have an image resource, such as R.drawable.myimage, and I want to convert this into a URI.I tried:
Uri selectedImage = Uri.parse("android.resource://com.my.package/" + resourceId);
but this just returns a NullPointer. The resourceId needs to be dynamic (so I can pass any image to it), not just a hardcoded "myImage".Any help please?
Looking in the android sdk folders, I've found a file called values/config.xml. This seems to be somewhere that you can define values for later use in layouts and animations.
Given the config.xml:
<resources>
<string name="config_somePadding">50dip</string>
</resources>
How would I reference this to use as the layout_height in a layout xml file?
@string/config_somePadding is actually the only one I've found that doesn't throw an error in Eclipse (even though there isn't a config_somePadding in values/strings.xml), but it appears to just put an empty string.
In the sdk, they use an integer for animation duration. They reference it like this: android:duration="@android:integer/config_longAnimTime". Is there a way to use values that aren't integers in the layout_height attribute?
I have some messages being passed back from my server through php. The problem is that the messages are in English and if the user is using another language they will still get the message in English.
So I had an idea that maybe instead of passing back the message I would instead pass the String resource Id from the android app, that way the app will get the correct string id for their language. I will use this in a number of apps so I just want to know if the string id is guaranteed to be the same across different android projects?
My eclipse is not creating gen folder and android compilation creates error missing required gen folder.
View 3 Replies View RelatedI'm currently learning android and java, and I am having some issues with importing a java file.
I am working with the time and date example in the android api demos, and I want to put all the code relating to creating the time and date dialogs setting the values etc into a separate java file, and in my main java file run when the application starts, just declare the buttons and onclick events.
What is the best way to do this? Do I need to put all the code inside a class(that extends activity) or method? How do I use this inside my main class. Code...
I have a linear layout where the orientation needs to be "horizontal" in portrait mode and "vertical" in landscape mode.
There are a few ways to do this, the most obvious of which being to specify two layouts: one in "layout" and one in "layout-land".
However, this will require a certain amount of duplicate XML. I know you can use <include> to minimize this, but at the very least the attributes of the LinearLayout tag will need to be duplicated and two extra XML files need to be created (one layout-land file and one include for the contents of that layout).
As an alternative I do this in the LinearLayout tag:
android:orientation="@string/custom_lang_orientation"
and then: values/strings.xml <string name="custom_lang_orientation">0</string>
values/strings-land.xml <string name="custom_lang_orientation">1</ string>
which is a hack. Its also a bit risky because of the assumption the integer values for horizontal/vertical will not change. However, I suppose this is extremely unlikely. Any thoughts?
You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
I want to ask where does the defaults values of memory min-free values of a Rom reside? I mean what file I would have to edit to edit those values?
View 1 Replies View RelatedI have an XML resource file:
<resources> <section>
<category value="1" resourceId="@xml/categoryData1" />
<category value="2" resourceId="@xml/categoryData2" />
<category value="3" resourceId="@xml/categoryData3" />
</section> </resources>
Using XmlPullParser, on the START_TAG, I can use:
int value = parser.getAttributeIntValue(null, "value", 0);
to get values 1, 2, 3...however:
int resourceId = parser.getAttributeIntValue(null, "resourceId", 0);
doesn't work...it just yields the default value 0, or whatever I change the default value (3rd parameter) to be. Does anyone know what I am doing wrong or if this is possible?
I have tried to find a way to update the Android Preferences dynamically. Under the /res/xml directory I have placed a XML file with CheckBoxPreference elements. During application usage some of the preferences CheckBoxPreference elements may vary in numbers. Sometimes there may be 10 items and at other times there may be 35. I have tried to place the XML file in the /assets diectory (where read and write is possible) and then tried to replace the R.xml.<XMLFileName> in the addPreferenceFromResource(R.xml.<XMLFileName>) with the Assets file - but that won't work.
Is it in anyway possible to write to, during runtime programmatically, the XML files placed in the /res directory - and if - how do we do that? Is it possible - programmatically - to create and delete the entries in the preferences - thereby omitting the XML file?
I have an Options Menu on my Activity with an MenuItem "Start". When this MenuItem is selected I would like to alter the Menu so it contains a MenuItem "Stop". And finally when "Stop" is selected, I would like to alter back to "Start". Here is parts of my code that isn't working. I have both "Start" and "Stop" listed in mymenu.xml I should probably remove "stop" when the menu is created:
public class MyActivity extends Activity {
private boolean isStarted = false;
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
menu.removeItem(R.id.stop);
inflater.inflate(R.menu.mymenu, menu);
return true;....................
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.my_list);
mDbHelper = new MyDbAdapter(this);
mDbHelper.open();
fillData();
registerForContextMenu(getListView());....................
The date is actually stored as an int in the SQLLite database, and thus it displays as an integer. Does anyone know a way to create a date from the int so it doesn't display as 1216544611 (or whatever) but as "12/11/2009 11:32"?
i wanted to create a dynamic multi selection alert dialog, currently it only supports for hard coded values i think ?... i have tried several ways and very much unsuccessful till now .. i am fetching the values in JSON format and converting to JSONArray. but how to input this to builder.setMultiChoiceItems, because it takes only itemId from xml, cursor, or charsequence. i tried all ways i can think of for chaging the array to charsequence.. eclipse did not showed the error but app crashed in android throwing the cast exception ...
below is the code, any help / suggestion would highly help !! thankyou!.. (i am new to both java and andriod)........................
So i was wondering if its possible to for an application that i would write to be constantly running in the background and alter regular phone operations. For example this could be something like as soon as you receive a text from anyone you forward it automatically to another number. Is something like this at all possible? Just to be clear I don't want to solve that particular problem through some other means, just want to know if apps can accomplish that. Also if that is possible is it possible for an app that i write to alter more immediate and instant things, like an incoming call.
View 1 Replies View RelatedI have a multiplechoice dialog on my activity. I have a boolean array to keep track of which items are selected from the dialog. So I want each time an item is clicked to make the corresponding place on my array true. The array is being created in the onCreateDialog before the return.
public Dialog onCreateDialog(int id) {
userlistlocal=getuserlist(username);
boolean[] usernamechecked=new boolean[userlistlocal.length/3];
Arrays.fill(usernamechecked,false);
return new AlertDialog.Builder(Newevent.this)
.setIcon(R.drawable.ic_menu_invite)
.setTitle("Add People")..........
I just got the incredible and can't believe that the battery life is even worse than the eris! I am afraid to change ANY settings without knowing that it wont have impact on calls, texts, emails, internet, and so on. Does anyone have suggestions on specific changes to make?
View 3 Replies View RelatedI had my Desire for for a couple of months & love it but the mrs has just got a Wildfire & i have noticed when i text a message the TO box and the TAP TO COMPOSE boxes are about the same size with a big black box in between them that you cannot drag to alter size when the phone is held upright but on the Wildfire the TAP TO COMPOSE box is the is massive with a send & a attach button on the side when held upright. How do you alter this on the desire? When both phones are turned on the side the TAP TO COMPOSE box is big on both. Also the Wildfire has a torch app which uses the LED on the camera which is not on the Desire but the screen is so dull compared to my phone.
View 3 Replies View RelatedIs their any way to alter the stock keyboard? I like that it has the smile faces but they're not the Android faces. Id rather not use the text when I want the cool looking Android faces
Its not a big enough problem that id pay for "better keyboard" if its different there and I just switched to handcent so I don't have to go to more in the menu to get to the android smiles without typing them out all the way.
I've recently got a Hero and have to say so far I've very happy with it.But during set-up I entered one of my Gmail account details, but now realise my other account would have been a better choice.Aside from my dumb-arse-ery, I'd like to confirm if it's possible to alter the Gmail account, without having to do a factory reset?
View 13 Replies View RelatedImagine a scenario where you have just system access on android , and you want to continually have it, so you use the su binary, with the correct permission and the setuid flag on, and the owner being system, you do:
Code:
chown 1000:1000 su2
chown 06755 su2
you have the ability to change the owner to system as you do when rooting, and you also set the appropriate permission as you do when rooting,
06775 being the permission code to all have execution permission, and the setuid flag on.
But when dealing with system permission that doesn't work. it only works with root.
Is there a way to alter the intensity of vibration or the type of vibration for different notifications? Same goes for the LED light
View 5 Replies View RelatedAs above, are there any apps that can do this?A big bug bear of mine is that if im loading a particularly slow web page and want / need to be doing something else, if I open another app, effectively sending the browser to thr back ground, loading of the page stalls until the browser is called up again.It's not a big deal, but being so used to my blackberry loading pages in the background, I kind of miss it.
View 5 Replies View RelatedI have a collection of strings and declared the strings individually as arrays using ArrayList<String> al=new ArrayList<String>(); and called the arrays in the program by using al=getIntent().getStringArrayListExtra("titles");
Now, instead of declaring each of the arrays i have created SongsArray.java like below...
public class SongsArray {
private String title;
private String movieName;
private String singerName;
private String imagePath;
private String mediaPath;
public String gettitle()
{
return title;
}
public void settitle(String title) {.................
I have a string that contains a xml structure and there are two pieces of data in separate tags that I am after.
xpath has been added since API level 8, and with me being stuck with API level 3 (old phone for you ;-)) I need a way to get the data.
Would using a regular expression commit a huge sin? ;-) The xml isn't that big...
I want to get the number of launcher:cellWidth in xml:
CODE:.........
I know that I can get it in a Custom view by:
CODE:....................
But how Can I get it in a Activity? not a Custom view.
One of the Preferences in my PreferenceActivity needs to get its values from a database. How do I add these values?
View 1 Replies View RelatedI am new to android development, My new requirement is find Latitude and longitude for current position where device is present. how I get this.
View 2 Replies View RelatedThat's a lot of code... no time to read it over now.. but off the top of my head: look into either using a database, an Application class (that will run the whole time your app is alive), or adding extras to the Intent bundle before starting your subactivity. These are all methods to pass data around between activities.
View 4 Replies View Related