android5.2

### opdracht 1 ###

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_list_view);

    ...

    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {


        }
    });

    ...

}

Download hier het bestand.
### opdracht 2 ###

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_list_view);

    ...

    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

            Log.i("Naam: ", arrStudenten.get(position));

        }
    });

    ...

}

Download hier het bestand.
### opdracht 3 ###

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_list_view);

    ...

    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

            Log.i("Naam: ", arrStudenten.get(position));

            Snackbar snackbar = Snackbar.make(view,"Item: " + arrStudenten.get(position),Snackbar.LENGTH_SHORT);
            snackbar.show();
        }
    });

    ...

}

Download hier het bestand.
### opdracht 4 ###

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_list_view);

    ...

    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

            Log.i("Naam: ", arrStudenten.get(position));

            Snackbar snackbar = Snackbar.make(view,"Item: " + arrStudenten.get(position),Snackbar.LENGTH_SHORT);
            snackbar.show();

            if (arrStudenten.get(position) == "Joep") {
                Intent intent = new Intent(ListViewActivity.this,MainActivity.class);
                startActivity(intent);
            }
        }
    });

    ...

}

Download hier het bestand.