Eclipse中此行的多个标记

时间:2013-05-09 13:28:28

标签: android eclipse

Eclipse向我展示了这一行的多个标记:public void sendConnection(View view) 如果有人可以帮助我,非常感谢你

btr = (Button)findViewById(R.id.connection);
        btr.setOnClickListener(new View.OnClickListener() {

            public void onClick(View v) 
            {
                EditText text = (EditText)findViewById(R.id.passwordedit);
                String str = text.getText().toString();
                if(str.equals("1234"))
                {
                    public void sendConnection(View view)
                    {
                        Intent intent = new Intent(this, AddMasterNumber.class);
                        startActivity(intent);
                    }
                }
                else
                {
                    AlertDialog alertdialog = new AlertDialog.Builder(MainActivity.this).create();
                    alertdialog.setTitle("Wrong Password");
                    alertdialog.setIcon(R.drawable.wrongpassword);
                    alertdialog.setMessage("The password you entered is incorrect, please try again!");
                    alertdialog.show();
                }

            }
        });

1 个答案:

答案 0 :(得分:3)

public void onClick(View v) 
{
    EditText text = (EditText)findViewById(R.id.passwordedit);
    String str = text.getText().toString();
    if(str.equals("1234"))
    {
        sendConnection(v);
    }
    else
    {
        AlertDialog alertdialog = new AlertDialog.Builder(MainActivity.this).create();
        alertdialog.setTitle("Wrong Password");
        alertdialog.setIcon(R.drawable.wrongpassword);
        alertdialog.setMessage("The password you entered is incorrect, please try again!");
        alertdialog.show();
    }

}


public void sendConnection(View view)
{
    Intent intent = new Intent(this, AddMasterNumber.class);
    startActivity(intent);
}

你不能在另一个函数中声明一个函数;。