2012-02-28 12 views
0

私の英語は申し訳ありません。私はリストの活動のために私自身のArrayAdapterを持っています。私の問題:Webサービスにデータを渡すと、データはArrayListに追加されます。ここではすべて正常です。 NexusとAndroid OS 4.0ではデータが一覧表示されていますが、他の携帯電話と2.3.3ではデータが表示されません。すべてが正常で、私は何のエラーも受けていません。Android独自のアレイアダプター

何が問題なのかわかりません。 Nexus(OS 4.0)を使用してデータをリストしますが、2.3.3にリストされていません。

  • 私の主なアクティビティクラスはListActivity
    • のpublic staticのArrayList freqzoを拡張しています。 static MobileArrayAdapter freqz;
    • freqzo = new ArrayList(); freqz =新しいMobileArrayAdapter(this、freqzo);
    • this.setListAdapter(freqz);リストビューlv = getListView();
    • lv.setTextFilterEnabled(true); //そして、私の充填arraylist部分:if(store
    • instanceof Vector){Object [] arr =((Vector)store).toArray(); (freqzo.add((String)arr [i] .toString()); for
    • (int i = 0; i < arr.length; i ++) }

マイモバイルアダプタクラス:

public class MobileArrayAdapter extends ArrayAdapter<String> { 

    private final Context context; 
    private final ArrayList<String> values; 

    public MobileArrayAdapter(Context context, ArrayList<String> values) { 
     super(context, R.layout.listlayout, values); 
     this.context = context; 
     this.values = values; 
    } 

    @Override 
    public View getView(int position, View convertView, ViewGroup parent) { 
     LayoutInflater inflater = (LayoutInflater) context 
      .getSystemService(Context.LAYOUT_INFLATER_SERVICE); 

     View rowView = inflater.inflate(R.layout.listlayout, parent, false); 
     TextView textView = (TextView) rowView.findViewById(R.id.label); 
     ImageView imageView = (ImageView) rowView.findViewById(R.id.logo); 

     String s = values.get(position); 
     Log.d("Liste", "Liste " + values.get(position)); 
     if (s != null && !s.equals("")) { 
      textView.setText(s); 
     } 

     // Change icon based on name 
     // String s = values[position]; 

     return rowView; 
    } 
} 

答えて

1

はたぶんあなたのリストを充填した後、あなたがadapter.notifyDataSetChanged()を呼び出す必要がありますか?作品は悪いこと

+0

私のfreandそれは仕事です。 –

0

LayoutInflater inflater = (LayoutInflater) context 
     .getSystemService(Context.LAYOUT_INFLATER_SERVICE); 

    View rowView = inflater.inflate(R.layout.listlayout, parent, false); 

まず、あなたは、アダプタによってあなたのために作成されたビューを使用しますが、常に新しいものを作成しないでください。 Javaマシンは余分なオブジェクトをクリーンアップしますが、時間がかかります。次に、ArrayAdapterはすべての作業を行うことができます。見てくださいhere

関連する問題