Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Refresh all view in android?

I working on messaging platform like whatsup.When ı send message ı must update the screen because ı am getting data in db.When i press send button ı must update View. I googled but ı can not exact solution.Can anybody help me?

EDIT:

my code:

RelativeLayout layout=new RelativeLayout(this);
                LayoutParams lparams = new LayoutParams(
                        1200,LayoutParams.WRAP_CONTENT);
                layout.setLayoutParams(lparams);
                //layout.setBackgroundResource(R.drawable.bubble);
                // Creating a new TextView
                TextView tv = new TextView(this);
                tv.setText(msgdesc[i]);
                layout.setGravity(Gravity.RIGHT);
                tv.setPadding(30, 10, 0, 0); 
                layout.addView(tv);
                bubbleLayout.addView(layout);
like image 714
DuyguK Avatar asked Feb 14 '13 10:02

DuyguK


People also ask

What is onrefreshlistener in swiperefreshlayout in Android?

This behavior of the SwipeRefreshLayout widget gives the user to refresh the layout manually. SwipeRefreshLayout class contains a listener called OnRefreshListener. The classes which want to use this listener should implement SwipeRefreshLayout.OnRefreshListener interface.

How to dynamically update a listview in Android?

How to dynamically update a listView in Android? This example demonstrates how do I dynamically update a ListView in android. Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 − Add the following code to res/layout/activity_main.xml.

How to reload activity in Android?

This example demonstrates how to reload activity in Android. Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 − Add the following code to res/layout/activity_main.xml.

What is ArrayList onrefresh () method in Java?

Whenever onRefresh () method is called the ArrayList data gets rearranged. A sample GIF is given below to get an idea about what we are going to do in this article.


1 Answers

You will need to call either requestLayout() or invalidate() depend on what you update exactly in your view

If you just need the View to redraw so call invalidate()

If you change the View bounds (e.g. size) call requestLayout()

like image 197
iTech Avatar answered Oct 15 '22 11:10

iTech