i have create two Fragment with two TAB one for Register another one for Showing data,When i click the save button in fragment one,the data showing in second fragment(The second fragment i'm using listview Adapter)List view
Asked
Active
Viewed 434 times
0
-
Is the fragments are on same screen? – Pratibha sarve May 02 '17 at 06:54
-
yes, i have using 2 tab Register and Show – Anbu May 02 '17 at 07:06
-
So when you click register button on fragment first you want to update listview in fragment second. Is this the doubt? – Pratibha sarve May 02 '17 at 07:11
-
yes,it's correct – Anbu May 02 '17 at 07:20
-
You can use listener(i.e Interface) or local BroadCastReceiver to get update on second fragment – Pratibha sarve May 02 '17 at 07:22
-
please i'm new in android can you post the sample code – Anbu May 02 '17 at 07:23
-
Post your code here – Ferdous Ahamed May 02 '17 at 07:37
-
public class Visitorallow extends AsyncTask
{ @Override protected String doInBackground(String... params) { try{Connection con=connectionClass.CONN(); if(con==null){ Z="Error in Connection with SQL Server"; } else {String query="Update app_Registration set FlatOwner='"+1+"' where Id='"+RegIdno+"'"; PreparedStatement preparedStatement=con.prepareStatement(query);preparedStatement.executeUpdate(); Z="Update Successfully";isSuccess=true; } }catch(Exception ex){ isSuccess=false;Z="Exception"; } return Z; } – Anbu May 02 '17 at 07:44 -
https://github.com/muditsen/eventer try using the library for communication between activity and fragments or between 2 fragments. – mudit_sen May 02 '17 at 07:51
1 Answers
0
See communication between two fragment
More Easy How to create our own Listener interface in android?
or
Even you can use EventBus library for application components communication

Community
- 1
- 1

Pratibha sarve
- 369
- 2
- 11