Can I update the list view in one action and im in another action?

Currently, I have a tab with two tabs, one tab with a list and one with the make string option, so I can add them as a list. Both tabs have their own activity, because it made the code much more structured, and I do not need to repeat my name later.

Let's say im on a tab that prompts me to create a row and I click the update list button, how can I update the list view without startActivity ()? If I use startActivity (), it starts List.java, and instead of displaying the list on the list view tab, it takes up the whole screen, which does not match the purpose of the tab view. In other words, startActivity () moves focus from the tab view to the list and sends it to full screen.

Thank you for your time.

Edit: I want to update an action on the List View tab without launching a new action that appears in full screen and does not update it on the tab.

+3
source share
2

, (Activity), , .

Application. , onResume , .

:

public class MyApplication extends Application {
   private List<MyObject> myData;

   public List<MyObject> getMyData() {
     return myData; 
   }

   public void setMyData(List<MyObject> mydata) {
     this.myData = myData;
   }
}

, , MyApplication .

:

   public void onResume() {
      MyApplication app = (MyApplication) getApplication();
      List<MyData> data = app.getMyData();
      // update  my view with the data
   }
+2

, , , , , , , .

.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)

, .

0

Source: https://habr.com/ru/post/1767975/


All Articles