问题
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