1
この問題についての類似の質問を読んで解決策を見つけましたが、私の場合の理由は何か分かりません。私のプログラムのコードラフは以下の通りです:Androidの致命的な例外:Looper.prepare()を呼び出していないスレッド内でハンドラを作成できません
public class ReportSystem extends Activity implements SensorEventListener , Runnable{
ReportLocation reportObj = new ReportLocation(this); //my other class
Thread thread_send = new Thread(this);
Handler handler = new Handler() {
public void handleMessage(Message message) {
msg.setText("---"));
}
};
public void onCreate(Bundle savedInstanceState){
//something...
}
public void onSensorChanged(SensorEvent event){
if(event.values[0] > 10)
thread_send.start(); // thread is started..
}
public void run(){
reportObj.send(); //connect with server and send data by the help of RepotLocation class' send function
handler.sendEmptyMessage(0);
}
}//end class
この問題を解決するにはどうすればよいですか?