Android :: Cannot Get Resource From Droid Application / Way To Do
Jan 27, 2010
I am buiding an Android app, and I have a problem to get resource from string.xml.
I need to have an URL in String.xml that will be used several times through the app.
I tried Resources.getText("my_url"), but this does not work. Eclipse complains when I use this.
Do you think this is the best way to do ?
View 2 Replies
Nov 24, 2009
I am experiencing a memory / resource leak on a T-Mobile G1 device with my application. I installed the "Task Manager" application from Android market and my memory usage is not monotonically increasing. It stays relatively flat over time. Furthermore, none of the other processes are chewing up tons of memory either (really, I can get into this state with just my app running). I am not experiencing this problem on any of the other Android phones (including Eris, Hero, and Droid).
The interesting thing is that if I kill my application, the phone is *still* very slow and sluggish. The only thing that seems to be able to get me out of this situation is a battery pull. If I run my application for about 3 hours, the phone starts to become very sluggish. Even simple operations like hitting the "home" button take many seconds. I'm not sure what to do at this point and am wondering where I can go from here.
View 3 Replies
View Related
Oct 8, 2010
I have a application 'A' and application 'B'. Say, I have a string resource in the application 'A'.
<string name="abc">ABCDEF</string>
How do I access the value of abc from the Activity in 'B'.
I tried the following method.
try { PackageManager pm = getPackageManager();
ComponentName component = new ComponentName( "com.android.myhome", "com.android.myhome.WebPortalActivity");
ActivityInfo activityInfo = pm.getActivityInfo(component, 0);
Resources res = pm.getResourcesForApplication(activityInfo.applicationInfo);
int resId = res.getIdentifier("abc", "string", null);
} catch(NameNotFoundException e){ }
Always resId is returned 0 always. Can anyone please let me know if I could access string abc from the application 'B'.
View 1 Replies
View Related
Sep 17, 2010
Is there any way for us to store remote image in apk resource folder. I developed one application for showing list of images.user have interaction with the images. Now I done this by place image before packaging. Now I want to supply image from remote server. Which way is better and how to do?
View 2 Replies
View Related
Jul 11, 2009
Can somebody suggest the best book or online resource for beginning android apps development?
View 25 Replies
View Related
Mar 9, 2010
I just would like to ask if anyone have encountered this strange behavior with other phone models or specifically HTC Tattoo wherein I have this service running for almost 5 hrs then after sometime the system kills the service. The phone does not restart actually nor any other 3rd party applicaton running in the background. Its only the service I have is running. I was wondering what were the causes that would force to close my service. Another strange thing is that before the service was closed I still can see all the logs in the logcat but after I saw that the service was closed I don't see any log information already seems like the phone was totally disconnected from my eclipse.
View 2 Replies
View Related
Sep 1, 2010
I have an app with locally stored .jpg files. I would like to be able to send the images (1 at a time, on user interaction) to the Gallery app's activity using an explicit intent.
View 3 Replies
View Related
Aug 3, 2010
I 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?
View 1 Replies
View Related
Jun 30, 2010
Is there a way I can find what resource a particular ImageButton is set to, at any given time?
For eg: I have an ImageButton that I set to R.drawable.btn_on onCreate. Later, at some point, the ImageButton gets set to R.drawable.btn_off. I want to be able to check what resource the ImageButton is set to in my code.
View 3 Replies
View Related
Dec 11, 2009
Is there a resource or link that compares the version of Android in the various Android phones, i.e., version 2.0 versus 1.5, or whatever?
View 4 Replies
View Related
Aug 13, 2010
I want to get image resource id by its name
View 2 Replies
View Related
Jun 28, 2010
Is there any way to have an html file (i.e. an html template) be a resource in android? I'd like to reference it in a similar way that i store strings in the res/values/strings.xml. However, when i do this, it appears the HTML is not getting rendered correctly when i use code...
View 1 Replies
View Related
May 13, 2010
My application will have some customisation for each company that uses it. Up until now, I have been loading images and strings from resource files. The idea is that the default resources will be distributed with the application and company specific resources will be loaded from our server after they click on a link from an email to launch the initialisation intent. Does anyone know how to replace resource files? I would really like to keep using resource files to avoid rewriting a lot of code/XML. I would distribute the application from our own server, rather than through the app store, so that we could have one version per company, but unfortunately this will give quite nasty security warnings that would concern our customers.
View 3 Replies
View Related
Jan 14, 2010
I have an xml resource in res/values/integers.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<integer-array name="UserBases">
<item>2</item>
<item>8</item>
<item>10</item>
<item>16</item>
</integer-array>
</resources>
and ive tried several things to access it:
int[] bases = R.array.UserBases;
this just returns and int reference to UserBases not the array itself
int[] bases = Resources.getSystem().getIntArray(R.array.UserBases);
and this throws an exception back at me telling me the int reference R.array.UserBases points to nothing
what is the best way to access this array, push it into a nice base-type int[] and then possibly push any modifications back into the xml resource.
I've checked the android documentation but I haven't found anything terribly fruitful.
View 1 Replies
View Related
Sep 6, 2010
When 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)?
View 2 Replies
View Related
Aug 29, 2010
Droid X - 2.2 - Rooted
Attempting to deodex, followed the instructions exactly on this thread ([HOW-TO] Manually deodex your phone.) but on my last step when entering "mount -o ro,remount -t ext3 /dev/block/mmcblk1p21 /system" I get the following response from cmd prompt, "mount: Device or resource busy"
The OP said I should try placing the phone in Windows Sync mode or whatever it's called, as opposed to USB Mass Storage, just tried that and again, same message.
If no ideas how to fix this, does anyone at least know what to do so that when I reboot I won't have to do a Nandroid restore? It's getting really annoying going on the 3rd or 4th time.
View 7 Replies
View Related
Oct 17, 2010
Droid X - 2.2 - Rooted
Attempting to deodex, followed the instructions exactly on this thread ([HOW-TO] Manually deodex your phone.) but on my last step when entering "mount -o ro,remount -t ext3 /dev/block/mmcblk1p21 /system" I get the following response from cmd prompt, "mount: Device or resource busy"
The OP said I should try placing the phone in Charge Only mode or whatever it's called, as opposed to USB Mass Storage, just tried that and again, same message.
If no ideas how to fix this, does anyone at least know what to do so that when I reboot I won't have to do a Nandroid restore? It's getting really annoying going on the 3rd or 4th time.
View 2 Replies
View Related
Sep 6, 2010
I am using the function decodeResource(Resources res, int id, BitmapFactory.Options opt).I am using it in the following way:
BitmapFactory.decodeResource(getResources(), R.drawable.image,opt);
My question is instead of using R.drawable.image which is an image in resdrawable folder, I want to use a image from sdcard.Is it possible? How to get the resource id of an image in the sdcard?
View 3 Replies
View Related
Oct 11, 2010
I do have a lot of language specific resources. There's one point in my Android apps where I do get a resource value and need to translate this value into the matching id. The value is not neccessarily in the language specific file for the current language (en/de/...). It's somewhere in there ... and it's unique.
After reading the docs and this thread "http://stackoverflow.com/questions/3476430/get-resource-id-by-passing-name-as-a-parameter-in-android" I thought that "getIdentifier(String name, String defType, String defPackage)" is the correct way to go but I can't get it to work. The result is always "0".
This code is part of an activity and I'm on Android 2.2.
Is it possible that Android doesn't take all resource files into account and searches just in the current language specific one?
For an example
CODE:....
To make things clear. I don't want to mis-use string resources as a database. It's only one part that occurs on very rare situations.
View 1 Replies
View Related
Jul 25, 2010
I will admit - I've never had a smart phone. Never. I was going to get one last year, but waited b/c I heard 2010 was 'the year of the smart phone' - and I'm glad I waited.Though I'd have to see it in person to know for sure, but I'm almost positive that DroidX will be my first smartphone. I'm VERY excited, but I want to make sure that I'm educated enough to use it for all it's worth (ie: my mom has had every iphone, but just leared to text message last month).Is there some place/book/thread/site that I can study which would tell me about smartphones from the very most basic all the way to the more advanced? I'm a smart girl, but I have to start somewhere!
View 1 Replies
View Related
Mar 18, 2010
When I use the first,app will crash in emulator but the second run well, how can I fix the first. Code...
View 1 Replies
View Related
Jul 20, 2010
If I am not wrong with the way android:sharedUserId is intended to work, then my question is how to avoid overlapping resource IDs? appt seems to aways start IDs at the same initial value (i.e. drawables at 0x7f020000), so there will be sort of conflict or ambiguation. As for now I failed to get that cleared w/o digging in OS sources. Or I miss anything, like magic "undocumented" appt option (not that aapt is documented at all)?
View 5 Replies
View Related
Sep 4, 2010
My application has resource conflict problem. Did some investigation, seems like all the resources within the apk file are cached after they are loaded on demand. The cache is stored in Resources.java mDrawableCache. The key to retrieve the drawable from this cache is combining the data and assertCookie fields of TypedValue class. In my application, there are 2 resources, ex. a color background and image drawable, evaluated to the SAME key value.. So just wondering, how can it happen?BTW, I am using eclair SDK.
View 2 Replies
View Related
Sep 15, 2010
Is it possible that a resource id (such as a generated id for a string resource) can be a negative int?Often, when defining a method that accepts a resource id, I want the caller to be able to specify a "null" value.For primitives this is not possible, but I'm wondering whether "any negative value" may be a good approach? Alternatively I suppose it would be OK to specify the argument as an Integer and take advantage of auto-boxing.Thoughts?
View 3 Replies
View Related
Jul 19, 2010
Can this kind of files (buttons) be used to create android applications, or you must use predefined buttons?
http://graphicriver.net/item/tabletphone-user-interface-professional-.
View 2 Replies
View Related
Oct 13, 2009
I had imported several .png files with names like 1.png, 2.png untill 59.png in my Android Project.But it gives this error:
Description Resource Path Location Type Syntax error on token "48", invalid VariableDeclaratorId R.java / TVGidsBelgie/gen/com/woutergo/tvgids line 14 Java Problem
How can i solve this?
View 4 Replies
View Related
Nov 15, 2009
we can let aapt not compress the resource via command -0. which api can be used to check the resource is compress or not?
View 2 Replies
View Related
Oct 3, 2010
I'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?
View 6 Replies
View Related
Jun 15, 2010
How can i get the resource id of an image if i know its name (in android)
View 1 Replies
View Related
Sep 21, 2010
I am looking for an efficient way to find out if a resource (mostly a drawable) is used in java or in an XML file.
The problem is, that on my current project the drawables are changed often and now I have some drawables, which might never be used.
Is there a tool/way to find those unused drawables without search each filename in the whole project?
View 2 Replies
View Related