하나의 액티비티에서 다른 액티비티로 복잡한 객체를 보내려고합니다. 따라서이 객체의 일부 필드는 시스템 클래스이고 기본적으로 비 직렬화 가능하기 때문에이 복잡한 객체를 직렬화 할 수 없습니다. 그래서 "MyIntent"라는 사용자 정의 클래스를 android.content.Intent에서 상속 받고 싶습니다.이 방법으로 모든 유형의 객체를 사용자 정의 인 텐트에 넣을 수 있습니다. 하지만 두 번째 활동에서 getIntent() 메서드는 MyIntent 인스턴스가 아닌 android.content.Intent 인스턴스를 반환합니다. 내가 왜 안드로이드를 구현하지 않았는지 이해하지 못한다 .content.Intent class is right.Android custom 인 텐트 클래스
public class MyIntent extends Intent
{
}
//starting activity
MyIntent intent = new MyIntent();
intent.setClass(context, SecondActivity.class);
context.startActivity(intent);
//inside of onCreate() of SecondActivity
Intent i = getIntent();
i instanceof MyIntent = false
'MyIntent i = (MyIntent) getIntent()' –
Anton, 시스템 클래스를 보낼 필요는 없지만 보내려는 클래스는 일부 시스템 클래스와 많이 결합되어 있습니다. –