Hi again =) i solve this problem using OnTouchListener on my Homepage activity.I have an gridviews background in my homepage layout and if the user doesn't login, onTouch()
method runs.When the login fragment is visible and the user touch outside of it my hideLoginFragment() method calling for dismissing the fragment..
gridView = (ShelvesView) findViewById(R.id.grid_shelves);
gridView.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (application.getDbManager().getUser().key.equals("-1")){
hideLoginFragment();
loginButton.setVisibility(View.VISIBLE);
exitButton.setVisibility(View.INVISIBLE);}
return false;
}
});