EDIT: Risolto. Risposta inviata separatamente sottoTastiera Android ancora visibile dopo l'avvio E-mail intent
Sto lanciando il selettore "Intent.ACTION_SEND" incorporato in modo che l'utente possa selezionare come inviare un messaggio dalla mia applicazione. Funziona OK, ma se premo 'Discard' nel programma Email lanciato, ritorna alla mia applicazione con la tastiera su schermo ancora visibile. Ho provato a chiuderlo con vari incantesimi di imm.hideSoftInputFromWindow (...) ma senza successo. Qualche idea su come risolvere questo problema?
Questo è il modo in cui sto lanciando il "selettore" e tentando di chiudere la tastiera in onActivityResult(). Nota che tabHost è un membro statico nella mia applicazione principale (MainApp) che contiene l'oggetto tabHost utilizzato per creare tabSpecs.
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();
}
}
...
}
Perché funziona?Devo capire per cercare di usarlo nella mia situazione. – Poutrathor