Loading Images into Gridview
<p>I'm trying to use the universal image loader to load images into a gridview but my app seems to be crashing right when the activity loads and I cant identify the problem. I'm loading the images from an array then calling the image adapter to populate them.</p>

<p>All help will be greatly appreciated :)</p>

<pre><code>public class MainActivity extends Activity {

String[] imageUrls;

DisplayImageOptions options;
protected ImageLoader imageLoader = ImageLoader.getInstance();

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    Bundle bundle = getIntent().getExtras();
    imageUrls = bundle.getStringArray(Extra.IMAGES);

    options = new DisplayImageOptions.Builder()
        .showStubImage(R.drawable.stub_image)
        .showImageForEmptyUri(R.drawable.image_for_empty_url)
        .cacheInMemory()
        .cacheOnDisc()
        .bitmapConfig(Bitmap.Config.RGB_565)
        .build();

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


}

public class ImageAdapter extends BaseAdapter {
    @Override
    public int getCount() {
        return imageUrls.length;
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        final ImageView imageView;
        if (convertView == null) {
            imageView = (ImageView) getLayoutInflater().inflate(R.layout.item_grid_image, parent, false);
        } else {
            imageView = (ImageView) convertView;
        }

        imageLoader.displayImage(imageUrls[position], imageView, options);

        return imageView;
    }
}
</code></pre>

<p>}</p>

<p>Logcat Error: </p>

<pre><code>01-04 14:43:40.990: E/AndroidRuntime(11510): FATAL EXCEPTION: main
01-04 14:43:40.990: E/AndroidRuntime(11510): java.lang.RuntimeException: ImageLoader must be init with configuration before using
01-04 14:43:40.990: E/AndroidRuntime(11510):    at com.nostra13.universalimageloader.core.ImageLoader.displayImage(ImageLoader.java:175)
01-04 14:43:40.990: E/AndroidRuntime(11510):    at com.nostra13.universalimageloader.core.ImageLoader.displayImage(ImageLoader.java:131)
01-04 14:43:40.990: E/AndroidRuntime(11510):    at com.example.breaktheglass.ImageGridActivity$ImageAdapter.getView(ImageGridActivity.java:96)
</code></pre>

<p>So I added this:</p>

<pre><code>ImageLoader.init(ImageLoaderConfiguration.createDefault(this));
</code></pre>

<p>before I called the imageloader (below the .getInstance) but then it just gives me this error:</p>

<pre><code>Syntax error on token "init", Identifier expected after this token
</code></pre>

<p>I'm not quite sure where to go from here.. </p>
