@Override
public boolean onCreateOptionsMenu(Menu menu) {
menu.add( "새로고침" );
menu.add( "캐시삭제" );
menu.add( "설정" );
return true ;
}
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
return true ;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if ( "새로고침" == item.getTitle())
{
mWebView.reload();
}
if ( "캐시삭제" == item.getTitle())
{
File cacheDir = context.getCacheDir();
clearCacheFiles(cacheDir);
Toast.makeText(context, "캐시가 삭제 되었습니다" , Toast.LENGTH_SHORT).show();
}
if ( "설정" == item.getTitle())
{
Intent intent = new Intent(MainActivity. this , SettingsActivity. class );
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
}
return true ;
}
|
메뉴 버튼을 누르면 설정 이라는게 나오도록 하는데요
설정이라는 메뉴를 눌렀을경우
startActivity(intent); 를 실행할때 어플이 종료가 되어 버리는데요..
이유가 뭘가요..
SettingsActivity 이거는 다른 어플에서 사용중인걸 그대로 가져와서 아무 문제가 없을거같은데요...
어떤거 살펴 봐야 할가요..?