ユーザーが詳細を入力できるようにするアプリを作成していますが、ユーザーが送信ボタンをクリックするたびにエラーが発生します:残念ながらアプリは停止しました
android.os.NetworkOnMainThreadException
ログキャットは次のように述べています。
04-11 14:25:07.297: E/AndroidRuntime(971): FATAL EXCEPTION: main
04-11 14:25:07.297: E/AndroidRuntime(971): android.os.NetworkOnMainThreadException
04-11 14:25:07.297: E/AndroidRuntime(971): at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1117)
04-11 14:25:07.297: E/AndroidRuntime(971): at libcore.io.BlockGuardOs.connect(BlockGuardOs.java:84)
04-11 14:25:07.297: E/AndroidRuntime(971): at libcore.io.IoBridge.connectErrno(IoBridge.java:127)
04-11 14:25:07.297: E/AndroidRuntime(971): at libcore.io.IoBridge.connect(IoBridge.java:112)
04-11 14:25:07.297: E/AndroidRuntime(971): at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:192)
04-11 14:25:07.297: E/AndroidRuntime(971): at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:459)
04-11 14:25:07.297: E/AndroidRuntime(971): at java.net.Socket.connect(Socket.java:842)
04-11 14:25:07.297: E/AndroidRuntime(971): at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:119)
04-11 14:25:07.297: E/AndroidRuntime(971): at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:144)
04-11 14:25:07.297: E/AndroidRuntime(971): at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
04-11 14:25:07.297: E/AndroidRuntime(971): at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
04-11 14:25:07.297: E/AndroidRuntime(971): at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:360)
04-11 14:25:07.297: E/AndroidRuntime(971): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
04-11 14:25:07.297: E/AndroidRuntime(971): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
04-11 14:25:07.297: E/AndroidRuntime(971): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
04-11 14:25:07.297: E/AndroidRuntime(971): at com.erachnida.restaurant.versionoct.cart.RegistrationActivity.getHttpPost(RegistrationActivity.java:183)
04-11 14:25:07.297: E/AndroidRuntime(971): at com.erachnida.restaurant.versionoct.cart.RegistrationActivity.SaveData(RegistrationActivity.java:135)
04-11 14:25:07.297: E/AndroidRuntime(971): at com.erachnida.restaurant.versionoct.cart.RegistrationActivity$1.onClick(RegistrationActivity.java:49)
04-11 14:25:07.297: E/AndroidRuntime(971): at android.view.View.performClick(View.java:4202)
04-11 14:25:07.297: E/AndroidRuntime(971): at android.view.View$PerformClick.run(View.java:17340)
04-11 14:25:07.297: E/AndroidRuntime(971): at android.os.Handler.handleCallback(Handler.java:725)
04-11 14:25:07.297: E/AndroidRuntime(971): at android.os.Handler.dispatchMessage(Handler.java:92)
04-11 14:25:07.297: E/AndroidRuntime(971): at android.os.Looper.loop(Looper.java:137)
04-11 14:25:07.297: E/AndroidRuntime(971): at android.app.ActivityThread.main(ActivityThread.java:5039)
04-11 14:25:07.297: E/AndroidRuntime(971): at java.lang.reflect.Method.invokeNative(Native Method)
04-11 14:25:07.297: E/AndroidRuntime(971): at java.lang.reflect.Method.invoke(Method.java:511)
04-11 14:25:07.297: E/AndroidRuntime(971): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
04-11 14:25:07.297: E/AndroidRuntime(971): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
04-11 14:25:07.297: E/AndroidRuntime(971): at dalvik.system.NativeStart.main(Native Method)