[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?
프로그래밍/Android2015. 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);
'프로그래밍 > Android' 카테고리의 다른 글
[Android] 리스트뷰 클릭이 안될 때 (0) | 2015.12.11 |
---|---|
[Android/SDK] Error when loading the SDK 에러 (0) | 2015.09.21 |
[Android/Facebook] 해시키 가져오기 (0) | 2015.07.27 |
[Android/펌] Android app에서 Facebook 연동하기 2 (0) | 2015.07.27 |
[Android/펌] Android app에서 Facebook 연동하기 1 (0) | 2015.07.27 |