Skip to content

Instantly share code, notes, and snippets.

@jen6
Created July 15, 2015 01:12
Show Gist options
  • Save jen6/d468a59ed3b15ea44f40 to your computer and use it in GitHub Desktop.
Save jen6/d468a59ed3b15ea44f40 to your computer and use it in GitHub Desktop.
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.section_1,container,false);
ListView mListView = (ListView) view.findViewById(R.id.mList);
BusListGetter get = new BusListGetter();
BusList[] bus_arr = get.Get(1);
mAdapter = new ListViewAdapter(getActivity());
mListView.setAdapter(mAdapter);
int signal_index = R.drawable.signal0;
for(int i = 0; i < bus_arr.length; i++) {
mAdapter.addItem(getResources().getDrawable(signal_index+bus_arr[i].Want), getResources().getDrawable(R.drawable.bus1),
bus_arr[i].Title, bus_arr[i].Content);
}
mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View v, int position, long id){
ListData mData = mAdapter.mListData.get(position);
Intent myIntent = new Intent(Tab1.this.getActivity(), TeamBuildingDetails.class);
Tab1.this.startActivity(myIntent);
}
});
mFloatingButton = (FloatingActionButton) view.findViewById(R.id.mFloatingActionButton);
mFloatingButton.attachToListView(mListView);
mFloatingButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent myIntent = new Intent(Tab1.this.getActivity(), write.class);
Tab1.this.startActivity(myIntent);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment