Tag: java

CoordinatorLayout crashes app with IndexOutOfBoundsException

I’m getting a crash (from Crashlytics, unable to reproduce locally) in my app from the onLayout function in the CoordinatorLayout: Fatal Exception: java.lang.IndexOutOfBoundsException: Invalid index 3, size is 3 at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255) at java.util.ArrayList.get(ArrayList.java:308) at android.support.design.widget.CoordinatorLayout.onLayout(SourceFile:848) at android.view.View.layout(View.java:15237) at android.view.ViewGroup.layout(ViewGroup.java:4864) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:515) at android.widget.FrameLayout.onLayout(FrameLayout.java:450) at android.view.View.layout(View.java:15237) at android.view.ViewGroup.layout(ViewGroup.java:4864) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1888) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1742) at android.widget.LinearLayout.onLayout(LinearLayout.java:1651) at android.view.View.layout(View.java:15237) […]

Android Studio AndroidManifest.xml vs build.gradle

If anyone could help me understand some things regarding Android Studio, it would be most enlightening. So, I have switched from Eclipse to Android Studio around a month ago and so far have only been working on my migrated Apps. As such, I have been tinkering around with only the AndroidManifest.xml file as was customary […]

How to increase console output at the android Log class

For default Log on android platform has limited amount of character for console output. Around equal a bit more than 3000. Therefore, if the message is longer than 3000 characters, it is not shown on screen. I have not found a better solution than this: public class Log { private static int mode = android.util.Log.INFO; […]

Read/write to NFC tag with password protection

I need to write/read textual data to an NFC tag. The way I am expecting the read/write should work is the following: First time write I should be able to set password. Next time when anyone tries to read OR write, if he has the password then he should be able to do the read/write. […]

Android (Java) HttpURLConnection silent retry on 'read' timeout

So I’m using Google Volley for HTTP request, which basically uses Java‘s HttpURLConnection. According to my tests, the problem is this: When the ‘read’ timeout on the HttpURLConnection reaches, a silent retry is executed before the connection is closed and the relevant exception thrown (SocketTimeoutException). Note that: – I noticed this error when using HTTP […]

what to return in onStartCommand for a service

I have been looking through the documentation and sometimes the onStartCommand returns START_NOT_STICKY, sometimes it returns the following: @Override public int onStartCommand(Intent intent, int flags, int startId) { // TODO Auto-generated method stub return super.onStartCommand(intent, flags, startId); } I am now confused as to why some services return vs. super.onStartCommand(intent, flags, startId);

How to convert 16-bit PCM audio byte-array to double or float array?

I’m trying to perform Fast Fourier Transform on a .3gpp audio file. The file contains a small 5 second recording in 44100kHz from the phones microphone. Every Java FFT algorithm I can find only takes double[], float[] or Complex[] inputs, for obvious reasons, but I’m reading in the audio file in a byte-array, so I’m […]

Tablet UI doesn't work on my app

I am trying to create an app which has two different UIs for tablets and phones, and I’m using fragments to implement this. I have created two separate xml files for each tablet and phone layout and both are called activity_main.xml, with the phone layout being placed in the res/layout folder and the tablet layout […]

WifiP2pManager return BUSY state on CreateGroup

sometime when I try to create a group in WifiDirect it returns back WifiP2pManager.BUSY message as reason for failure. I am not sure why this happens. But if I restart the WIFI interface it will again work. What could be the possible reason for this? How this can be avoided? is there any way to […]

No project.properties file and NullPointerException during build of new android application

I’m having a horrible time figuring out a problem that makes it impossible for me to use the new android application wizard in ADT to create a new android project. First a little background. I’ve been using ADT (the ADT bundle) for about 6 months and haven’t had a problem. Because the current issue only […]

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