省去中間的算法部分,前後結構如下
public class MainActivity extends ActionBarActivity
{
private ImageButton Imagebutton=null;
private TextView textView=null;
private Handler handler=new Handler()
{
public void handleMessage(Message msg)
{
String result=msg.obj.toString();
textView.setText(result);
}
};
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Imagebutton =(ImageButton)findViewById(R.id.button1);
textView = (TextView)findViewById(R.id.textView2);
Imagebutton.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View v)
{
new Thread()
{
public void run()
{
try{
//算法全部省略了,不然肯定是太長不看 = =
}
catch(Exception e)
{
e.printStackTrace();
}
}
}.start();
}
});
}
}
就是這樣,檢查了幾次,都沒發現錯誤,可是eclipse始終提示那個錯誤,請大神解答一下,謝謝!
已經解決了~是一些函數寫的地方不讀