我是新手 android 程序员,我发现这个程序的句柄问题,当我尝试运行下面的程序时,它被强制关闭。
为什么会这样??如何解决这个问题呢 ??谢谢
public class Antivirus extends Activity {
protected static final int STOP = 100;
private ImageView iv;
private ProgressBar pb;
private LinearLayout ll;
private AnimationDrawable anim;
private ScrollView sv;
private SQLiteDatabase db;
private boolean flagscanning = false;
private Handler handler = new Handler() {
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
if(msg.what==STOP){
ll.removeAllViews();
anim.stop();
}
String str = (String) msg.obj;
TextView tv = new TextView(getApplicationContext());
tv.setText(str);
ll.setOrientation(LinearLayout.VERTICAL);
ll.addView(tv);
sv.scrollBy(0, 20);
System.out.println(str);
}
};