StackOverflowError 1.5 vs 1.6

I have a layout that creates a ListActivity. Before displaying the ListActivity, I execute a database query and then bind this data to a list using SimpleCursorAdapter.

All this works great at 1.6 and up. In 1.5, my query function succeeds, but after a few seconds a StackOverflowError occurs. Does anyone know why this error would occur in 1.5, but not in 1.6?

UPDATE: I determined that a crash occurs when I switch from Activity from TabView to Activity with ListView. If I go to the ListView from an Activity that does not contain a Tab View, then the crash will not happen. Activity with a ListView returns the cursor to the query, in which the database contains about 10 columns. Of these 10 columns, I show 3 columns on the screen.

Here is the thread for my code:

TabView Activity sends Intent to start List View Activity

onCreate() //of ListActivity
{
    showList();
}

showList()
{
    //open DataBase
    //perform query
    //create SimpleCursorAdapter
    //setListAdapter
}

So, for example, this works quite well on a Droid with 2.1 installed and on a 1.6 emulator. But the above didn’t work on HTC Hero with 1.5 and on targeting the emulator 1.5.

A crash occurs if I run setListAdapter. If this line is missing, everything works, but obviously my data is not displayed. It does not crash on the line calling setListAdapter, but it will eventually work if setListAdapter is executed.

Stack trace:

Thread [<3> main] (Suspended (exception StackOverflowError))

ViewRoot.draw(boolean) line: 1235   
ViewRoot.performTraversals() line: 1030 
ViewRoot.handleMessage(Message) line: 1482  
ViewRoot(Handler).dispatchMessage(Message) line: 99 
Looper.loop() line: 123 
ActivityThread.main(String[]) line: 3948    
Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]  
Method.invoke(Object, Object...) line: 521  
ZygoteInit$MethodAndArgsCaller.run() line: 782  
ZygoteInit.main(String[]) line: 540 
NativeStart.main(String[]) line: not available [native method]  
+3
source share
1 answer

Perhaps this error is not caused by the database.

In fact, this error often occurs when your layout hierarchy is too deep.

For 1.5, it can be 13 levels. Perhaps try checking it out with the View Hierarchy .

.

UPDATE: Stacktrace , . , , .

, LinearLayout ? - , ​​ , .

LinearLayout RelativeLayout. . , RelativeLayout , . 1.5 2.1.

+3

Source: https://habr.com/ru/post/1757506/


All Articles