カスタムダイアログをポップアップするContextMenu Itemを選択しているときにこのエラーが発生します。onContextItemSelected to Dialog
W/InputManagerService(59): Window already focused, ignoring focus gain of: [email protected]
public boolean onContextItemSelected(MenuItem item) {
AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
Map<String, String> data = (Map<String, String>) getListView().getItemAtPosition(info.position);
preferences = PreferenceManager.getDefaultSharedPreferences(this);
String user_ids = preferences.getString("userID", null);
switch (item.getItemId()) {
case R.id.pm:
pms(data.get("pid"),user_ids,data.get("Name"));
return true;
}
return super.onContextItemSelected(item);
}
private void pms(final String fu2, final String to,final String to2) {
dialog = new Dialog(this.getParent());
dialog.setContentView(R.layout.popup_reply);
dialog.setTitle("To: "+to2);
dialog.setCancelable(true);
preferences = PreferenceManager.getDefaultSharedPreferences(this);
body = (EditText) dialog.findViewById(R.id.editText2);
sub = (EditText) dialog.findViewById(R.id.editText1);
Button button = (Button) dialog.findViewById(R.id.Button01);
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
}
});
Button button2 = (Button) dialog.findViewById(R.id.Button02);
button2.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
new ADownloadFileAsync().execute(fu2);
}
});
dialog.show();
}
以下のコード私はそれがdialgを呼び出す前のContextMenuのピントが合っていないと仮定しています。私はボタンからダイアログを呼び出すことができます。
これはエラーではありません。それは単なる警告です。私はいつも自分のアプリでそれらを参照してください。私はそれについて心配しません。 –
しかし、ダイアログがポップアップすることはありません。 – Duny
ああ、あなたは決して言わなかった。私は見てみましょう。 –