ArrayIndexOutOfBounds in Thread.getState() ...

by Pent » Thu, 19 May 2011 04:56:32 GMT

Sponsored Links
 I've had this sometimes in the console, wrote it off as sporadic
malign alien influence. A user just contacted me that it started
happening after an upgrade from 2.2 to 2.2.2.

Brief version:

Caused by: java.lang.ArrayIndexOutOfBoundsException
at java.lang.Thread.getState(

Looks like a bug in the library or ... ?

No idea if it happens with newer Android versions, it's not mentioned
by the console error reports.


Full version:

java.lang.RuntimeException: Unable to start service with Intent
{ (has extras) }:
at android.os.Handler.dispatchMessage(
at android.os.Looper.loop(
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ArrayIndexOutOfBoundsException
at java.lang.Thread.getState(


Re: ArrayIndexOutOfBounds in Thread.getState() ...

by fadden » Fri, 20 May 2011 07:57:39 GMT


Weird.  That line is:

            int state = thread.getStatus();
            if(state != -1) {
                return VMThread.STATE_MAP[state]; // 812

The STATE_MAP array has Thread.State entries for all valid thread
states, suggesting that the thread is in some weird state.
Unfortunately the exception doesn't say what element it was trying to
access.  (Newer versions of the VM and core libs are more verbose on
these exceptions.)


Sponsored Links

Other Threads

1. Does App description matter in Android Market search listing

Lately I am seeing tons of spam apps that have huge app description
text. Take for example  the app "TOP Charlie Sheen Soundboard" from
Soundboard Master.

If you look at their app description it has like three of four pages
of all possible types of search keywords. Some of the keywords listed
are "car stunts jet", "plants vs zombies", "MADDEN NFL 11" and so on.
You get the picture.

My question is : does google do anything about it? Or their algorithm
just boost the app across all categories - which in my opinion is
happening because I do see such junk in lot of search listings in
Android Market.

Does google plan to address these kind of spam apps?


2. sending parcelable objects to different process

Hi there,
I want to send my custom object which implements Parcelable from one
process(application) to an activity in another one process. But I
still get error message: BadParcelableException:
ClassNotFoundException when unmarshalling. I accepted some advices but
still not working. Here is my code:

// here is my class which implements parcelable and which i want to
public class Place implements Parcelable{
        int ID;
        String name;
        boolean in;
        boolean notify;

        public Place(int ID , String name, boolean notify) {
                this.ID = ID;
       = name;
                in = false;
                this.notify = notify;

        public int describeContents() {
                // TODO Auto-generated method stub
                return 0;

        public void writeToParcel(Parcel dest, int flags) {
                dest.writeInt((in)? 1:0);
                dest.writeInt((notify)? 1:0);

        public static final Parcelable.Creator<Place> CREATOR = new
Creator<Place>() {

                public Place[] newArray(int size) {
                        return new Place[size];

                public Place createFromParcel(Parcel source) {
                        return new Place(source);

        private Place(Parcel p) {
                ID = p.readInt();
                name = p.readString();
                in = ((p.readInt() == 0)? false:true);
                notify = ((p.readInt() == 0)? false:true);

// In the service I put the Place object into bundle and I add it as
data to message, then i send it to replyTo(Messenger of the activity)
try {
  b = new Bundle();
  b.putParcelable("place", allPlaces.get(0));
  m = Message.obtain(null, GET_PLACE);
} catch (RemoteException e1) {

// Here is the handler which handles the message
b = new Bundle();
b = msg.getData();
b.setClassLoader(getClassLoader()); // somewhere i read i should reset
the class loader to the loader of the activity in different process
Place p = (Place) b.getParcelable("place");
Toast.makeText(getApplicationContext(), "name: ",

Can you help me pls or am I missing something? I'm going crazy, every
advice is worth.


3. Settine 3G only di Galaxy Gio

4. how to clear cache after read a file

5. [SIM unlocked Developer Phone]

6. internet filter

7. Fwd: WTS : [Pre-Order] NEW ITEMS!! High Quality Accessories From Korea (Sony Ericsson Xperia Arc, Samsung Galaxy SII / i9100, LG Optimus 2X, Nexus S, Atrix 4G, Galaxy Ace, dll)