定义要传递的类事,必须加上

public class Movie implements Serializable
{

}

传入类:

public void onItemClick(AdapterView<?> parent,
                                    View view, int position, long id)
      {
          Movie movie= movieList.get(position);
          Intent intent = new Intent(MovieActivity.this, EditMovie.class);
          Bundle bundle = new Bundle();
          bundle.putSerializable("movie", movie);
          intent.putExtras(bundle);
          startActivity(intent);
      }

接受类:

Movie movie = (Movie) getIntent().getSerializableExtra("movie");
String name = movie.getName();
String desc = movie.getDesc();
editText1.setText(name);
editText2.setText(desc);

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-09-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-02
  • 2021-06-01
猜你喜欢
  • 2022-12-23
  • 2021-10-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案