Skip to content

Instantly share code, notes, and snippets.

@emedinaa
Created June 26, 2015 20:38
Show Gist options
  • Save emedinaa/f5b46c9a7ee4cd7e24a8 to your computer and use it in GitHub Desktop.
Save emedinaa/f5b46c9a7ee4cd7e24a8 to your computer and use it in GitHub Desktop.
Pasar información desde un listview a otra actividad
private void populateData()
{
MyAdapter adapter= new MyAdapter(getActivity(),reqMyEntityList);
lviRequest.setAdapter(adapter);
lviRequest.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
MyEntity myEntity= (MyEntity)adapterView.getAdapter().getItem(i);
gotoActivity(myEntity);
}
});
}
private void gotoActivity(MyEntity myEntity) {
Bundle bundle = new Bundle();
bundle.putSerializable("ENTITY",myEntity);
Intent intent= new Intent(getActivity(), OtherActivity.class);
intent.putExtras(bundle);
startActivity(intent);
getActivity().finish();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment