EDIT : Resolved. Answer sent separately below
I run the built-in selection tool Intent.ACTION_SEND, so the user can choose how to send a message from my application. It works fine, but if I delete Cancel in the running email program, it will return to my application and the on-screen keyboard will still be visible. I tried to close it with various imm.hideSoftInputFromWindow (...) spells, but to no avail. Any ideas how to fix this?
This is how I run "chooser" and try to close the keyboard in onActivityResult (). Note that tabHost is a static member of my main application (MainApp), which contains the tabHost object used to create tabSpecs.
public class L_Secondary extends ListActivity implements myConst
{
@Override
protected void onCreate (Bundle savedInstanceState)
{
super.onCreate (savedInstanceState);
setContentView(R.layout.l_people_secondary);
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);
}
...
public void launchEmail ()
{
try
{
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();
}
}
...
}
wufoo source
share