使用gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
Intent in = new Intent(DistrictOfficerActivity.this, MemberDetailsActivity.class);
in.putExtra("name", serialArrayList.getTitle());
in.putExtra("desig", serialArrayList.getPosition());
in.putExtra("contact", serialArrayList.getMobile());
in.putExtra("addr", serialArrayList.getAddress());
in.putExtra("blood", serialArrayList.getBloodGroup());
in.putExtra("image",serialArrayList.getPhotos());
in.putExtra("email", serialArrayList.getEmail());
in.putExtra("desc", serialArrayList.getDesc());
in.putExtra("website", serialArrayList.getWebsite());
in.putExtra("land", serialArrayList.getLandline());
startActivity(in);
}
});
CaseIterable
枚举和CodingKeys
,我几乎可以实现编译器魔术师Mirror
实现的运行时类型检查版本。几乎,但不是完全一样,因为从Encodable
值我无法回到枚举大小写名称,我需要通过CodingKey
查找匹配值。
Mirror(reflecting: myEncodable)
我希望能够通过enum CodingKeys: String, CodingKey {
case defaultName // default: .stringValue is also the myEncodable member name
case nonDefaultName = "some-other-name" // .stringValue is not the myEncodable name, no access to "nonDefaultName"
}
以某种方式找到案例名称,但事实并非如此。
Mirror(reflecting: CodingKeys.nonDefaultName)
直到得到真实的东西。)CaseIterable
中提到的所有成员都被抬头看向对象并馈送到CodingKeys
)?