Android :: Find Out If Resource Is Used
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
Aug 1, 2010
Thought you all might find this to be a helpful resource.
View 1 Replies
View Related
Jul 18, 2009
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?
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
May 11, 2010
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....
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
Nov 17, 2010
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:
CODE:.......
App2 does the following to try to get access to mytextfile.txt:
CODE:.........
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.
View 1 Replies
View Related
Sep 2, 2009
Is there a way to get the resource id associated with an ImageView?
you can set one using -- ImageView.setImageResource() --
sure what be nice if there was a -- ImageView.getImageResource().
View 2 Replies
View Related
Jul 8, 2010
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?
View 1 Replies
View Related
Sep 10, 2009
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*
View 2 Replies
View Related
May 24, 2010
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 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
View 3 Replies
View Related
Aug 10, 2010
Is it possible to get the extension of a raw resource in Android? How?
View 1 Replies
View Related
Mar 18, 2009
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?
View 2 Replies
View Related
Sep 5, 2010
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
View 2 Replies
View Related
May 19, 2009
I don't know how to get random access to a raw ressource. It is easy to get a FileInputStream from a raw ressource, what about RandomAccessFile?
View 2 Replies
View Related
Oct 10, 2009
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?
View 3 Replies
View Related
Aug 21, 2009
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)?
View 2 Replies
View Related
May 19, 2009
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?
View 4 Replies
View Related
Aug 13, 2009
I'm running into a strange problem while reading from an InputStream on the Android platform. I'm not sure if this is an Android specific issue, or something I'm doing wrong in general.
The only thing that is Android specific is this call:
CODE:........
This returns an InputStream for a file from the Android assets. Anyways, here's where I run into the issue:
CODE:........
When the read() executes it throws an IOException. The weird thing is that if I do two sequential single byte reads (or any number of single byte reads), there is no exception. Ie, this works:
CODE:........
Any idea why two sequential single byte reads work but one call to read both at once throws an exception? The InputStream seems fine... is.available() returns over a million bytes (as it should).
Stack trace shows these lines just before the InputStream.read():
CODE:........
Changing the buffer size to a single byte still throws the error. It looks like the exception is only raised when reading into a byte array.
View 12 Replies
View Related