0

このクラスは、"Explenses_act.java" という別の Java ファイルで既に定義されています。「Incomes_act.java」というファイルで機能させる必要があります。これはアンドロイドアプリ用です。これどうやってするの?

class MySimpleAdapter extends ArrayAdapter<String> {
private final Context context;
private final ArrayList<String> values;


public MySimpleAdapter(Context context, List<String> values)
{
    super(context, R.layout.custom_row, values);
    this.context = context;
    this.values = (ArrayList<String>) 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.custom_row, parent, false);
TextView textView1 = (TextView) rowView.findViewById(R.row.date);
TextView textView2 = (TextView) rowView.findViewById(R.row.time);
TextView textView3 = (TextView) rowView.findViewById(R.row.desc);
TextView textView4 = (TextView) rowView.findViewById(R.row.val);
TextView textView5 = (TextView) rowView.findViewById(R.row.cat);


String[] split = values.get(position).split(";");
final String PREFS_NAME = "Sets";
SharedPreferences settings = context.getSharedPreferences(PREFS_NAME, 0);
textView1.setText(split[0] + " ");
textView2.setText(split[1] + " ");
textView3.setText(split[2] + " ");
textView4.setText(settings.getString("SelectedCur", "ˆ")+split[3] + " ");
textView5.setText(split[4] + " ");

return rowView;

} }

4

1 に答える 1

0

MySimpleAdapter クラスを公開します。既存のアダプター クラスは別のパッケージにあると思います。すべてのクラスのデフォルトのアクセス修飾子は package で、パッケージ内のすべてのクラスがアクセスできるようにします。

于 2013-04-18T14:02:33.003 に答える