android - Using editText to compare strings and go to new page/activity -


I'm trying to work with editText for my Android app log on screen. It does not matter how I try to do it! Currently I'm trying to compare the edited text field in just one letter string, then if it calls a function to start new activity

Any help is greatly appreciated! My ultimate goal is to create two toast messages if there is no input, then it says "Please enter a username and password" and if this is incorrect then this would be called "incorrect username password combination". So if it matches, the app will only go to the next page titled "Device Page". Thanks again!

  package com.example.chirp; Import android App Import android.content.Intent; Importroid.os.Bundle; Import android.util.log; Import android.view.View; Import android.view.View.OnClickListener; Import android.widget.Button; Import android.widget.EditText; Increases public class login activity {edit edit edit_text; // Protected void onCreate (bundled savedinstenstate) {super.onCreate (SavedInstanceState); SetContentView (R.layout.loginscreen); Edit_text = (Edit Text) FindUBID (RID Editlet 2); Login = (button) Find VibibIID (R.B. button 1); Login.setOnClickListener (New View.OnClickListener () {public void onClick (see footage) {// Log.v ("EditText value =", edit_text.getText (). ToString ()); if (edit_text.getText ()) ToString () == "D") {NewZreen ();}}}); } Public Zero Newsletter () {Intent i = New Intent (This, Device Category); Preliminary (i); }}  

  edit .gettext (). ToString () == "D"  

string s should be compared with .equals () method instead. Then change it:

  Edit.getText (). ToString () Equal ("D");  

If you mean it means to be insensitive, you can use it:

  Edit.getText (). ToString () EqualsIgnoreCase ("d");  

Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -