I have 1 edit text in my activity in that when i press a button soft keyboard opens and on hardware backbutton the softkeyboard is closed and cursor should be visible gone..i have implemented as below..Please help me for it..
public void onBackPressed()
{
brand.setCursorVisible(false);
brand.clearFocus();
finish();
}
}
Try this way
public void onBackPressed()
{
if(brand.isCursorVisible()){
brand.setCursorVisible(false);
brand.clearFocus();
}else{
super.onBackPressed();
}
}