2015-08-01 13 views
5
java.lang.ArrayIndexOutOfBoundsException: length=7; index=7 
at android.content.res.Resources.toPreloadCookie(Resources.java:2447) 
at android.content.res.Resources.loadDrawable(Resources.java:2475) 
at android.content.res.TypedArray.getDrawable(TypedArray.java:749) 
at android.view.View.<init>(View.java:3806) 
at android.view.ViewGroup.<init>(ViewGroup.java:492) 
at android.widget.LinearLayout.<init>(LinearLayout.java:200) 
at android.widget.LinearLayout.<init>(LinearLayout.java:196) 
at android.widget.LinearLayout.<init>(LinearLayout.java:192) 
at java.lang.reflect.Constructor.newInstance(Native Method) 
at java.lang.reflect.Constructor.newInstance(Constructor.java:288) 
at android.view.LayoutInflater.createView(LayoutInflater.java:607) 
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55) 
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:682) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:741) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:482) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:414) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:365) 
at android.widget.Toast.makeText(Toast.java:254) 
at com.A.B.C.onPostExecute(SourceFile:1) 
at android.os.AsyncTask.finish(AsyncTask.java:632) 
at android.os.AsyncTask.access$600(AsyncTask.java:177) 
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:645) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:211) 
at android.app.ActivityThread.main(ActivityThread.java:5321) 
at java.lang.reflect.Method.invoke(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:372) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1016) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:811) 

Ich erhalte einige Fehlerberichte wie diese und nur von Sony Lollipop (5.0.2, API21) Benutzer. Keine Berichte von anderen Lollipop-Benutzern. Ich frage mich, was könnte das Problem sein, hatte Sony Buggy-Implementierung oder etwas Neues auf Lollipop benötigt?ArrayIndexOutOfBoundsException bei Toast auf Android Lollipop

Edit: Hinzugefügt Code

Toast.makeText(getApplicationContext(),"toast text",Toast.LENGTH_SHORT).show(); 
+0

Können Sie einige Codes zu diesem Fehler posten? – SilentKnight

+0

Wie bauen Sie Ihren Toast? – JohanShogun

+7

Dies ist nicht wegen Toast, überprüfen Sie, wo Sie auf Array-Elemente zugreifen –

Antwort

0

Sie nicht Anwendungskontext erstellen Toast, das gleiche mit Service/Contentprovider/BroadcastReceiver Kontext verwenden sollte. Sie können Abschnitt Context Capabilities in diesem Artikel lesen: Context, What Context?

Hope it helpful.