Android TextView with multiple lines

I want a TextView that should be broken into 4 lines. For e.g. Vishal Vyas Having 342 Reputation Note, the gravity should be center_horizontal I tried following : <TextView android:gravity=”center_horizontal” android:id=”@+id/lblUserRep” android:layout_width=”70dp” android:layout_height=”wrap_content” android:lines=”4″ android:maxLines=”4″ android:text=”VishalVyas Having 342 Reputation” > </TextView> This works! but produces following output: VishalVyas Having 342 Reputation Problems: It doesn’t work […]

How to persist permission in android API 19 (KitKat)?

In my application I store the path of image in my SQlite db for further use. The path that I get is content:// When I retrieve this path from the database and try to retrieve the image from that path android throws java.lang.SecurityException: Permission Denial: opening provider from ProcessRecord{42c84ec8} (pid=23911, uid=10248) requires android.permission.MANAGE_DOCUMENTS […]

Installation failed with Android Studio, APK not signed

Recently change to Android Studio from Eclipse and I have also changed the JDK from java-open-jdk to jdk1.7.0_45. Now I’m trying to run my first app and I get this message: Installation failed since the APK was either not signed, or signed incorrectly. If this is a Gradle-based project, then make sure the signing configuration […]

change checkbox background color in android

i have to develop one i have to use i have to select checkbox means the default background color is yellow.but i wish to change the background color using gradient for checked and unchecked can i change this.please help me. this is my current code: <CheckBox android:id=”@+id/rempasswordcheckbox” android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:layout_below=”@+id/passwordview” android:layout_y=”200dp” android:paddingLeft=”45dp” […]

How do I cancel an Android http request?

I’m using AsyncTask to initalize AndroidHttpClient and execute a POST request in doInBackground(). I’d like the user to be able to cancel the request by pressing the back button. AsyncTask has a cancel() method which only changes the boolean return value of isCancelled() and then waits for doInBackground() to finish before calling onCancelled(). This means […]

android + google map api v2 + current location

i am creating an app with a google map view and i want this app to detect the current location of the user and display the lat and long with a marker on the map but all i can do until now is the display of the google map and the detection of current location […]

Android NDK: load_library: cannot locate srand

I have an android project where I use native code to do stuff with SIP (using libosip2 and libeXosip2). My native code is compiled together with the libraries’ sources into one module. The code compiles just fine and the generated library has all the symbols I expect it to have, but when I try to […]

Transparent GIF in Android ImageView

I am trying to display the transparent GIF image in my app with no success. I can get to download and display the icon in an ImageView but with white background instead of transparent. I have already tried these solutions with no sucess: Convert GIF to PNG programatically Has anyone figured out how to display […]

Unit Test Cases with JUnit +(Robolectric or Mockito or both in Android)

This is first time I have to write unit test cases in Android. So I have searched lots of things. Robolectric framewordk – Runs on JVM Mockito Framwork – Mocking objects So I have some doubts in Robolectric & Mokito. Should I have to use Robolectric only with JUnit in Android app? Should I have […]

Eclipse AVD Nexus 5 emulator not working

I’m trying to run a nexus 5 emulator in Eclipse AVD but I get a blank screen, I tried Nexus 4 emulation and it works fine, but not Nexus 5 for some reason. I tried this on multiple computers. This is just running an emulator with no project, so it’s not a code issue. Please […]

Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.