這裏是我的自定義列表適配器Canot解決方法 '超(android.content.context,INT,INT,java.util.ArrayList中的<android.Bluetooth.Bluetoothdevices>)'
private class MyAdapter extends ArrayAdapter<ArrayList<BluetoothDevice>> {
ArrayList<BluetoothDevice> data;
Context context;
public MyAdapter(Context context, int resource, int textViewResourceId, ArrayList<BluetoothDevice> objects) {
super(context, resource, textViewResourceId,objects);
this.context=context;
this.data=objects;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View v=getLayoutInflater().inflate(R.layout.row,parent,false);
TextView textView=(TextView)findViewById(R.id.row_textview);
BluetoothDevice device=data.get(position);
textView.setText(device.getName()+"");
return v;
}
}
我傳遞一個bluetoothdevices的ArrayList中的構造causig
Canot resolve method 'super(android.content.context,int,int,java.util.arraylist<android.Bluetooth.Bluetoothdevices>)'
我在這裏設置適配器
listView.setAdapter(new MyAdapter(getApplicationContext(),R.layout.row,R.id.row_textview,bluetoothDeviceArrayList));
幫助PLE問題ASE!
類型參數解決問題'BluetoothDevice',而不是'ArrayList'。也就是說,'...擴展了ArrayAdapter '。 –
從MyAdapter構造器中刪除'super(context,resource,textViewResourceId,objects);' – SaravInfern