in my code lets say that I want to display some string in a fragment, and method getPlayerList takes 2 seconds(data from API), but method 'onCreateView' is returning the view before 'getPlayerList' finishing its execution.
I tried to implement it in many ways, but every thing was useless because I can't change 'return view;' place ^^".
is there any method instead of 'onCreateView' that suits my situation ?
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view=inflater.inflate(R.layout.fragment_tab4, container, false);
String result = getPlayerList();
//displaying the 'result' on this view
return view; }