I’m developing a Baby Names app. I’m getting runtime exception while developing the App. Here is some part of the log file.
11-06 01:37:00.970: WARN/dalvikvm(631): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
11-06 01:37:01.040: ERROR/AndroidRuntime(631): FATAL EXCEPTION: main
11-06 01:37:01.040: ERROR/AndroidRuntime(631): java.lang.StackOverflowError
11-06 01:37:01.040: ERROR/AndroidRuntime(631): at balu.android.CommonNameTable.<init>(CommonNameTable.java:59)
11-06 01:37:01.040: ERROR/AndroidRuntime(631): at balu.android.CommonNameTable.<init>(CommonNameTable.java:59)
The functionality of App is going to be like this.
-
Select activity contains a menu, having the following items.
Common names
Uncommon names
Names popular in a specific city
https://github.com/Balu-Varanasi/BabyNamesApp/blob/master/src/balu/android/Select.java – is the link to the Select Activity.
2.When the user selects – “Common names” –
a new Activity will be launched. I contains a ListView, of all the names from CommonNameTable in the SQLite database. In the constructor of the table, I tried to insert records from the file “commonnames.txt”. Here is the links to the classes I have written.
I think this is the source of the problem.
https://github.com/Balu-Varanasi/BabyNamesApp/blob/master/src/balu/android/CommonNameTable.java
https://github.com/Balu-Varanasi/BabyNamesApp/blob/master/src/balu/android/CommonNames.java
Could you please help me in fixing this problem?
You are calling the CommonNameTable’s constructor recursively, Please remove the line indicated below