Sub Activity_Create(FirstTime As Boolean)
Dim jo As JavaObject
jo.InitializeContext
jo.RunMethod("lockScreen", Null)
End Sub
#if Java
import android.content.Context;
import android.graphics.PixelFormat;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.view.WindowManager;
import android.view.View.OnKeyListener;
import android.widget.RelativeLayout;
public void lockScreen() {
RelativeLayout mRl = new RelativeLayout(this);
mRl.setBackgroundColor(0x80000000);
mRl.setOnKeyListener(new OnKeyListener(){
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
Log.d("LockScreen", "keyCode = "+keyCode);
return true;
}
});
WindowManager.LayoutParams mParams = new WindowManager.LayoutParams(
WindowManager.LayoutParams.FILL_PARENT,
WindowManager.LayoutParams.FILL_PARENT,
WindowManager.LayoutParams.TYPE_SYSTEM_ERROR,
// Draws over status bar
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
| WindowManager.LayoutParams.FLAG_FULLSCREEN,
PixelFormat.TRANSLUCENT);
WindowManager
mWindowManager = (WindowManager) this
.getSystemService(Context.WINDOW_SERVICE);
mWindowManager.addView(mRl, mParams);
}
#End If