I'm working with carousel i just used the Caruosel source code from [codeProject][1] site
一切都很好,直到我在运行应用程序时添加了 setOnItemClickListener 函数,它崩溃了如何解决这个崩溃以使我的应用程序工作???
import com.name.w.R;
import com.name.controls.Carousel;
import com.name.controls.CarouselAdapter;
import com.name.controls.CarouselAdapter.OnItemClickListener;
public class NameActivity extends Activity {
/** Called when the activity is first created. */
Carousel care;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
care=(Carousel) findViewById(R.id.carousel);
care.setOnItemClickListener(new OnItemClickListener(){
public void onItemClick(CarouselAdapter<?> parent,View view,int position,long id){
Toast.makeText(NameActivity.this, "Position=" + position, Toast.LENGTH_SHORT).show();
}
});
}
}