Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7719651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:28:08+00:00 2026-06-01T03:28:08+00:00

Lets say i wanted to compare a variable in the sqlite database and if

  • 0

Lets say i wanted to compare a variable in the sqlite database and if the text displayed on the screen is identical to it then print a error on the screen. i tried if (info.getData == info.getData ) then print error
But that did not work , if anyone has any idea how to do it please inform me

    TextView tv = (TextView) findViewById(R.id.tvSQLinfo);
    HotOrNot info  = new HotOrNot(this);
    info.open();
    String data = info.getData();
    info.close();
    tv.setText(data);
if(info.getData().equals(info.getData())){
 tv.setText("hey");
// this prints error

}

Code:

package f.s.l;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;

public class HotOrNot {
public static final String KEY_ROWID ="_id";
public static final String KEY_DAY ="persons_day";

private static final String DATABASE_NAME ="HotOrNotdb";

private static final String DATABASE_TABLE ="peopleTable";
private static final int DATABASE_VERSION =1;

private DbHelper ourHelper;
private final Context ourContext;
private SQLiteDatabase ourDatabase;

private static class DbHelper extends SQLiteOpenHelper{

public DbHelper(Context context) {
    super(context, DATABASE_NAME, null, DATABASE_VERSION);
    // TODO Auto-generated constructor stub
}

@Override
public void onCreate(SQLiteDatabase db) {
    // TODO Auto-generated method stub
    db.execSQL("CREATE TABLE " + DATABASE_TABLE + " (" +

            KEY_DAY + " TEXT NOT NULL);"


            );


}

@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    // TODO Auto-generated method stub
    db.execSQL("DROP TABLE IF EXISTS " + DATABASE_TABLE);
    onCreate(db);

}

}
public HotOrNot(Context c){
ourContext =c;
}
public HotOrNot open() throws SQLException{
ourHelper = new DbHelper(ourContext);
ourDatabase = ourHelper.getWritableDatabase();
return this;
}
public void close(){

ourHelper.close();
}


public long createEntry1(String day) {
// TODO Auto-generated method stub
ContentValues cv = new ContentValues();

cv.put(KEY_DAY, day);


return ourDatabase.insert(DATABASE_TABLE, null, cv);

}



 public String getData() {
// TODO Auto-generated method stub
String [] columns = new String[]{KEY_DAY};
Cursor c = ourDatabase.query(DATABASE_TABLE, columns, null, null, null, null, null);
String result = "";

int iDay = c.getColumnIndex(KEY_DAY);

for(c.moveToFirst(); !c.isAfterLast(); c.moveToNext()) {


    result = result +c.getString(iDay) +"\n";
}


return result;
}
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T03:28:10+00:00Added an answer on June 1, 2026 at 3:28 am

    In Java, if you are comparing strings you need to use equals method. In your case, like this:

    if (info.getData().equals(info.getData()) {
        // do something
    }
    

    Similarly, if you don’t care about casing, you can do:

    if (info.getData().equalsIgnoreCase(info.getData()) {
        // do something
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Lets say i wanted to add another variable to the database can anybody tell
Lets say I wanted to scrape a webpage, and extract some data. I'd most
As an example, lets say I wanted to list the frequency of each letter
lets say I wanted to search through divs with a certain class name.and if
Lets say I wanted to build an app that will pull url links from
I don't think this is possible but I wanted to make sure. Lets say
is there an easy way to go through a list? lets say i wanted
so lets say I wanted to essentially do this: $.post( 'search_item.php', { serialzed_data, save:
Lets say I wanted to implement the usual dynamic programming algorithm for Levensthein distance
Lets say I wanted to make a post request to update the status of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.