0
我的應用程序在調試模式下運行良好,但是當我切換到發佈模式時出現編譯錯誤,如下所示: 錯誤:此類應提供默認構造函數不帶參數的構造函數) 該類是應用程序在調試模式下運行良好,但在發佈模式下引發編譯錯誤
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import java.util.List;
public class CFileArrayAdapter extends ArrayAdapter<COption> {
private Context c;
private int id;
private List<COption> items;
public CFileArrayAdapter(Context context, int textViewResourceId,
List<COption> objects) {
super(context, textViewResourceId, objects);
c = context;
id = textViewResourceId;
items = objects;
}
public COption getItem(int i)
{
return items.get(i);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View v = convertView;
if (v == null) {
LayoutInflater vi = (LayoutInflater)c.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = vi.inflate(id, null);
}
final COption o = items.get(position);
if (o != null) {
TextView t1 = (TextView) v.findViewById(R.id.TextView01);
TextView t2 = (TextView) v.findViewById(R.id.TextView02);
if(t1!=null)
t1.setText(o.getName());
if(t2!=null)
t2.setText(o.getData());
}
return v;
}
}
任何人可以幫助我解決這個問題呢?
正如它所說,只需添加一個空的構造函數:'公共CFileArrayAdapter(){} – 2014-09-19 10:22:06