2011-04-08 92 views

回答

0

看一看這個討論AlertDialog Input Text ..

所有你需要的是當按下相應的按鈕(正或負)來調用的意圖。

在這裏看到:

Intent intent=new Intent(context,AnotherActivity.class); 
EditText mUserText; 
mUserText = (EditText) textEntryView.findViewById(R.id.txt_password); 
String strpwd = mUserText.getText().toString(); 

intent.putExtra("my_password",strpwd); 
startActivity(intent); 
1

您可以創建一個活動,是themed as a Dialog

<activity android:theme="@android:style/Theme.Dialog"> 

,然後描述here調用活動與startActivityForResult(...)

0

onClick偵聽器中,您將通過當前Dialog作爲方法參數之一。

因此,您可以在onClick方法中執行類似((TextView) dialog.findViewById(R.id.passwordField)).getText().toString()的操作。