Skip to content

Instantly share code, notes, and snippets.

@PcNy
Last active August 29, 2015 14:00
Show Gist options
  • Save PcNy/befe5465bc7b9008e0b1 to your computer and use it in GitHub Desktop.
Save PcNy/befe5465bc7b9008e0b1 to your computer and use it in GitHub Desktop.
public class UserActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_user);
if (savedInstanceState == null) {
getFragmentManager().beginTransaction()
.add(R.id.container, new PlaceholderFragment())
.commit();
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.user, menu);
return true;
}
public static class PlaceholderFragment extends Fragment{
private CardArrayAdapter mCardArrayAdapter;
private CardListView listView;
private ArrayList<Card> cards;
public PlaceholderFragment() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_user_n1, container, false);
cards = new ArrayList<Card>();
mCardArrayAdapter = new CardArrayAdapter(getActivity(),cards);
listView = (CardListView) rootView.findViewById(R.id.userDetailList);
if (listView != null){ listView.setAdapter(mCardArrayAdapter); }
return rootView;
}
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment