所以我想弄清楚我是否可以将一个额外的 Intent 从自定义适配器传递给一个 Activity ,然后将该 Intent 额外传递给另一个 Activity ?
有没有可能或有更好的方法来做我想做的事情?
最佳答案
Activity A:
Intent intent = new Intent(A.this, B.class);
intent.putExtra("someString", "string");
startActivity(intent):
Activity B:
onCreate(...) {
String myString = getIntent().getStringExtra("someString");
MyAdapter myAdapter = new MyAdapter(B.this, myString);
}
MyAdapter :
Context myContext;
String myString;
MyAdapter(Context context, String string) {
this.myContext = context;
this.myString = string
}
现在您已将 Activity A 中的字符串放入您的适配器中:)
关于android - 可以将自定义适配器的 Intent 额外传递给另一个自定义适配器的 Activity 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38376015/