Code example for Fragment

Methods: getResourcesonActivityCreated

public class TrendingUserFragment extends Fragment {
  private Resources resources;
  public void onActivityCreated(Bundle savedInstanceState) {
    resources = getResources();
   * The Fragment's UI is just a simple text view showing its instance number. 
  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.trendinguser, container, false);
    ViewPager vp = (ViewPager) v.findViewById(;
    vp.setAdapter(new TrendingUsersAdapter(getActivity(), R.layout.trendinguseritem));
    return v;
Experience pair programming with AI  Get Codota for Java