Wrox Programmer Forums
|
BOOK: Professional Android 2 Application Development
This is the forum to discuss the Wrox book Professional Android 2 Application Development, 2nd Edition by Reto Meier; ISBN: 978-0-470-56552-0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Android 2 Application Development section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 26th, 2014, 05:24 PM
Registered User
 
Join Date: Jan 2014
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 5: Earthquake

I have completed part 1 of the earthquake in chapter 5. When i try to run the app this pops up: Unfortunately, Earthquake has stopped. And in eclipse the logcat pop up and i get this error message:
Code:
01-26 19:59:11.153: W/dalvikvm(859): threadid=1: thread exiting with uncaught exception (group=0x40a13300)
01-26 19:59:11.183: E/AndroidRuntime(859): FATAL EXCEPTION: main
01-26 19:59:11.183: E/AndroidRuntime(859): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.epstudios.earthquake/com.epstudios.earthquake.Earthquake}: android.os.NetworkOnMainThreadException
01-26 19:59:11.183: E/AndroidRuntime(859):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
01-26 19:59:11.183: E/AndroidRuntime(859):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
01-26 19:59:11.183: E/AndroidRuntime(859):  at android.app.ActivityThread.access$600(ActivityThread.java:130)
01-26 19:59:11.183: E/AndroidRuntime(859):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
01-26 19:59:11.183: E/AndroidRuntime(859):  at android.os.Handler.dispatchMessage(Handler.java:99)
01-26 19:59:11.183: E/AndroidRuntime(859):  at android.os.Looper.loop(Looper.java:137)
01-26 19:59:11.183: E/AndroidRuntime(859):  at android.app.ActivityThread.main(ActivityThread.java:4745)
01-26 19:59:11.183: E/AndroidRuntime(859):  at java.lang.reflect.Method.invokeNative(Native Method)
01-26 19:59:11.183: E/AndroidRuntime(859):  at java.lang.reflect.Method.invoke(Method.java:511)
01-26 19:59:11.183: E/AndroidRuntime(859):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
01-26 19:59:11.183: E/AndroidRuntime(859):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
01-26 19:59:11.183: E/AndroidRuntime(859):  at dalvik.system.NativeStart.main(Native Method)
01-26 19:59:11.183: E/AndroidRuntime(859): Caused by: android.os.NetworkOnMainThreadException
01-26 19:59:11.183: E/AndroidRuntime(859):  at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1117)
01-26 19:59:11.183: E/AndroidRuntime(859):  at java.net.InetAddress.lookupHostByName(InetAddress.java:385)
01-26 19:59:11.183: E/AndroidRuntime(859):  at java.net.InetAddress.getAllByNameImpl(InetAddress.java:236)
01-26 19:59:11.183: E/AndroidRuntime(859):  at java.net.InetAddress.getAllByName(InetAddress.java:214)
01-26 19:59:11.183: E/AndroidRuntime(859):  at libcore.net.http.HttpConnection.<init>(HttpConnection.java:70)
01-26 19:59:11.183: E/AndroidRuntime(859):  at libcore.net.http.HttpConnection.<init>(HttpConnection.java:50)
01-26 19:59:11.183: E/AndroidRuntime(859):  at libcore.net.http.HttpConnection$Address.connect(HttpConnection.java:341)
01-26 19:59:11.183: E/AndroidRuntime(859):  at libcore.net.http.HttpConnectionPool.get(HttpConnectionPool.java:87)
01-26 19:59:11.183: E/AndroidRuntime(859):  at libcore.net.http.HttpConnection.connect(HttpConnection.java:128)
01-26 19:59:11.183: E/AndroidRuntime(859):  at libcore.net.http.HttpEngine.openSocketConnection(HttpEngine.java:315)
01-26 19:59:11.183: E/AndroidRuntime(859):  at libcore.net.http.HttpEngine.connect(HttpEngine.java:310)
01-26 19:59:11.183: E/AndroidRuntime(859):  at libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:289)
01-26 19:59:11.183: E/AndroidRuntime(859):  at libcore.net.http.HttpEngine.sendRequest(HttpEngine.java:239)
01-26 19:59:11.183: E/AndroidRuntime(859):  at libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:273)
01-26 19:59:11.183: E/AndroidRuntime(859):  at libcore.net.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:486)
01-26 19:59:11.183: E/AndroidRuntime(859):  at com.epstudios.earthquake.Earthquake.refreshEarthquakes(Earthquake.java:71)
01-26 19:59:11.183: E/AndroidRuntime(859):  at com.epstudios.earthquake.Earthquake.onCreate(Earthquake.java:57)
01-26 19:59:11.183: E/AndroidRuntime(859):  at android.app.Activity.performCreate(Activity.java:5008)
01-26 19:59:11.183: E/AndroidRuntime(859):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
01-26 19:59:11.183: E/AndroidRuntime(859):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
01-26 19:59:11.183: E/AndroidRuntime(859):  ... 11 more





Similar Threads
Thread Thread Starter Forum Replies Last Post
Earthquake Chapter 6 newbie123 BOOK: Professional Android 4 Application Development 7 January 21st, 2013 07:09 AM
Chapter 7 Earthquake 2, Earthquake.java, error onActivityResult dbomberg BOOK: Professional Android 2 Application Development 2 November 30th, 2012 05:52 AM
Chapter 9 Earthquake 1 MellowFellow BOOK: Professional Android 2 Application Development 14 August 23rd, 2010 04:40 PM
Please help: Chapter 9 Earthquake 4 dahe BOOK: Professional Android 2 Application Development 0 July 21st, 2010 03:41 PM
chapter 5 Earthquake EricTapia BOOK: Professional Android 2 Application Development 2 April 14th, 2010 12:47 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.