문제

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();
            }

    }
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top