我有一个带有 5 个标签的标签活动。每个选项卡都有多个活动。当我导航回上一个活动时,finishFromChild(Activity child) 函数调用了我使用 Intent 标志 Intent.FLAG_ACTIVITY_SINGLE_TOP 的地方。
我的问题是在返回上一个活动后创建的,因为我以前的活动是一个带有自动完成文本视图的地图活动,在返回后自动完成文本视图变得不可编辑,并且在单击此自动完成文本视图后键盘不显示,直到我在长按后选择其文本。
请帮助我提前致谢
**here is my code for finishFromChild(Activity child)**
@Override
public void finishFromChild(Activity child) {
LocalActivityManager manager = getLocalActivityManager();
int index = mIdList.size()-1;
Log.d("in finish from child<>>>>>>>>>>>>>", ""+index+"");
if (index < 1) {
finish();
return;
}
manager.destroyActivity(mIdList.get(index), true);
mIdList.remove(index); index--;
String lastId = mIdList.get(index);
Intent lastIntent = manager.getActivity(lastId).getIntent();
Window newWindow = manager.startActivity(lastId, lastIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP));
setContentView(newWindow.getDecorView());
}
**and Here is my Code for AutocompleteTextView**
try {
TenLifeDataSource dataSource = new TenLifeDataSource(this);
mSearchedCitymList = dataSource.getAllCityBySearchString();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
findViewById(R.id.headerLogoImageView).setOnClickListener(
new InfoButtonListener(this));
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_dropdown_item_1line, mSearchedCitymList);
Log.d("check it", "i m in editor");
mSearchAutoCompleteText = (AutoCompleteTextView) findViewById(R.id.searchBox);
mSearchAutoCompleteText.setImeOptions(EditorInfo.IME_ACTION_DONE);
// mSearchEditText.setOnEditorActionListener(mEditorActionListener);
mSearchAutoCompleteText
.setOnEditorActionListener(mEditorActionListener);
mSearchAutoCompleteText.setAdapter(adapter);
mSearchAutoCompleteText
.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1,
int arg2, long arg3) {
InputMethodManager inputManager = (InputMethodManager) getApplicationContext()
.getSystemService(Context.INPUT_METHOD_SERVICE);
inputManager.toggleSoftInput(0, 0);
mSearchAutoCompleteText.dismissDropDown();
/*
* if (!TextUtils.isEmpty(v.getText())) {
* mLastSearchedString = v.getText().toString();
* showSearchResults(); //return true; }
*/
mLastSearchedString = mSearchAutoCompleteText.getText()
.toString();
// //Log.d("test adderess here", mLastSearchedString);
// mLastSearchedString = v.getText().toString();
if (mLastSearchedString.length() > 0) {
// Log.d("center",
// ""+mLastSearchedString.length()+"");
getlocationinfo(mLastSearchedString);
}
// if(menuItems.size() <= 0)
// showSearchResults(mLastSearchedType);
// updateSuppliers(mLastSearchedType);
// showSearchResults();
}
});