EDIT:解決済み回答が別途投稿されましたAndroidキーボードが起動してもまだ表示されているメールの内容
私は自分のアプリケーションからメッセージを送信する方法を選択できるように、組み込みのIntent.ACTION_SEND "chooser"を起動します。それは正常に動作しますが、起動した電子メールプログラムで「破棄」を押すと、画面上のキーボードが表示された状態でアプリケーションに戻ります。私はimm.hideSoftInputFromWindow(...)のさまざまな呪文でそれを閉じようとしましたが、無駄です。任意のアイデアをどのようにこれを修正するには?
これは、私が 'chooser'を起動し、onActivityResult()でキーボードを閉じる方法です。 tabHostは、tabSpecを作成するために使用されるtabHostオブジェクトを保持するメインアプリケーション(MainApp)の静的メンバーです。
public class L_Secondary extends ListActivity implements myConst
{
@Override
protected void onCreate (Bundle savedInstanceState)
{
super.onCreate (savedInstanceState);
setContentView(R.layout.l_people_secondary);
// instantiate the custom array adapter class and pass it some info to build a ListView with.
ListView lv = getListView();
lv.setOnItemClickListener (oicl);
A_secondary da = new A_secondary (this, android.R.layout.simple_list_item_single_choice, mPiecesArray, mPartsArray);
setListAdapter (da);
}
...
// after launching the email client, the keyboard stays visible
// over the Listview. Currently the keyboard gets forced to close
// in getView() of the ArrayAdapter class da, in onCreate() above
public void launchEmail()
{
try
{
// use the builtin chooser for users mail app
Intent sendIntent = new Intent(Intent.ACTION_SEND, Uri.fromParts ("mailto", "[email protected]", null));
sendIntent.setType("text/plain");
sendIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "msg_subject");
sendIntent.putExtra(android.content.Intent.EXTRA_TEXT, "msg_body");
startActivityForResult (Intent.createChooser(sendIntent, "Send via which Application?"), 0);
}
catch (Exception e)
{
Toast.makeText (this, "No activity was found to handle this action",Toast.LENGTH_SHORT).show();
}
}
...
}
これはなぜ機能していますか?私は自分の状況でそれを使用しようとすると理解する必要があります。 – Poutrathor