#android-intent #arraylist #android-annotations
#android-намерение #arraylist #android-аннотации
Вопрос:
Я пытаюсь отправлять и получать ArrayList через intent в аннотации Android. Как я могу этого добиться?
grid.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
SubcriptionAddPage_.intent(activity).startForResult(REQUEST_CODE);
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
}
});
Ответ №1:
В вашем Activity
случае вы можете ввести Intent
дополнительный, подобный этому:
@EActivity
public class SubcriptionAddPage extends Activity {
@Extra
ArrayList<String> arrayListExtra;
@AfterInject
void afterInject() {
// you can use the injected extra here
}
}
SubcriptionAddPage_.intent(activity)
.arrayListExtra(list) // pass the extra to the generated builder
.startForResult(REQUEST_CODE)
.withAnimation(R.anim.activity_in, R.anim.activity_out); // you can use this instead of calling overridePendingTransition()