Is it possible to refresh the view of a Fragment

后端 未结 3 884
滥情空心
滥情空心 2020-12-31 01:12

I changed the locale of my application programmatically, like following:

Resources res = context.getResources();

 DisplayMetri         


        
3条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2020-12-31 01:48

    I finally found the solution to it! Just run your view update code in the UI thread

    Example -

     getActivity().runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    user_arrayList.add(name);
                    adapter.notifyDataSetChanged();
                    tv_total_users.setText("Total Users : "+user_arrayList.size());
                }
            });
    

    Finally found this solution after trying for almost 4-5 hours!

提交回复
热议问题