私は、アクティビティ(拡張アクティビティ)をTabHostで実行しています。ユーザーの操作からAndroidのメールクライアントを起動します。電子メールクライアントの「破棄」ボタンを押すと、電子メールクライアントは終了しますが、オンスクリーンキーボードは表示されたままになります。メールからの返信後にAndroidキーボードがまだ表示されています。アクティビティ
私は自分のアプリケーションにEditTextを持っていないので、なぜキーボードが残っているのかわかりません。私はHow do I remove the keyboard after I finish an activity?のいくつかの反復を試みましたが、運はありません。何かご意見は?
コードサンプル
package com.test.launchmail;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.view.inputmethod.InputMethodManager;
import android.widget.Toast;
public class myEmail extends Activity
{
private final String TAG = "** Email **";
public static void send (Context ctx, String addy, String subject, String body)
{
// check to make sure the entry has a phone number
try
{
// use the builtin chooser for users mail app
Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.setType("text/plain");
sendIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String [] {addy});
sendIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);
sendIntent.putExtra(android.content.Intent.EXTRA_TEXT, body);
ctx.startActivity (Intent.createChooser(sendIntent, "Send via which Application?"));
}
catch (Exception e)
{
Toast.makeText (ctx, "No activity was found to handle this action",Toast.LENGTH_SHORT).show();
}
}
@Override
protected void onPostResume()
{
// This executes, but keyboard still visible.
Log.d ("myEmail", "hiding");
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow (mainApp.tabHost.getCurrentTabView().getApplicationWindowToken(),imm.HIDE_IMPLICIT_ONLY);
super.onResume();
}
}
ziziana - 私はstateHiddenとstateAlwaysHiddenを追加しましたが、まだ運がありません。 – wufoo