私は、SimpleCursoradapterを使用して、私がアクティビティで持っているリストに値を設定しています。リストからのアクティビティ間の値の受け渡し
このアクティビティのString値を別の値に渡す必要があり、値をローカルデータベースから取得する必要があります。
私はlistviewで新しいtextviewを作成し、SimpleCursorAdapterを使用して文字列値をマッピングすることで同じことをしました。
これは、これを実行するための最良の方法ですか?
public class InboxAdapter extends SimpleCursorAdapter {
public InboxAdapter(Context context, int layout, Cursor c,
String[] from, int[] to) {
super(context, layout, c, from, to);
}
@Override
public void bindView(View view, Context context, Cursor cursor) {
super.bindView(view, context, cursor);
Button msgReply = (Button) view.findViewById(R.id.msgReply);
final TextView msgId = (TextView) view.findViewById(R.id.msgId);
msgReply.setOnClickListener(new View.OnClickListener() {
private Intent intent;
@Override
public void onClick(View v) {
intent = new Intent(getApplicationContext(), ComposeMessage.class);
Bundle b = new Bundle();
b.putCharSequence("id", msgId.getText());
intent.putExtras(b);
startActivity(intent);
}
});
}
}
私はそれが最善の方法だと思う、それを渡すntnt.putExtras(String yourString); ' – Houcine