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);
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? 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.
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.
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.
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()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With