小编chu*_*ann的帖子

此Handler类应该是静态的,否则可能会发生泄漏(com.test.test3.ui.MainActivity.1)

我是android的新手,我尝试开发一个系统但是当我完成代码时,处理程序会显示此警告

下面显示我编辑后的代码,事件ontounch中的处理程序显示警告处理程序无法解析.我尝试将//忽略处理程序,我尝试运行应用程序并将其结果强制关闭.

public class MainActivity extends Activity {



protected static final int STOP = 100;
ImageView iv;
private ProgressBar pb;
LinearLayout ll;
private AnimationDrawable anim;
ScrollView sv;
private SQLiteDatabase db;
private boolean flagscanning = false;


@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    ll = new LinearLayout(this);
    new HandlerClass(this);

            db = SQLiteDatabase.openDatabase(Environment.getExternalStorageDirectory()+"/antivirus.sqlite", null, SQLiteDatabase.OPEN_READONLY);  
            iv = (ImageView) this.findViewById(R.id.imageView1);
                    //???????
            pb = (ProgressBar) this.findViewById(R.id.progressBar1);
            ll = (LinearLayout) this.findViewById(R.id.ll);
                    //??ImageView?????????
            iv.setBackgroundResource(R.drawable.bg);
                    //sv???????????
            sv = (ScrollView) this.findViewById(R.id.scrollView1);
            anim = (AnimationDrawable) iv.getBackground();
}

private …
Run Code Online (Sandbox Code Playgroud)

android memory-leaks static-class android-handler

3
推荐指数
1
解决办法
9378
查看次数