Posiadam dilog w którym wpisuje wartość i chce ją zwrócić, niestety nie bardzo to działa
Kod dialogu
public String ShowEditDialog()
{
AlertDialog.Builder builder = new AlertDialog.Builder(Globals.Ctx);
builder.setTitle("Title");
// Set up the input
final EditText input = new EditText(Globals.Ctx);
// Specify the type of input expected; this, for example, sets the input as a password, and will mask the text
input.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
builder.setView(input);
// Set up the buttons
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
m_Text = input.getText().toString();
}
});
builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
builder.show();
return m_Text;
}
A wywołuje go z klasy która działa w wątku, poniżej kod:
public void AlertFromThread()
{
resp="";
handler.post(new Runnable() {
public void run() {
Dialog dial = new Dialog();
resp=dial.ShowEditDialog( );
}
});
}
Niestety resp jest puste