Hello I am writing an Android app and I have set up Proguard to obfuscate my application. I however use a classloader to dynamically load different extensions to my application. The problem is that these don’t load correctly if their names are changed. How do I keep Proguard from obfuscating specific class names? Answer Use the -keepnames option in your
Tag: android
Possible to determine size of file to be downloaded?
I currently have the following code which reads a file located on the web and writes it to a file on the phone: Does anyone know whether it is possible (using the setup above or otherwise) to determine the total number of bytes which are to be read before commencing with the download (in order to publish percentage progress to
Android Call a method from another class
I know that this Question is repeated but I can’t find the answer in the Internet. I want to call a method from another class. I have Class1 and Class2. In Class 2 I have this method: I want to call the above method from Class1. Thanks for any answer. —-EDIT—- —-LogCat— Answer You should use the following code :
What is the Simplest Way to Reverse an ArrayList?
What is the simplest way to reverse this ArrayList? Answer Example (Reference):
Loop through Months in Java / Android
I want to loop through months of the year and print out. for example: 01/2012 02/2012 03/2012 04/2012 etc… Here is my code: It is printing out in int’s 1 2 3 4 5 However, when I convert it to a date string, as seen in code above, it does this: 05/2012 06/2012 08/2012 11/2012 03/2013 08/2013 Basically, the gap
Is it possible to cast a retrieved Class object (via reflection) to an interface?
I have 3 projects in my workspace – A, B, and C which is an Android lib project. A contains an Activity named Atest B contains a class named Btest which implements interface I. C contains the I interface. Both A and B are installed on my Android device. During Atest runtime, i’m executing the next code: Now here is
How to remove the decimal part from a float number that contains .0 in java
I just want to remove the fractional part of a float number that contains .0. All other numbers are acceptable.. For example : Is there any method available to do that other than “comparing number with “.0″ and taking substring” ? EDIT : I don’t want ACTING FLOAT NUMBERs (like 1.0, 2.0 is nothing but 1 2 right?) I feel
Android Fatal Signal 11
In the app I’m developing on Android, I keep getting a Fatal Signal 11 error. I think it’s something to do with the way that I’m accessing the memory but I can’t figure out what is causing it. Here’s the LogCat: Answer I had been trying to call an uninitialised Canvas inside another Class so when it was trying to
Draw a scaled Bitmap to the Canvas?
The following code defines my Bitmap: … And the following code is used to execute/draw it (the unscaled Bitmap): My question is, how might I set it to draw the scaled Bitmap returned in the form of Bitmap scaled, and not the original? Answer Define a new class member variable: Bitmap mScaledBackground; Then, assign your newly created scaled bitmap to
How can I get the package name of the current launcher in android 2.3 and above?
How can I get the package name of the current launcher in android 2.3 and above programmatically in Java ? Answer I think you should be able to use PackageManager.resolveActivity(), with the home intent.