Is there any way to disable soft Home key Programatically?
public boolean isSoftKeyAvail(Context context) {
final boolean[] isSoftkey = {false};
final View activityRootView = ((Activity) context).getWindow().getDecorView().findViewById(android.R.id.content);
activityRootView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
int rootViewHeight = activityRootView.getRootView().getHeight();
int viewHeight = activityRootView.getHeight();
int heightDiff = rootViewHeight - viewHeight;
if (heightDiff > 100) { // 99% of the time the height diff will be due to a keyboard.
isSoftkey[0] = true;
}
}
});
return isSoftkey[0];
}
public int getStatusBarHeight(){
int result=0;
int resourceId= mContext.getResources().getIdentifier("status_bar_height", "dimen", "android");
if(resourceId >0)
result = mContext.getResources().getDimensionPixelSize(resourceId);
return result;
}