【发布时间】:2011-06-03 04:20:29
【问题描述】:
public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {
View v = null;
if( convertView != null )
v = convertView;
else
v = inflater.inflate(R.layout.child_row, parent, false);
Color c = (Color)getChild( groupPosition, childPosition );
TextView color = (TextView)v.findViewById( R.id.childname );
if( color != null )
color.setText( c.getColor() );
TextView rgb = (TextView)v.findViewById( R.id.rgb );
if( rgb != null )
rgb.setText( c.getRgb() );
// CheckBox cb = (CheckBox)v.findViewById( R.id.check1 );
// cb.setChecked( c.getState() );
Button btnPlay=(Button)v.findViewById(R.id.Play);
Button btnDelete=(Button)v.findViewById(R.id.Delete);
Button btnEmail=(Button)v.findViewById(R.id.Email);
btnPlay.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
Log.i("TEST ", "play btn cliked");
Intent i=new Intent(this,FindFilesByType.class);//THIS IS NOT ALLOWED IN MY CODE
}
});
return v;
}
在上面的代码中,我编写了我的适配器类。 我小时候的可解释列表中有 3 个按钮。 我想在按钮的单击事件上调用另一个 Java 类, 所以,当我使用时:
Intent i=new Intent(this,FindFilesByType.class);
我得到了这个:
The constructor Intent(new View.OnClickListener(){}, Class<FindFilesByType>) is undefined
Remove arguments to match 'Intent'
我在做什么有什么问题?
【问题讨论】:
标签: android button android-intent expandablelistview