无法进入0包

时间:2013-11-22 14:48:57

标签: android custom-adapter

我尝试在Android上设计界面。我创建了一个自定义适配器,它具有textview和switch ..当我运行程序时,它会发出一个警告,如下所示。

11-22 16:37:33.492: W/ResourceType(31712): Failure getting entry for 0x010802c8 (t=7 e=712) in package 0 (error -75)

调试之后,我意识到在调用自定义适配器的getView方法之后出现警告。我该如何解决这个问题?

Log cat:

11-22 16:37:33.421: D/AbsListView(31712): Get MotionRecognitionManager
11-22 16:37:33.492: W/ResourceType(31712): Failure getting entry for 0x010802c8 (t=7   e=712) in package 0 (error -75)
11-22 16:37:33.492: W/ResourceType(31712): Failure getting entry for 0x010802c8 (t=7 e=712) in package 0 (error -75)
11-22 16:37:33.492: W/ResourceType(31712): Failure getting entry for 0x010802c8 (t=7 e=712) in package 0 (error -75)
11-22 16:37:33.502: W/ResourceType(31712): Failure getting entry for 0x010802c8 (t=7 e=712) in package 0 (error -75)
11-22 16:37:33.502: W/ResourceType(31712): Failure getting entry for 0x010802c8 (t=7 e=712) in package 0 (error -75)
11-22 16:37:33.522: W/ResourceType(31712): Failure getting entry for 0x010802c8 (t=7 e=712) in package 0 (error -75)
11-22 16:37:33.532: W/ResourceType(31712): Failure getting entry for 0x010802c8 (t=7 e=712) in package 0 (error -75)
11-22 16:37:33.532: W/ResourceType(31712): Failure getting entry for 0x010802c8 (t=7 e=712) in package 0 (error -75)
11-22 16:37:33.552: D/dalvikvm(31712): GC_CONCURRENT freed 293K, 13% free 9751K/11143K, paused 12ms+14ms, total 50ms
11-22 16:37:33.552: D/AbsListView(31712): [unregisterDoubleTapMotionListener]
11-22 16:37:33.552: W/ResourceType(31712): Failure getting entry for 0x010802c8 (t=7 e=712) in package 0 (error -75)
11-22 16:37:33.562: I/MotionRecognitionManager(31712):   .unregisterListener : / listener count = 0->0, ubvf 9budiwrd5ordgfl5BakTrklMrfo$,@,*f+.-c(

自定义适配器:

public class ConfigAdapter extends ArrayAdapter<String>{

private String[] entries;
Activity activity;
LayoutInflater inflater;
SwitchEnabler rootEnable;
Context context;
boolean[] onOff;

public ConfigAdapter(Context context, Activity activity,String[] entries,boolean[] onOff) {

    super(context, 0, entries);
    this.activity = activity;
    this.entries = entries;
    this.context = context;
    this.onOff = onOff;
    inflater = (LayoutInflater) this.activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);  
    rootEnable = new SwitchEnabler(context, new Switch(context));
}


private class ConfigHolder {
    public TextView configTxt;
    public Switch configtogg;
}

@Override
public View getView(final int position, View convertView, ViewGroup parent) {
    View view = null;
    ConfigHolder holder = new ConfigHolder();

    if (view == null) {

        view = inflater.inflate(R.layout.list_rows, null);
        holder.configTxt = (TextView) view.findViewById(R.id.configTxt);
        holder.configtogg = (Switch) view.findViewById(R.id.configSwitch);
        view.setTag(holder);
    }

    holder.configTxt.setText(entries[position]);
    if(position == 0){
        rootEnable.setSwitch((Switch) view.findViewById(R.id.configSwitch));
        holder.configtogg.setChecked(onOff[position]);
    }
    else{
        holder.configtogg.setChecked(onOff[position]);
    }


    return view;
}
}

0 个答案:

没有答案