Skip to content

Instantly share code, notes, and snippets.

@burnix
Created August 12, 2015 19:43
Show Gist options
  • Save burnix/a182b6f2991cabe54374 to your computer and use it in GitHub Desktop.
Save burnix/a182b6f2991cabe54374 to your computer and use it in GitHub Desktop.
public class FirstFragment extends Fragment {
ListView lv;
String [] composers;
@Override
public View onCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
View view = inflater.inflate(R.layout.first_fragment,container,false);
composers = getActivity().getResources().getStringArray(R.array.composers);
lv = (ListView) view.findViewById(R.id.listView);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(getActivity().getApplicationContext(),android.R.layout.simple_list_item_2,composers);
lv.setAdapter(adapter);
return view;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment