我尝试连接到SensorSimulator时程序停止工作

时间:2013-10-01 10:36:13

标签: android-emulator

我的程序在第二行崩溃时崩溃了:

mySensorManager = SensorManagerSimulator.getSystemService(this,Context.SENSOR_SERVICE);
mySensorManager.connectSimulator();

这是我在logcat上看到的:

10-01 06:28:17.479: I/Process(2009): Sending signal. PID: 2009 SIG: 9
10-01 06:28:18.519: I/Hardware(2040): Starting connection...
10-01 06:28:18.609: I/Hardware(2040): Connecting to 10.0.2.2 : 8010
10-01 06:28:18.630: D/AndroidRuntime(2040): Shutting down VM
10-01 06:28:18.630: W/dalvikvm(2040): threadid=1: thread exiting with uncaught     exception (group=0x414c4700)
10-01 06:28:18.661: E/AndroidRuntime(2040): FATAL EXCEPTION: main
10-01 06:28:18.661: E/AndroidRuntime(2040): java.lang.RuntimeException: Unable to start     activity ComponentInfo{com.example.sensortest2/com.example.sensortest2.MainActivity}:     android.os.NetworkOnMainThreadException
10-01 06:28:18.661: E/AndroidRuntime(2040):     at     android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
10-01 06:28:18.661: E/AndroidRuntime(2040):     at     android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
10-01 06:28:18.661: E/AndroidRuntime(2040):     at     android.app.ActivityThread.access$600(ActivityThread.java:141)
10-01 06:28:18.661: E/AndroidRuntime(2040):     at     android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
10-01 06:28:18.661: E/AndroidRuntime(2040):     at     android.os.Handler.dispatchMessage(Handler.java:99)
10-01 06:28:18.661: E/AndroidRuntime(2040):     at     android.os.Looper.loop(Looper.java:137)
10-01 06:28:18.661: E/AndroidRuntime(2040):     at     android.app.ActivityThread.main(ActivityThread.java:5103)

依旧......

这个烂摊子的问题是什么,我该怎么办呢?

0 个答案:

没有答案