I have a taboo and for each tab I have an activity group.
When the application starts, and I click on editText, the keyboard exits. When I start a child activity, and then return to the main activity, the keyboard no longer exits.
My code to run subactivity
Intent i = new Intent(this, ShowAddFoodToSelection.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
View view = ActivityGroupMeal.group.getLocalActivityManager().startActivity(DataParser.activityIDMeal, i).getDecorView();
ActivityGroupMeal.group.setContentView(view);
my code to return to the main activity
ActivityGroupMeal.group.back();
And the back code in the workgroup:
public void back() {
try {
if (history.size() > 1) {
history.remove(history.size() - 1);
super.setContentView(history.get(history.size() - 1));
} else {
}
} catch (Exception e) {
if (history.size() >= 0)
super.setContentView(history.get(0));
}
}
i set onClickListenerin editTextusing the following code:
private void keyboardShow() {
InputMethodManager inputManager = (InputMethodManager) ActivityGroupMeal.group.getSystemService(Context.INPUT_METHOD_SERVICE);
boolean test = inputManager.showSoftInput(editTextSearch, InputMethodManager.SHOW_IMPLICIT);
Toast.makeText(this, "show keyboard " + test, Toast.LENGTH_SHORT).show();
}
The first time true is returned and the time I return from childactivity, it returns false.
When I click on another tab and then back to the first tab and then click on editText, it returns true again.
: , onClickListener editTextbox,
InputMethodManager inputManager = (InputMethodManager) ActivityGroupMeal.group
.getSystemService(Context.INPUT_METHOD_SERVICE);
// show keyboard , when it fails first switch tab and then try again
if (!inputManager.showSoftInput(null, InputMethodManager.SHOW_FORCED)) {
// switch from tab and back
// the keyboard wont show if we dont do this
ShowHomeTab parentActivity;
parentActivity = (ShowHomeTab) this.getParent().getParent();
parentActivity.goToTab(DataParser.activityIDTracking);
parentActivity.goToTab(DataParser.activityIDShowFoodList);
inputManager.showSoftInput(null, InputMethodManager.SHOW_FORCED);
}
childactivity, , =/
- ?