将onCreate代码转移到onResume

时间:2015-05-15 16:57:56

标签: android onresume

每当我从回收站视图中删除一个项目时,它都不刷新列表,我必须再次打开应用程序以刷新

我认为问题出在onResume上,因为每当我回去它都不会刷新

我的onCreate代码

Field

这里我放入了我的onResume

protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(com.barakah.camel.R.layout.browse_fragment_layout);
        setActionBar();
        recyclerView = (RecyclerView) findViewById(com.barakah.camel.R.id.my_recycler_view);
        layoutManager = new LinearLayoutManager(this);
        recyclerView.setLayoutManager(layoutManager);
        data = getIntent().getParcelableArrayListExtra("data");

        if (data.size() < 1) {
            AlertDialog.Builder builder = new AlertDialog.Builder(this);
            builder.setMessage("Oops! No Record Found.");
            builder.setPositiveButton("Ok", new OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {
                    // TODO Auto-generated method stub
                    alert.dismiss();
                    finish();
                }
            });

            alert = builder.create(); // create one
            alert.show();
        } else {
            adapter = new RecycleViewAdapter(data, SearchResultActivity.this);
            adapter.setClickListner(SearchResultActivity.this);
            recyclerView.setAdapter(adapter);
        }
    }

任何人都可以指导我在onResume方法中做错了什么

0 个答案:

没有答案