編集:解決しました。以下に別途掲載された回答
組み込みの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", "root@localhost", 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();
}
}
...
}