package com.kurukurupapa.tryandroidui.listactivity;

import com.kurukurupapa.tryandroidui.R;

import android.app.ListActivity;
import android.graphics.Color;
import android.os.Bundle;

/**
 * レイアウトXMLを使用して、ListActivityを表示する例
 */
public class ListActivityEx extends ListActivity {

	/*
	 * (非 Javadoc)
	 *
	 * @see android.app.Activity#onCreate(android.os.Bundle)
	 */
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		ListActivityExAdapter adapter = new ListActivityExAdapter(this,
				R.layout.list_row);

		int imageIdArr[] = new int[] { R.drawable.creep001,
				R.drawable.creep002, R.drawable.creep003, R.drawable.creep004,
				R.drawable.creep005, R.drawable.creep006, R.drawable.creep007,
				R.drawable.creep008 };
		int textColorArr[] = new int[] { Color.BLUE, Color.GREEN, Color.RED,
				Color.WHITE, Color.WHITE, Color.WHITE, Color.WHITE, Color.WHITE };

		for (int i = 0; i < 3; i++) {
			for (int j = 0; j < imageIdArr.length; j++) {
				adapter.add(new ListActivityExDto(imageIdArr[j], "Row"
						+ (i * imageIdArr.length + j + 1), "Dummy Text",
						textColorArr[j]));
			}
		}

		setListAdapter(adapter);
	}
}
