【发布时间】:2015-08-26 04:23:26
【问题描述】:
public void onClick_Start(View v) {
//stores the weight value entered by user
final EditText sWeight = (EditText) findViewById(R.id.editTextWeight);
Log.v("EditText", sWeight.getText().toString());
String w = sWeight.getText().toString();
Weight_double = Double.parseDouble(w);
//sets to true because start was clicked
start = true;
counter = 0;
final int x1 = (int)lowX;
final int y1 = (int)lowY;
final int z1 = (int)lowZ;
new Thread(new Runnable() {
public void run() {
int x2;
int y2;
int z2;
int x3 = 10000;
while(start)
{
x2 = (int)lowX;
y2 = (int)lowY;
z2 = (int)lowZ;
if(x2 != x3)
{
if(x2 == x1&& y2 ==y1 && z2 == z1) {
counter++;
tv.setText(counter);
}
}
x3 = x2;
}
}
}).start();
}
-X,Y 和 Z 指加速度计的值 - 该方法应该在单击按钮时开始 - 计数器变量用于计算特定移动 - 我认为这可能是线程问题,但我不确定
【问题讨论】:
-
你的崩溃日志在哪里?
标签: java android multithreading crash