Javatpoint Logo

Moving from an activity to fragment after checking some conditions.

By: umer93*** On: Fri Apr 21 13:27:21 IST 2017     Question Reputation0 Answer Reputation0 Quiz Belt Series Points0  0Blank User
This is my android code. i'm facing an error in getText() function from 3 day. help me out.

public class Login extends AppCompatActivity {
RelativeLayout login1;
Button button3;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.frag_userreg_layout);

login1=(RelativeLayout) findViewById(R.id.login1);
button3=(Button) findViewById(R.id.button3);

button3.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v) {
EditText editText1 = (EditText) findViewById(R.id.editText1);
EditText editText2 = (EditText) findViewById(R.id.editText2);


public void login(View view) {
if (editText1.getText().toString().equals("admin")) &&
(editText2.getText().toString().equals("admin"));
{
Intent loginIntent = new Intent(Login.this, fragV1.class);
}

{
Toast.makeText(getApplicationContext(), "Invalid User Name or Password", Toast.LENGTH_LONG).show();
}
}
}

});
}
}
Up0Down