나는 탭 호스트를 가지고 있으며 각 탭마다 activitygroup이 있습니다.tabhost가있는 android activitygroup, 키보드가 보이지 않음
앱이 시작되고 editText를 누르면 키보드가 나옵니다. 자식 활동을 시작한 다음 키보드로 돌아 가면 기본 활동으로 돌아갑니다.
activitygroup의 주요 활동
ActivityGroupMeal.group.back();
그리고 다시 코드로 돌아갈하여 보조 Activity를
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);
내 코드를 시작하는 내 코드 :
public void back() {
try {
// if we set history.size() > 0 and we press back key on home
// activity
// and then on another activity we wont get back!
if (history.size() > 1) {
history.remove(history.size() - 1);
// call the super.setContent view! so set the real view
super.setContentView(history.get(history.size() - 1));
} else {
}
} catch (Exception e) {
if (history.size() >= 0)
super.setContentView(history.get(0));
}
}
전 다음 코드로 editText
에 onClickListener
을 설정하십시오.
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();
}
처음으로 true를 반환하고 내가 childactivity에서 돌아올 때 false를 반환합니다.
다른 탭을 클릭 한 다음 첫 번째 탭을 다시 클릭하면 editText를 클릭하면 다시 true가 반환됩니다.
편집 : 내가 임시 수정 프로그램을 가지고, 나는 editTextbox에 onClicklistener
을 설정하고 내가 먼저 코드 탭을 전환해야 다시 childactivity에서 올 때 다음이 내가 코드
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);
}
와 키보드를 보여 키보드가 표시되기 전에 =/
누구든지 설명을 해 주시겠습니까?
비슷한 문제가 있습니다. 해결 방법을 찾았습니까? 저에게 알려주세요. – kushaldsouza
잘 모르겠습니다. 이 [ActivityGroup] (http://ericharlow.blogspot.in/2010/09/experience-multiple-android-activities.html)을 한 번 사용해보십시오. – Praveenkumar
@ k9ty는이 문제에 대한 해결책을 찾았습니다 ????? – duggu