With the preview release of Android 3.0, I thought it appropriate to test drive it with a simple photo gallery example!

Here goes:
Steps involved:

1. Download the preview release of Android 3.0 using either the SDK download manager (preferred) or from within the Eclipse IDE using Android SDK and AVD manager.

2. Create and AVD to run the emulator

Min. SDK Version write 'Honeycomb'

3. Create an Android project (IMPORTANT set the Min. SDK Version to ‘Honeycomb’ ) and Click Finish!

Android 3.0 Honeycomb project

4. Create a main entry point java file eg. Main.java

import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.Gallery;
import android.widget.Toast;

public class Main extends Activity implements OnItemClickListener
		private static final String tag = "Main";
		private Gallery _gallery;
		private ImageAdapter _imageAdapter;

		/** Called when the activity is first created. */
		public void onCreate(Bundle savedInstanceState)
				setTitle("Android Honeycomb Photo Gallery Example");

				_gallery = (Gallery) this.findViewById(R.id.gallery1);
				_imageAdapter = new ImageAdapter(this);

		public void onItemClick(AdapterView arg0, View view, int position, long duration)
				int resourcId = (Integer) _imageAdapter.getItem(position);
				Drawable drawable = getResources().getDrawable(resourcId);
				Bitmap bitmap = BitmapFactory.decodeResource(getResources(), resourcId);

				Toast.makeText(this, "Selected Image: " + getResources().getText(resourcId) + "\nHeight: " + bitmap.getHeight() + "\nWidth: " + bitmap.getWidth(), Toast.LENGTH_SHORT).show();

5. Create an ImageAdapter.java file

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Gallery;
import android.widget.ImageView;
import android.widget.ImageView.ScaleType;

public class ImageAdapter extends BaseAdapter
		private Context _context = null;
		private final int[] imageIds = { R.drawable.formula, R.drawable.hollywood, R.drawable.mode1, R.drawable.mode2, R.drawable.mother1, R.drawable.mother2, R.drawable.nights, R.drawable.ontwerpje1, R.drawable.ontwerpje2, R.drawable.relation1, R.drawable.relation2, R.drawable.renaissance, R.drawable.renaissance_zoom };

		public ImageAdapter(Context context)
				this._context = context;


		public int getCount()
				return imageIds.length;

		public Object getItem(int index)
				return imageIds[index];

		public long getItemId(int index)
				return index;

		public View getView(int postion, View view, ViewGroup group)
				ImageView imageView = new ImageView(_context);

				imageView.setLayoutParams(new Gallery.LayoutParams(400, 400));
				return imageView;

6. Create an XML layout file:

<?xml version="1.0" encoding="utf-8"?>


7. Run the Android app.

Photo Gallery