このアダプターを並べ替える方法を知りたいです。
private class ProductsListAdapter extends BaseAdapter {
public ProductsListAdapter() {
super();
}
public int getCount() {
return SingletonComparer.getInstance().getProducts().size();
}
public Object getItem(int position) {
return SingletonComparer.getInstance().getProducts().get(position);
}
public long getItemId(int position) {
return SingletonComparer.getInstance().getProducts().get(position).getId();
}
public View getView(int position, View convertView, ViewGroup parent) {
TextView textView = getGenericView();
textView.setText(SingletonComparer.getInstance().getProducts().get(position)
.getName());
TextView textView2 = getGenericView();
textView2.setText(""
+ SingletonComparer.getInstance().getProducts()
.get(position).getPrice());
TextView textView3 = getGenericView();
textView3.setText(SingletonData.getInstance().getBrandName(SingletonComparer.getInstance().getProducts().get(position)
.getBrandID()));
LinearLayout ll = new LinearLayout(getActivity());
ll.addView(textView, new LinearLayout.LayoutParams(0,
LayoutParams.WRAP_CONTENT, 1.0f));
ll.addView(textView2, 1, new LinearLayout.LayoutParams(0,
LayoutParams.WRAP_CONTENT, 1.0f));
ll.addView(textView3, 2, new LinearLayout.LayoutParams(0,
LayoutParams.WRAP_CONTENT, 1.0f));
ll.setId(SingletonComparer.getInstance().getProducts().get(position)
.getId());
return ll;
}
}
分野別
SingletonComparer.getInstance().getProducts()
.get(position).getPrice());
これは可能ですか?はいの場合、どうすればそれを行うことができますか?