0

アダプターにコンパスがありSensorEventListener、アクティビティに含まれています。によると、値を使用してSensorEventListener更新しており、コンパスでは完全に機能しますが、リストビューを継続的に更新しているため、をクリックできません。何か提案はありますか?これが私のコードです...listviewnotifydatasetchanged().listitem

アクティビティ .....

....listener = new SensorEventListener() {

        public void onSensorChanged(SensorEvent event) {
            float[] values = event.values;

                ((ParkedCarsListAdapter) listParkedCars.getAdapter()).updateCompass(-values[0]);

        }

        public void onAccuracyChanged(Sensor sensor, int accuracy) {
        }
    };....

アダプタ.......

@Override
public View getView(int position, View convertView, ViewGroup parent) {


if(cars.get(position).getNorth()!=0){

     compass.setNorth(cars.get(position).getNorth());
     }
  .......

}

...public void updateCompass(float northvalue) {

    for (Car car : cars) {
        car.setNorth(northvalue);
    }
    this.notifyDataSetChanged();
}
4

0 に答える 0