MainActivity.java private long backKeyPressedTime = 0; private Toast toast; @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if ((keyCode == KeyEvent.KEYCODE_BACK)) { // 웹뷰 History상 이전 페이지가 있을 경우 if(mWebView.canGoBack()){ mWebView.goBack(); // 뒤로가기 return true; } // 없을 경우 앱 종료 전 Toast로 물어보기 else{ // 토스트메세지 출력 if (System.currentTimeMillis() > backKeyPressedTime + 2000) { backKeyP..
안드로이드
Activity에서 처리하는 경우 activity_main.xml MainActivity.java WebView mWebView; WebSettings mWebSettings; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mWebView = (WebView) findViewById(R.id.mWebview); // 웹뷰 선언 mWebSettings = mWebView.getSettings(); mWebView.setWebChromeClient(new WebChromeClient()); // 크롬클라이언트 사용 mWebVi..
MainActivity.java public class MainActivity extends AppCompatActivity { private FragmentManager fragmentManager; private Fragment_Main fragment_main; private Fragment_MyPage fragment_my_page; private FragmentTransaction fragmentTransaction; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); fragmentManager = ..
타이틀 바 없애기 경로 : res/values/themes.xml , res/values-night/themes.xml 상태 바 없애기 경로 : MainActivity.java import android.os.Build; import android.view.WindowInsets; import android.view.WindowInsetsController; import android.view.WindowManager; ... public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); /* 전..