Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I found out the name of the exception from the stack trace, but it's all I could get, still no clue to what's causing it and where it happens. So here's what I'm doing (lstItems is a ListView control in my activity:</p> <pre><code>cursor = adapter.fetchAllItems(); //that's a simple database adapter int a = cursor.getCount(); if (cursor.getCount()!=0) { startManagingCursor(cursor); String[] from = new String[] { adapter.KEY_NAME}; int[] to = new int[] { R.id.listView1 }; for (int i = 0; i &lt; cursor.getCount(); i++) { SimpleCursorAdapter cursorAdapter = new SimpleCursorAdapter(this, R.layout.manageItems, cursor, from, to); lstItems.setAdapter(cursorAdapter); //that's what causing the exception, if I comment this line out, everything's fine, but the list is not updated either. } } </code></pre> <p>So the code runs, and when the activity with the updated ListView is supposed to show up, the debugger stops with the following stack trace: </p> <pre><code>Thread [&lt;1&gt; main] (Suspended (exception IllegalStateException)) ListView.layoutChildren() line: 1662 ListView(AbsListView).onLayout(boolean, int, int, int, int) line: 1147 ListView(View).layout(int, int, int, int) line: 7035 LinearLayout.setChildFrame(View, int, int, int, int) line: 1249 LinearLayout.layoutVertical() line: 1125 LinearLayout.onLayout(boolean, int, int, int, int) line: 1042 LinearLayout(View).layout(int, int, int, int) line: 7035 FrameLayout.onLayout(boolean, int, int, int, int) line: 333 FrameLayout(View).layout(int, int, int, int) line: 7035 LinearLayout.setChildFrame(View, int, int, int, int) line: 1249 LinearLayout.layoutVertical() line: 1125 LinearLayout.onLayout(boolean, int, int, int, int) line: 1042 LinearLayout(View).layout(int, int, int, int) line: 7035 PhoneWindow$DecorView(FrameLayout).onLayout(boolean, int, int, int, int) line: 333 PhoneWindow$DecorView(View).layout(int, int, int, int) line: 7035 ViewRoot.performTraversals() line: 1045 ViewRoot.handleMessage(Message) line: 1727 ViewRoot(Handler).dispatchMessage(Message) line: 99 Looper.loop() line: 123 ActivityThread.main(String[]) line: 4627 Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method] Method.invoke(Object, Object...) line: 521 ZygoteInit$MethodAndArgsCaller.run() line: 868 ZygoteInit.main(String[]) line: 626 NativeStart.main(String[]) line: not available [native method] </code></pre> <p>I figured that happens because I'm doing something wrong with the UI thread, but I have no idea what. I'm not using multiple threads at all.</p>
    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.
    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