[android-developers] Re: methods not working (force closing), is there something wrong?
Hmmm, I used that but I can't decipher what it's saying 11-21 06:04:48.388: WARN/dalvikvm(776): threadid=3: thread exiting with uncaught exception (group=0x4000fe70) 11-21 06:04:48.396: ERROR/AndroidRuntime(776): Uncaught handler: thread main exiting due to uncaught exception 11-21 06:04:48.487: ERROR/AndroidRuntime(776): java.lang.RuntimeException: Unable to start activity ComponentInfo {com.example.comparibook/com.example.comparibook.CompariBook}: java.lang.NullPointerException 11-21 06:04:48.487: ERROR/AndroidRuntime(776): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java: 2268) 11-21 06:04:48.487: ERROR/AndroidRuntime(776): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java: 2284) 11-21 06:04:48.487: ERROR/AndroidRuntime(776): at android.app.ActivityThread.access$1800(ActivityThread.java:112) 11-21 06:04:48.487: ERROR/AndroidRuntime(776): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1692) 11-21 06:04:48.487: ERROR/AndroidRuntime(776): at android.os.Handler.dispatchMessage(Handler.java:99) 11-21 06:04:48.487: ERROR/AndroidRuntime(776): at android.os.Looper.loop(Looper.java:123) 11-21 06:04:48.487: ERROR/AndroidRuntime(776): at android.app.ActivityThread.main(ActivityThread.java:3948) 11-21 06:04:48.487: ERROR/AndroidRuntime(776): at java.lang.reflect.Method.invokeNative(Native Method) 11-21 06:04:48.487: ERROR/AndroidRuntime(776): at java.lang.reflect.Method.invoke(Method.java:521) 11-21 06:04:48.487: ERROR/AndroidRuntime(776): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:782) 11-21 06:04:48.487: ERROR/AndroidRuntime(776): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540) 11-21 06:04:48.487: ERROR/AndroidRuntime(776): at dalvik.system.NativeStart.main(Native Method) 11-21 06:04:48.487: ERROR/AndroidRuntime(776): Caused by: java.lang.NullPointerException 11-21 06:04:48.487: ERROR/AndroidRuntime(776): at com.example.comparibook.CompariBook.onCreate(CompariBook.java:65) 11-21 06:04:48.487: ERROR/AndroidRuntime(776): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java: 1123) 11-21 06:04:48.487: ERROR/AndroidRuntime(776): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java: 2231) 11-21 06:04:48.487: ERROR/AndroidRuntime(776): ... 11 more On Nov 20, 9:08 pm, Arron arro...@gmail.com wrote: It is a lot easier to use ddms and find the exact exception and get the stack trace to figure out what's wrong. On Nov 20, 6:43 pm, Breezy mbre...@gmail.com wrote: I've a couple functions that basically parse XML but it's not XML it is parsing something similar. I use them in PHP to break apart large strings so I converted them to Java for this, but when I use them they force close. I use this code to call them String[] blah = dig_all (item, enditem, str); String blah1 = dig_data(author,endauthor,blah[0]); That's the gist of it. I know the string str is good, checked it, but if I run these lines I get a force close, if I comment them out I do not. The methods are below. See anything wrong? private String dig_data(String starter, String ender, String content) { String[] data = content.split(starter); String[] data1 = data[1].split(ender); return data1[0]; } private String[] dig_all(String starter, String ender, String content) { String[] result = null, data, data1; String data2; boolean more = true; int i = 0; int limit = 0; do { i++; data = content.split(starter); data1 = data[i].split(ender); data2 = data1[0]; if ((data2==null) || (limit0 i==limit)) more = false; else result[i] = data2; } while (more == true); return result; } -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: methods not working (force closing), is there something wrong?
Breezy wrote: Hmmm, I used that but I can't decipher what it's saying snip 11-21 06:04:48.487: ERROR/AndroidRuntime(776): Caused by: java.lang.NullPointerException 11-21 06:04:48.487: ERROR/AndroidRuntime(776): at com.example.comparibook.CompariBook.onCreate(CompariBook.java:65) When examining a stack trace, look for the Caused by: portion, as most of the time that will indicate where your error is. In this case, you have a NullPointerException on line 65 of CompariBook.java. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 2.8 Available! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: methods not working (force closing), is there something wrong?
Okay, I see. So what would be a solution to an error like that? I'm a PHP programmer in which I can write some sloppy code... I'm sort of lost on that. On Nov 21, 6:24 am, Mark Murphy mmur...@commonsware.com wrote: Breezy wrote: Hmmm, I used that but I can't decipher what it's saying snip 11-21 06:04:48.487: ERROR/AndroidRuntime(776): Caused by: java.lang.NullPointerException 11-21 06:04:48.487: ERROR/AndroidRuntime(776): at com.example.comparibook.CompariBook.onCreate(CompariBook.java:65) When examining a stack trace, look for the Caused by: portion, as most of the time that will indicate where your error is. In this case, you have a NullPointerException on line 65 of CompariBook.java. -- Mark Murphy (a Commons Guy)http://commonsware.com|http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 2.8 Available! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: methods not working (force closing), is there something wrong?
It is a lot easier to use ddms and find the exact exception and get the stack trace to figure out what's wrong. On Nov 20, 6:43 pm, Breezy mbre...@gmail.com wrote: I've a couple functions that basically parse XML but it's not XML it is parsing something similar. I use them in PHP to break apart large strings so I converted them to Java for this, but when I use them they force close. I use this code to call them String[] blah = dig_all (item, enditem, str); String blah1 = dig_data(author,endauthor,blah[0]); That's the gist of it. I know the string str is good, checked it, but if I run these lines I get a force close, if I comment them out I do not. The methods are below. See anything wrong? private String dig_data(String starter, String ender, String content) { String[] data = content.split(starter); String[] data1 = data[1].split(ender); return data1[0]; } private String[] dig_all(String starter, String ender, String content) { String[] result = null, data, data1; String data2; boolean more = true; int i = 0; int limit = 0; do { i++; data = content.split(starter); data1 = data[i].split(ender); data2 = data1[0]; if ((data2==null) || (limit0 i==limit)) more = false; else result[i] = data2; } while (more == true); return result; } -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en