I have a created a screen for which it will ask the password and compare with the inbuilt password and launch another screen but I am unable to launch the activity even if I give the correct password. Any help will be greatly appreciated.
public class MainActivity extends Activity {
public static String lock = "vamsi";
public static String locker;
EditText et;
Button b;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
et = (EditText) findViewById(R.id.editText1);
b = (Button) findViewById(R.id.button1);
locker = et.getText().toString();
b.setOnClickListener(new View.OnClickListener() {
public void onClick(View arg0) {
if (locker.equals(lock)) {
Intent intent = new Intent("screen");
startActivity(intent);
}
}
});
}
}
Write Following line
instead of
Where FileName is the name of that activity which do you want to open in Onclick Method.