import com.sexyview.R;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.animation.AnimationUtils;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.Gallery;
import android.widget.Gallery.LayoutParams;
import android.widget.ImageSwitcher;
import android.widget.ImageView;
import android.widget.ViewSwitcher;
public class sexyview extends Activity implements AdapterView.OnItemSelectedListener, ViewSwitcher.ViewFactory{
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        
        setContentView(R.layout.main);
        
        sexySwitcher = (ImageSwitcher) findViewById(R.id.gallery);
        sexySwitcher.setFactory(this);
        sexySwitcher.setInAnimation(AnimationUtils.loadAnimation(this,android.R.anim.fade_in));
        sexySwitcher.setOutAnimation(AnimationUtils.loadAnimation(this,android.R.anim.fade_out));
        
        Gallery g = (Gallery) findViewById(R.id.switcher);
        g.setAdapter(new ImageAdapter(this));
        g.setOnItemSelectedListener(this);
    }
 @Override
 public void onItemSelected(AdapterView parent, View v, int potions,long id) {
  sexySwitcher.setImageResource(badaImage[potions]);  
 }
 @Override
 public void onNothingSelected(AdapterView parent) {  
 }
 @Override
 public View makeView() {
  ImageView i = new ImageView(this);
  i.setBackgroundColor(0xFF000000);
  i.setScaleType(ImageView.ScaleType.FIT_CENTER);
  i.setLayoutParams(new ImageSwitcher.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT));
  return i;
 }
 private ImageSwitcher sexySwitcher;
 
 public class ImageAdapter extends BaseAdapter{
  public ImageAdapter(Context c){
   sexyCon = c;
  }
  @Override
  public int getCount() {
   return miniImage.length;
  }
  @Override
  public Object getItem(int position) {
   return position;
  }
  @Override
  public long getItemId(int position) {
   return position;
  }
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
   ImageView i = new ImageView(sexyCon);
   
   i.setImageResource(miniImage[position]);
   i.setAdjustViewBounds(true);
   i.setLayoutParams(new Gallery.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
   i.setBackgroundResource(R.drawable.picture_frame);
   return i;
  }
  private Context sexyCon;
 }
 
 private Integer[] miniImage = {R.drawable.mini01,R.drawable.mini02,R.drawable.mini03
              ,R.drawable.mini04,R.drawable.mini05,R.drawable.mini06
              ,R.drawable.mini07,R.drawable.mini08};
 
 private Integer[] badaImage = {R.drawable.bada01,R.drawable.bada02,R.drawable.bada03
              ,R.drawable.bada04,R.drawable.bada05,R.drawable.bada06
              ,R.drawable.bada07,R.drawable.bada08};
}

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_width="fill_parent"
 android:layout_height="fill_parent"
 >
 <ImageSwitcher android:id="@+id/switcher"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:layout_alignParentTop="true"
  android:layout_alignParentLeft="true"
  />
 <Gallery android:id="@+id/gallery"
  android:background="#55000000"
  android:layout_width="fill_parent"
  android:layout_height="60dp"
  android:layout_alignParentBottom="true"
  android:layout_alignParentLeft="true"
  
  android:gravity="center_vertical"
  android:spacing="16dp"  
  />
</RelativeLayout>

안녕하세요 위에 코드와 같이 APIDEMO예제를 써서 이미지를 출력해볼려고 하는데
아래와 같은 에러 내용이 출력이 되내요

11-19 17:25:17.120: ERROR/AndroidRuntime(243): Uncaught handler: thread main exiting due to uncaught exception
11-19 17:25:17.141: ERROR/AndroidRuntime(243): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.sexyview/com.sexyview.sexyview}: java.lang.ClassCastException: android.widget.Gallery
11-19 17:25:17.141: ERROR/AndroidRuntime(243):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496)
11-19 17:25:17.141: ERROR/AndroidRuntime(243):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
11-19 17:25:17.141: ERROR/AndroidRuntime(243):     at android.app.ActivityThread.access$2200(ActivityThread.java:119)
11-19 17:25:17.141: ERROR/AndroidRuntime(243):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
11-19 17:25:17.141: ERROR/AndroidRuntime(243):     at android.os.Handler.dispatchMessage(Handler.java:99)
11-19 17:25:17.141: ERROR/AndroidRuntime(243):     at android.os.Looper.loop(Looper.java:123)
11-19 17:25:17.141: ERROR/AndroidRuntime(243):     at android.app.ActivityThread.main(ActivityThread.java:4363)
11-19 17:25:17.141: ERROR/AndroidRuntime(243):     at java.lang.reflect.Method.invokeNative(Native Method)
11-19 17:25:17.141: ERROR/AndroidRuntime(243):     at java.lang.reflect.Method.invoke(Method.java:521)
11-19 17:25:17.141: ERROR/AndroidRuntime(243):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
11-19 17:25:17.141: ERROR/AndroidRuntime(243):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
11-19 17:25:17.141: ERROR/AndroidRuntime(243):     at dalvik.system.NativeStart.main(Native Method)
11-19 17:25:17.141: ERROR/AndroidRuntime(243): Caused by: java.lang.ClassCastException: android.widget.Gallery
11-19 17:25:17.141: ERROR/AndroidRuntime(243):     at com.sexyview.sexyview.onCreate(sexyview.java:29)
11-19 17:25:17.141: ERROR/AndroidRuntime(243):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
11-19 17:25:17.141: ERROR/AndroidRuntime(243):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)

gallery부분이 에러라는 건 알겠는대 어떻게 처리해야 할지를 모르겠습니다.

답변주시면 감사하겠습니다.