Note that there are some explanatory texts on larger screens.

plurals
  1. POGot an error showing invalid index, size is zero on eclipse while developing for android
    primarykey
    data
    text
    <p>Got an error showing invalid index, size is zero on eclipse and failed to open on emulator.</p> <p>Here is my mainactivity code and logcat error.</p> <pre><code>`package com.example.notetakingapp; import java.util.List; import com.example.notetakingapp.data.NoteDataSource; import com.example.notetakingapp.data.NoteItem; import android.os.Bundle; import android.app.Activity; import android.util.Log; import android.view.Menu; public class MainActivity extends Activity { private NoteDataSource dataSource; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); dataSource=new NoteDataSource(this); List&lt;NoteItem&gt; notes= dataSource.findAll(); NoteItem note=notes.get(0); note.setText("updated!!!"); dataSource.update(note); notes=dataSource.findAll(); note=notes.get(0); Log.i("NOTES", note.getKey() + ": " + note.getText()); }` </code></pre> <p><strong>Logcat:</strong></p> <pre><code>11-21 19:06:59.463: E/Trace(5216): error opening trace file: No such file or directory (2) 11-21 19:07:00.323: D/AndroidRuntime(5216): Shutting down VM 11-21 19:07:00.323: W/dalvikvm(5216): threadid=1: thread exiting with uncaught exception (group=0x40a71930) 11-21 19:07:00.343: E/AndroidRuntime(5216): FATAL EXCEPTION: main 11-21 19:07:00.343: E/AndroidRuntime(5216): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.notetakingapp/com.example.notetakingapp.MainActivity}: java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0 11-21 19:07:00.343: E/AndroidRuntime(5216): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180) 11-21 19:07:00.343: E/AndroidRuntime(5216): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230) 11-21 19:07:00.343: E/AndroidRuntime(5216): at android.app.ActivityThread.access$600(ActivityThread.java:141) 11-21 19:07:00.343: E/AndroidRuntime(5216): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234) 11-21 19:07:00.343: E/AndroidRuntime(5216): at android.os.Handler.dispatchMessage(Handler.java:99) 11-21 19:07:00.343: E/AndroidRuntime(5216): at android.os.Looper.loop(Looper.java:137) 11-21 19:07:00.343: E/AndroidRuntime(5216): at android.app.ActivityThread.main(ActivityThread.java:5041) 11-21 19:07:00.343: E/AndroidRuntime(5216): at java.lang.reflect.Method.invokeNative(Native Method) 11-21 19:07:00.343: E/AndroidRuntime(5216): at java.lang.reflect.Method.invoke(Method.java:511) 11-21 19:07:00.343: E/AndroidRuntime(5216): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 11-21 19:07:00.343: E/AndroidRuntime(5216): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 11-21 19:07:00.343: E/AndroidRuntime(5216): at dalvik.system.NativeStart.main(Native Method) 11-21 19:07:00.343: E/AndroidRuntime(5216): Caused by: java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0 11-21 19:07:00.343: E/AndroidRuntime(5216): at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:251) 11-21 19:07:00.343: E/AndroidRuntime(5216): at java.util.ArrayList.get(ArrayList.java:304) 11-21 19:07:00.343: E/AndroidRuntime(5216): at com.example.notetakingapp.MainActivity.onCreate(MainActivity.java:23) 11-21 19:07:00.343: E/AndroidRuntime(5216): at android.app.Activity.performCreate(Activity.java:5104) 11-21 19:07:00.343: E/AndroidRuntime(5216): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080) 11-21 19:07:00.343: E/AndroidRuntime(5216): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144) 11-21 19:07:00.343: E/AndroidRuntime(5216): ... 11 more 11-21 19:07:03.163: I/Process(5216): Sending signal. PID: 5216 SIG: 9 </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload