프로그래밍/Android
[Android/Error] android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
배고픈멍멍이
2015. 12. 11. 18:27
android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
안드로이드 이클립스에서 자바로 코딩을 짜던 중 에러가 뜸.
상황
커스텀어뎁터에서 버튼을 만들어서, 버튼에서 새로운 뷰로 이동하려고 함.
해결방법
위의 플래그를 선언해준다
Intent i = new Intent(getApplicationContext(), MainActivity.class);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(i);