User7723337
User7723337

Reputation: 12018

Android focus related issue

I have one RelativeLayout in which i have 5 buttons, I hide this RelativeLayout after screen timeout (If there is no user activity), and when user does some activity then i set it as visible.

But problem is that, when i set the RelativeLayout as invisible then it removes focus from its child, and when i set it back to visible then it just sets the focus to first child.

I need to set the focus to the previously focused child of the RelativeLayout to be maintained when i set it as visible or invisible.

Thanks.

Upvotes: 0

Views: 1319

Answers (1)

Dheeresh Singh
Dheeresh Singh

Reputation: 15701

//Global Variable.. 
  View v;


//beore you hiding the buttons 
v = getCurrentFocus ();




//after you showing the buttons 
 if(null!=v && v. isFocusable ())
    v.requestFoucs();

Upvotes: 1

Related Questions