I'm writing a simple application and I've a problem. My application has to protect, when somebody want to close it. If somebody wants to close app, he has to write a password. It's my simple code. How can I add function, that when somebody wants close app and he will has to write password? I'm new developer, who's programming in Java, so I'm sorry my bad knowledge.
Here is my app:
package com.example.my_first_app;
import android.os.Bundle;
import android.os.Handler;
import android.app.Activity;
import android.view.Window;
import android.view.WindowManager;
import android.webkit.WebView;
public class MainActivity extends Activity {
private WebView mWebView;
Handler handler = new Handler();
@Override
protected void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mWebView = (WebView) findViewById(R.id.activity_main_webview);
mWebView.loadUrl("http://google.com");
}
}