-
Notifications
You must be signed in to change notification settings - Fork 570
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UI 跳转 List 数据的传递怎么使用? #115
Comments
List可以直接通过bundle传递,List 可以通过Parcelable |
|
使用这个吧,你不会失望的 |
// UI transfer with Bundle
private void goToShareActivityWithBundle() {
Author author = new Author();
author.setName("Margaret Mitchell");
author.setCounty("USA");
Bundle bundle = new Bundle();
bundle.putString("bookName", "Gone with the Wind");
bundle.putString("author", JsonService.Factory.getInstance().create().toJsonString(author));
UIRouter.getInstance().openUri(getActivity(), "DDComp://share/shareBook", bundle);
}
这是 Demo 中的数据传递,如果传递 List 数据,怎么传递?
@Autowired
List author;
接收数据时,这么写,编译报错:错误: 需要<标识符>
@OverRide
public void inject(Object target) {
jsonService = JsonService.Factory.getInstance().create();
SecondActivity substitute = (SecondActivity)target;
if (null != jsonService) {
substitute.children = jsonService.parseObject(substitute.getIntent().getStringExtra("children"), List.class);
} else {
Log.e("AutowiredProcessor", "You want automatic inject the field 'children' in class 'SecondActivity' , but JsonService not found in Router");
}
substitute.title = substitute.getIntent().getStringExtra("title");
}
这是编译生成的类,List.class 这个地方编译不通过,Cannot select from parameterized type
The text was updated successfully, but these errors were encountered: