tags:

views:

46

answers:

2

GridView gridview = (GridView) findViewById(R.id.gridview); gridview.setAdapter(new ImageAdapter(this));

The typical use of this keyword is that it refers to the current object,but in this example what it refers?

A: 

In this example this refers to the class in which this piece of code is written

Roflcoptr
A: 

I suppose i get this code from here http://developer.android.com/resources/tutorials/views/hello-gallery.html as you can see ImageAdapter extends BaseAdapter and ImageAdapter is accepting Context as parameter in constructor so this refer to the context in which you are calling this code (in most cases this will be your Activity).

Mojo Risin