title: Display SQLite data in textview after login
body: <p>I have a login activity, registration activity, and profile activity. After I press the login button I'm able to display my username on the profile activity which is the activity third after login.But, I'm not able to display the first name, last name, GRE, toefl from the database to the profile activity. How vl i view each users first name, last name, gre and toefl in a textview in profile activity.</p>
  
  <p>Here's my code:</p>
  
  <p>This is SQLiteDB ProfileDatabase.class</p>
  
  <pre><code>public class ProfileDatabaseHelper extends SQLiteOpenHelper {
  
  private static final int DATABASE_VERSION= 1;
  private static final String DATABASE_NAME="profiles.db";
  private static final String TABLE_NAME="profile";
  
  private static final String COLUMN_PROFID="profId";
  private static final String COLUMN_FNAME="firstName";
  private static final String COLUMN_LNAME="lastName";
  private static final String COLUMN_UNAME="userName";
  private static final String COLUMN_PASS="pass";
  private static final String COLUMN_GRE= "gre";
  private static final String COLUMN_TOEFL= "toefl";
  SQLiteDatabase db;
  
  private static final String TABLE_CREATE = "create table profile (profId integer primary key  not null," +
          " firstName text not null, lastName text not null, userName text not null, pass text not null, gre integer not null, toefl integer not null);";
  
  public ProfileDatabaseHelper(Context context) {
      super(context,DATABASE_NAME, null, DATABASE_VERSION);
  }
  
  @Override
  public void onCreate(SQLiteDatabase db) {
      db.execSQL(TABLE_CREATE);
      this.db=db;
  
  }
  
  public void insertProfile(ProfileList pl){
  
      db = this.getWritableDatabase();
      ContentValues values = new ContentValues();
  
      String query = "Select * from profile";
      Cursor cursor = db.rawQuery(query, null);
      int count = cursor.getCount();
      values.put(COLUMN_PROFID,count);
      values.put(COLUMN_FNAME,pl.getFName());
      values.put(COLUMN_LNAME,pl.getLName());
      values.put(COLUMN_UNAME,pl.getUName());
      values.put(COLUMN_PASS,pl.getPass());
      values.put(COLUMN_GRE,pl.getGre());
      values.put(COLUMN_TOEFL,pl.getToefl());
  
      db.insert(TABLE_NAME, null,values);
      db.close();
  
  }
  
  
  public String searchPass(String uname){
      db = this.getReadableDatabase();
      String query = "select username, pass from "+TABLE_NAME;
      Cursor cursor = db.rawQuery(query, null);
      String a, b;
      b = "Not found";
      if(cursor.moveToFirst()){
          do{
              a = cursor.getString(0);
              if(a.equals(uname)){
                  b = cursor.getString(1);
                  break;
              }
  
  
          }
          while(cursor.moveToNext());
      }
      return b;
  }
  }
  
  
  @Override
  public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
      String query = "DROP TABLE IF EXISTS "+TABLE_NAME;
      db.execSQL(query);
  
    }
  
  
  }
  </code></pre>
  
  <p>here is my login.class</p>
  
  <pre><code>public class LoginUser extends AppCompatActivity {
  
  ProfileDatabaseHelper helper = new ProfileDatabaseHelper(this);
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_login_user);
  
  
  }
  
  public void onBtnClick(View v){
      if (v.getId() == R.id.loginButton){
  
          EditText loginName = (EditText)findViewById(R.id.loginUserName);
          String loginNameStr = loginName.getText().toString();
  
          EditText password = (EditText)findViewById(R.id.loginPass);
          String pass = password.getText().toString();
  
          String passwordLogin = helper.searchPass(loginNameStr);
  
  
          if(pass.equals(passwordLogin)){
  
  
              Intent i = new Intent(LoginUser.this, ProfileUser.class);
              i.putExtra("Username", loginNameStr);
              startActivity(i);
          }
  
          else {
              Toast.makeText(LoginUser.this,"Username and Password don't match",Toast.LENGTH_LONG).show();
          }
  
  
      }
      if (v.getId() == R.id.signUpButton){
          Intent i = new Intent(LoginUser.this, RegisterUser.class);
          startActivity(i);
      }
  }
  }
  </code></pre>
  
  <p>This is the third activity which displays users profile</p>
  
  <pre><code>public class ProfileUser extends AppCompatActivity {
  
  ProfileDatabaseHelper db;
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_profile_user);
  
  
  
      String username = getIntent().getStringExtra("Username");
      TextView userText = (TextView)findViewById(R.id.userNameDisplayText);
      userText.setText(username);
  
      //How canI enter each person personal first name, last name, grey and 
       toefl
  
  
      TextView userText = (TextView)findViewById(R.id.userNameDisplayText);
      TextView userText = (TextView)findViewById(R.id.userNameDisplayText);
      TextView userText = (TextView)findViewById(R.id.userNameDisplayText);
      TextView userText = (TextView)findViewById(R.id.userNameDisplayText);
  
  
  
    }
   }
  </code></pre>