Skip to content

Instantly share code, notes, and snippets.

@tagrudev
Last active August 29, 2015 13:58
Show Gist options
  • Save tagrudev/10115912 to your computer and use it in GitHub Desktop.
Save tagrudev/10115912 to your computer and use it in GitHub Desktop.
public class arrivi extends Fragment {
ListView list;
String[] web = {
"Google Plus",
"Twitter",
"Windows",
"Bing",
"Itunes",
"Wordpress",
"Drupal"
} ;
Integer[] imageId = {
R.drawable.aereo,
R.drawable.aereo,
R.drawable.aereo,
R.drawable.aereo,
R.drawable.aereo,
R.drawable.aereo,
R.drawable.aereo
};
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View ios = inflater.inflate(R.layout.arrivi, container, false);
CustomList adapter = new CustomList(this.getActivity(), web, imageId);
list=(ListView)ios.findViewById(R.id.listView1);
list.setAdapter(adapter);
list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
Toast.makeText(MainActivity.this, "You Clicked at " +web[+ position], Toast.LENGTH_SHORT).show();
}
});
return ios;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment