N
N
Neonoviiwolf2017-09-13 01:53:55
Java
Neonoviiwolf, 2017-09-13 01:53:55

How to access fragment methods if there is a reference to View?

Good
there is a class for example

public class ItemConsist extends Fragment {
     public int id = 1; //переменная или метод класса, пофиг
      public View onCreateView(LayoutInflat....){}
}

create an instance of the class in the container, displaying its instance on the screen
ItemConsist itemConsist = new ItemConsist();
layoutArrayItemConsist.addView(itemConsist.onCreateView(inflater, layoutArrayItemConsist, new Bundle()));

now I need to get the public int id value of all ItemConsist instances from this container. There are multiple instances of ItemConsist
int index = layoutArrayItemConsist.getChildCount();
        for (int i = 0; index > 0; ++i) {
            View view = layoutArrayItemConsist.getChildAt(i);
}

And how can I get the value of variables and methods from this View?
the answer was

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question