Tag: android

Weird behaviour in drawing a ring using Path.arcTo() in Android

I have implemented an animated drawing ring by start sweeping at angle 0 to 360 successfully. However when the tail of the ring meets its head at 360 angle, all drawing is disappear. This is my code for the ring in onDraw() float startAngle = 270; float sweepAngle = -359; paint.setColor(Color.DKGRAY); paint.setShadowLayer(4, 2, 2, 0x80000000); […]

Verify merchant account with bank account in different country

As I noticed I did not receive further payments from Google until I dont verify myself. I am a sole traider, so I will have to send them an ID and an invoice. I share a flat in Austria and have a bank account there which I have used for receiving my android payments in […]

Keeping SQLite data after update

I have an app that has an sqlite with 3 tables. My concern is that, if I introduce an update that adds another table (so that’s 4 tables) then the updated version will wipe out the database. How can I backup/restore db given that the backup happens before the update and the restore after the […]

Is it recommended to check view for null with every findViewById call?

When inflating an element with findViewById, Android Studio always warns me that my inflated view may return null View v = inflater.inflate(R.layout.fragment_photo_gallery, container, false); and suggests I do something like surround with my statement with a null check: if (v != null) { mGridView = (GridView)v.findViewById(R.id.gridView); } Is it recommended to always do the mentioned […]

Fastest way to read long from file?

I have a file that contains about 200,000 long values that I want to read as fast as possible into a long[]. It’s for an Android app; function calls are slow (so anything involving reading a long at a time with a “for” loop will be super slow) and I need loading to be fast. […]

Android Custom EditText not showing cursor in ICS

I have an EditText in my application which is to only receive inputs from buttons I have placed on the screen. To avoid the soft keyboard appearing I have a customised EditText class as follows: public class CustomEditText extends EditText { public CustomEditText(Context context) { super(context); } public CustomEditText(Context context, AttributeSet attrs) { super(context, attrs); […]

Instant Run not working

Precondition Since I use android studio 2.0 (Release version) I get many inner class erros when compiling my app (those seem to be not relevant, as the app still works fine). When I disable instant run, my app works perfectly fine, if I enable it, the app crashes Observations The errors while compiling are following: […]

Creating Android library package including external (Native or Java) package

I have developed an application for computer vision algorithms that uses Native C++ library like OpenCV to capture camera frame and do image processing. My whole implementation resides in a native function which is called through an activity. Let’s say: public native int MYMETHOD(int width, int height,int[] rgba); I also load my library like this: […]

How to have Android App communicate with external MySQL db

I am really confused on how to get data in and out of an android app from the internet. I imagined that I would store information in the mysql db on the server I already have set up. But from what I have read, I would need some type of in-between web service to make […]

Android RelativeLayout height not following GridView height

I am having problem with a GridView within a RelativeLayout, which is again within a ScrollView. The problem is that the height of the RelativeLayout is not following the height of the contents of the GridView. When there are more than one rows, the GridView is clipped and a scrollbar appears, which is undesirable. I […]

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