What context should I use AlertDialog.builder on event of a button ?
I am using this code... please rectify it
btnLogin.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View v)
{
// Check Login
String username = etUsername.getText().toString();
String password = etPassword.getText().toString();
String str1 = DownloadText("http://........");
开发者_StackOverflow社区 if(str1.length()==1)
{
AlertDialog dialog = new AlertDialog.Builder(btnLogin).setTitle("Alert 1").setMessage("Login Success").create();
alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
return;
}});
}}
....new AlertDialog.Builder(YourActivity.this)......
精彩评论