I've got an Android app developed, and I'm at the point of a phone app development where everything seems to be working well and you want to declare victory and ship, but you know there just have to be some memory and resource leaks in there; and there's only 16mb of heap on the Android and its apparently surprisingly easy to leak in an Android app.
I've been looking around and so far have only been able to dig up info on 'hprof' and 'traceview' and neither gets a lot of favorable reviews.
What tools or methods have you come across or developed and care to share maybe in an OS project?
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?
I am working on an application that needs to find GPS location of the user. While testing my code on Droid i am unable to find the GPS location. While googling i found this link to an issue raised with Google.
But apps like Yelp can find the GPS location on droid. Is there a workaround to find the user location on a device? Here's the code I am using code....
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
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.
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!
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)?
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.
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?
I have an apk (App1) that has a raw resource (res/raw/mytextfile.txt) and I would like to read that text file from another apk (App2). I define a content provider in App1 and I override the openFile(Uri, String) method as follows:
App2 does the following to try to get access to mytextfile.txt:
However, when I read and write out the contents of the BufferedReader, I get way more than just the contents of mytextfile.txt.
I played with this some more and found that the file desriptor returned to App2 is pointing to the App1 apk file. I wrote out the contents of the BufferedReader to a file and did a binary comparison to App1.apk. The two files were identical.
In android docs, it is said that 140 still is ldpi, but when I change dpi to 140, I find mdpi resource is retrieved, can someone have idea? thanks a lot. btw, I read the code about how to get resource, seems ldpi's max dpi value is 131.25? Does google post the wrong doc?
I have requirement to implement button in lockscreen. So i have added new image here *frameworksasecore es drawable.* And i have modified the Keyguard_screen_lock.xml. Here i have added the ImageButton view. And i have even modified the strings.xml to display different string. As in the following discussion it has told like this. *You must not add public resources because it would change the public API and thus make your Android phone/device potentially incompatible with other Android devicesYou must not add public resources because it would change the public API and thus make your Android phone/device potentially incompatible with other Android devices.* ** *Please find the previous discussion in the bellow link*
I got "no resource found that matches the given name(at 'id' with value @id+/textview')" my main.xml file looks like this: <?xml version="1.0" encoding="utf-8"?> <TextView xmlns:android=" http://schemas.android.com /apk/res/android" android:id="@id+/textview" android:layout_width="fill_parent" android:layout_ height="fill_parent" android:text="@string/greetings"/> Any idea what I am missing? You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to firstname.lastname@example.org To unsubscribe from this group, send email to android-developers+ email@example.com For more options, visit this group at http://groups.google.com /group/android-developers?hl=en
I have an activity that serves 40 layout files. I like to map a given string say layout/main10 to the corresponding mnemonic in R.java class. Once I get the mnemonic, I can pass it to setContentView () in onCreate(). Is there a way of doing it?
I'm trying to find a way to open resources which name is determined at runtime only. Let me explain in more details. I want to have a XML that references a bunch of other XML files in the application apk. for the purpose of explaining lets say the main XML is main.xml and the other XML are file1.xml file2.xml...fileX.xml...
what i want is to read main.xml, extract the name of the xml I want (fileX.xml) for example. and then read fileX.XML. the problem I face is that what I extract form main.xml is a string and I can't find a way to change that to R.raw.nameOfTheFile
I need to use some inbuild drawable I found in http://developer.android.com/reference/android/R.drawable.html
I set drawable @drawable/ic_input_add to a button in my layout xml file. The add icon appears on the button of layout editor. But there is a error of that xml file said that Description Resource Path Location Type ERROR Error: No resource found that matches the given name (at 'drawableLeft' with value '@drawable/ic_input_add'). spend_list.xml / AccountBook/res/layout line 5 Android AAPT Problem. How to use a inbuild drawable?
I have some image names stored in a database, but the images themselves are in the /res/drawable folder of the application. I need to assign these images to some views at runtime, and I'm currently doing it this way:
// public static final String DRAWABLES_PATH = ":drawable/"; int resId = getResources().getIdentifier(packageName+DRAWABLES_PATH +imageName,null,null); mButtonX.setBackgroundResource(resId); // Is there a more efficient way to do it? Or should I be storing the images directly in the database (they are many)?
When I start my program I get this for 3 from 35 entries in the R.Java "no package identifier when getting value for resource xxxxxxx" I checked what could be wrong but the entries looks fine like similar where it does not come to a message like that?