Code example for Fragment

Methods: getResources, onActivityCreated

0
public class TrendingUserFragment extends Fragment {
  private Resources resources;
 
  @Override 
  public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    resources = getResources();
  } 
 
  /** 
   * The Fragment's UI is just a simple text view showing its instance number. 
   */ 
  @Override 
  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.trendinguser, container, false);
    ViewPager vp = (ViewPager) v.findViewById(R.id.trendinguser);
    vp.setAdapter(new TrendingUsersAdapter(getActivity(), R.layout.trendinguseritem));
    return v;
 
  }