Update the textview text in runOnUiThread is overlapped with previously setted text

梦想与她 提交于 2019-12-13 03:20:25

问题


I want to set the textview text with the mediaplayer.getCurrentPosition() in runOnuiThread(). But problem is that the updated text is overlap with the previous set text.

i am new to android and want to change text progmatically after some time that i have given

onCreate method

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_image_content_pop_up);

        imageUrl=new ArrayList<>();
        for(int i=1;i<=3;i++)
        {
            imageUrl.add("https://www.gstatic.com/webp/gallery3/"+i+".png");
        }
        LinearLayoutManager layoutManager=new LinearLayoutManager(this,LinearLayoutManager.HORIZONTAL,false);
        recyclerImagevIew=(RecyclerView)findViewById(R.id.image_recycler_view);
        recyclerImagevIew.setLayoutManager(layoutManager);
        ImagePopupAdapter imagePopupAdapter =new ImagePopupAdapter(this,imageUrl);
        recyclerImagevIew.setAdapter(imagePopupAdapter);
        background_Image=(ImageView) findViewById(R.id.background_image);
        cross_sign =(TextView)findViewById(R.id.cross_button);
        cross_sign.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
      //  StartAsyncTask();
       // StartTimer();

        handler=new Handler();
        runnable= new Runnable() {
            @Override
            public void run() {
                if(index<imageUrl.size()) {
                    Glide.with(getApplicationContext()).load(imageUrl.get(index)).into(background_Image);
                    index++;
                    handler.postDelayed(runnable, 5000);
                }
            }
        };
        handler.postDelayed(runnable,1000);




    }

来源:https://stackoverflow.com/questions/54230042/update-the-textview-text-in-runonuithread-is-overlapped-with-previously-setted-t

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!