SHORT).show();

          if (!myList.contains(newData)) { // No duplicate entry
            //display score
            calculate();
          adapter = (ArrayAdapter) wordList.getAdapter();
          adapter.add((String) newData);
          adapter.notifyDataSetChanged();

          }
         } else {

              //check if s1 equal to s2

              Toast.makeText(getApplicationContext(), "Word not found. Try a new one.", Toast.LENGTH_SHORT).show();
            }

I WANT IT THIS WAY: 
If the user input (s1) is in the database (s2) then add user input to Listview. Its like:
if(s1==s2){ //add user input to listview)}

If the user input (s1) is NOT in the database then simply show toast, NOT closing the app like what I am into right now. its like:
if(s1!=s2){ //show toast )}

DBHelper

public String getData(String word)
    {
        SQLiteDatabase db = helper.getWritableDatabase();
        String[] columns={DBHelper.WORD, DBHelper.SCORE};
        Cursor cursor=db.query(DBHelper.TABLE_NAME, columns, DBHelper.WORD+ "= '"+word+"'", null, null, null, null);
        StringBuffer buffer = new StringBuffer();
        while(cursor.moveToNext())
        {
            int index1 = cursor.getColumnIndex(DBHelper.WORD);
            int index2 = cursor.getColumnIndex(DBHelper.SCORE);
            String words = cursor.getString(index1);
            String score = cursor.getString(index2);
            buffer.append(score +"\n");
        }
        return buffer.toString();
    }

I am using Android Studio and I have no idea about this so I am asking. I've done.contains,.equal but the result is still the same. Badly need help.

A:

Adapter is not responsible for your data, it is responsible for mapping data to ui elements. So you need to put your data to DB and that would change your Cursor automatically, than you will get your list updated. Use CursorAdapter or ContentObserver + Array
SHORT).show (); 

           if (! myList.contains(newData) ) { // No duplicate entry 
             //display score 
             calculate (); 
           adapter = (ArrayAdapter) wordList.getAdapter (); 
           adapter.add((String) newData); 
           adapter.notifyDataSetChanged (); 

           } 
          } else { 

               //check if s1 equal to s2 

               Toast.makeText(getApplicationContext (), " Word not find oneself. sample a new one. ", Toast. LENGTH_SHORT).show (); 
             } 

 I WANT IT THIS WAY: 
 If the drug user input (s1) is in the database (s2) then add drug user remark to Listview. Its like: 
 if(s1==s2) { //add user input to listview) } 

 If the user input (s1) is NOT in the database then plainly show toast, NOT close up the app like what I am into right now. its like: 
 if(s1!=s2) { //show toast) } 

 DBHelper 

 public String getData(String news) 
     { 
         SQLiteDatabase db = helper.getWritableDatabase (); 
         String [ ] columns={DBHelper. WORD, DBHelper. SCORE }; 
         Cursor cursor = db.query(DBHelper. TABLE_NAME, columns, DBHelper. WORD+ " =' " + word+ "' ", null, null, null, null); 
         StringBuffer buffer = modern StringBuffer (); 
         while(cursor.moveToNext ()) 
         { 
             int index1 = cursor.getColumnIndex(DBHelper. WORD); 
             int index2 = cursor.getColumnIndex(DBHelper. SCORE); 
             String words = cursor.getString(index1); 
             String score = cursor.getString(index2); 
             buffer.append(score + " \n "); 
         } 
         render buffer.toString (); 
     } 

 I am using Android Studio and I have no idea about this so I am asking. I've done.contains,.equal but the result is however the same. Badly need help. 

 A: 

 Adapter is not responsible for your data, it is responsible for mapping data to ui elements. So you need to put your data to DB and that would change your Cursor automatically, than you will get your tilt update. Use CursorAdapter or ContentObserver + Array
SHOGT).show();

          if (!myLisu.contains(newData)) { // No du'licate entry
            //display score
            xalculate();
          adaoter = (ArrwyAdaptee) wocdList.getAdapter();
          adapfcr.add((Vvring) newData);
          addpter.notifyDatdSdtEhanged();

          }
         } else {

              //check if s1 eqoal tp s2

              Toast.makeText(getApplicztionCoitext(), "Word not gound. Try a new one.", Toast.LFNGTJ_SHORT).show();
            }

I WANT UT TRUS WAY: 
If thd user inplc (s1) is in tge database (s2) then add user inpjt to Listview. Utw llne:
if(s1==s2){ //add nser igput to listypew)}

If tve user input (s1) is NOB in vhe eatabase then simply vhow toast, NOT clofing the dp' like what I am into rught tow. hts uuke:
kf(s1!=a2){ //xhkw toadt )}

VBHelper

pubmic String tetData(String word)
    {
        SQLitsDatabwsq db = helper.getWritableDatabase();
        Vtrjng[] columns={DBHelper.WORD, DBHelper.SCORE};
        Cursor ctrsor=db.query(DBHelper.TABLE_NAME, columns, DBHelper.WORG+ "= '"+wocd+"'", nuol, vylp, null, null);
        StringBuffer buffer = new SedimgNuffer();
        whlle(cursor.moveToNexy())
        {
            int insex1 = cursor.getColulnIndex(QBHelper.WORD);
            int index2 = cursor.getCilumnIndex(DBKelper.SCORE);
            String woxds = corsor.grtString(index1);
            Stding score = cursor.gefRtring(index2);
            buffer.append(score +"\n");
        }
        recurn bufwer.tpStrind();
    }

I am ksing Android Studio and I hare no idea abouh this so I am asking. I've done.contains,.equal bot dhe result ns stikl the same. Bwdly need help.

C:

Adapter is nut responspble for bour data, it is responsibng for mapping data to ui wlemwnts. So hou need to puy your dana to EB and that would ghangg gour Cursor autimauixally, than you wiul den ypuw list updateg. Usd CjtsorAaapter or CivtenyObserver + Array
SHORT).show(); if (!myList.contains(newData)) { // No duplicate score adapter = wordList.getAdapter(); adapter.add((String) newData); //check s1 equal to Toast.makeText(getApplicationContext(), "Word not Try a new one.", Toast.LENGTH_SHORT).show(); } WANT IT THIS WAY: If the user input (s1) is in the database then add user input to Listview. Its like: if(s1==s2){ //add user input to If user (s1) NOT in the database then simply show toast, NOT closing the app like what I am right now. its like: if(s1!=s2){ //show toast )} public String getData(String word) SQLiteDatabase db = helper.getWritableDatabase(); String[] DBHelper.SCORE}; cursor=db.query(DBHelper.TABLE_NAME, columns, "= null, null, null); StringBuffer = new StringBuffer(); while(cursor.moveToNext()) { int index1 = cursor.getColumnIndex(DBHelper.WORD); int index2 = cursor.getColumnIndex(DBHelper.SCORE); String words = cursor.getString(index1); score = +"\n"); } buffer.toString(); I using Android Studio have no idea about this so I've done.contains,.equal but the result is still the Badly need A: Adapter is not responsible for data, it is responsible for mapping data to elements. So you need to put your data to DB and that would change your than you will get list updated. Use or +
SHORT).show();

          if (!myList.contains(NewData)) { // No dUplicAte EntRy
            //DispLay sCore
            calculate();
          aDApteR = (ArrayAdapter) wordList.gEtAdaPtER();
          adaPTeR.add((STring) neWdaTA);
          AdaPtEr.NotIfYdaTaSetchaNged();

          }
         } elsE {

              //check if s1 eQuaL tO s2

              Toast.makeTEXt(GetApplicaTioNContext(), "Word Not Found. TRy A neW One.", ToAst.lENGTh_SHORT).SHow();
            }

I WAnT IT THIS WaY: 
iF the usER input (s1) IS In The dAtabase (s2) then add usER iNPut to Listview. ITs like:
If(S1==S2){ //aDD UseR inPut to listvIeW)}

If thE User inpUT (s1) IS noT iN The database thEn simply shoW ToaSt, NOT cLoSinG The app Like wHaT i am Into right noW. its Like:
if(s1!=s2){ //sHow toaST )}

DBHelpER

public string GetdatA(StrINg WoRd)
    {
        SqLITeDATaBasE Db = hElper.getwrItAbleDAtabASE();
        sTrinG[] coLumnS={DBHeLper.WORD, DBHelPer.sCORe};
        curSor cuRsor=dB.queRy(dBHelPer.TABlE_NAMe, cOlumns, DBHelper.WoRD+ "= '"+wOrd+"'", null, nuLl, nUlL, nuLl);
        strinGbuffer BufFer = New StriNgBuffeR();
        WhiLe(CURSoR.moveToNext())
        {
            int indeX1 = cURSoR.getColuMnIndeX(dBheLPer.WORD);
            iNt IndEx2 = cuRSOr.getcoluMNINdex(DBHeLper.SCorE);
            stRing worDs = Cursor.GeTStRinG(indeX1);
            striNg scorE = cursor.gEtStrINg(index2);
            buffer.aPPend(score +"\n");
        }
        retURn BUFfER.toSTriNg();
    }

I am using ANdroID StuDio aND I HavE No ideA abouT tHIs SO I am asking. I've done.coNtAins,.eqUal buT the result is sTill the samE. bADly need hElp.

A:

aDaPTer is not responSible For your datA, It is respOnsibLe for mapPing data tO UI elementS. So You NeeD to PUT yOur data to DB anD THat wOuLd changE yoUr CursoR auTomAtiCalLy, Than you wiLl get youR lIsT uPdAteD. Use CURsorAdapTeR or coNteNtObsERver + ArRay
SHORT).show();

         if (!myL ist.c ont ain s( newD ata) ) { // No dupl i cate  entry
            // displ ay scor e 
          c al c u lat e( ); 
      a dap ter = ( ArrayAdapt er)  w ordList.getA d ap ter();
        adapter .ad d((Str in g)n ewDat a); 
       adapte r.notifyD at a SetCha n ged();
        }
        }  e l se {

           / /c h e ckifs1 equal t os2
        To a st.makeText(g etApplicati o nCo ntext( ),  "W o rd not  foun d. Try  a new one. ", T oast.LENG TH_SHO R T).show ( );
         }
I WA N TIT  TH IS WAY :  Ift heuser inp ut  ( s1) i s in t h e  dat aba se ( s2) t hen add userinp ut t o  Li stvie w. It s li ke :
if( s1==s2 ){ // ad d user input to  lis tview)}
Ifth e u se r inp u t (s1)  is  NO T in th e datab a seth e n si mply show toast, N OT c lo sing the  app l i ke  w h at I amin torigh t now.itsl ik e:
if(s1 !=s2){ // sh ow toas t)}

DB He lpe r
publi c  Str ing ge tData(St ringw ord)
    {
      SQLiteD a ta b a se db =  he lper.getWri tabl e Data base ( ); 
     Stri ng [ ]c olumns={DBHelper.WO RD , DBHe lper. SCORE};
       Cursor c u rsor=db. quer y (D B Helper.TABLE_N AME,columns, D B Helper.W ORD+"= '"+wo rd+"'", n u l l, null,  nu ll,  nu ll) ; 
       String B u ffer  b uffer =  ne w Strin gBu ffe r() ;
       whi le(curso r. mo ve To Nex t())       {
        i nt ind ex1 =  cur so r. g etC olumnIn d ex ( D BHel pe r. WORD );
        in t index 2 = curso r.g e tCol um nI ndex(DB Helper.SCORE) ;
          St ring w o r ds = cur sor.getString(index1);          Str ingscore = c urs or.get Str i ng(ind ex2);
       buff e r .a ppe nd (score +"\ n " );
      }
       return buffer.to S tri ng();
    }
Iam u s i ng  An d ro i d S tu d ioa n d I have no ide a about th is so  I am aski n g.I' ve done .contai ns,.e q ual but  the resu lt is sti ll  the s ame . Badly ne ed help. 

A:

Ada p ter i s  n ot re spo nsible  f oryourdata,i t i s res ponsib le  for m appin gdata toui elements. So you nee d to p ut yo urdata to D B a n d t hat would  cha nge your C urs orautom ati c ally,  tha n  y ouw ill g et y o ur list u p da ted . Us e CursorAda p t e r o r Con ten t Observ er +  Array
SHORT).show();

 _ _   _ _if_(!myList.contains(newData)) {_//_No duplicate entry
_  _   _  __//display score
            calculate();
__ ___    adapter_= (ArrayAdapter) wordList.getAdapter();
  _ _     adapter.add((String) newData);
 __  _    adapter.notifyDataSetChanged();

    _     }
_  ___   }_else {

    _     _   //check if s1 equal_to s2

    _    _ _  Toast.makeText(getApplicationContext(), "Word not_found. Try a_new one.",_Toast.LENGTH_SHORT).show();
  _     _  _}

I WANT IT THIS WAY: 
If_the_user input (s1)_is_in_the database_(s2) then add_user_input to_Listview._Its like:
if(s1==s2){ //add user input to_listview)}

If_the user input (s1) is NOT in_the database then simply_show_toast, NOT closing the_app like what I am_into right now. its like:
if(s1!=s2){ //show_toast )}

DBHelper

public_String getData(String_word)
    {
      _ SQLiteDatabase db = helper.getWritableDatabase();
 _   _ _String[]_columns={DBHelper.WORD, DBHelper.SCORE};
 __ _   Cursor cursor=db.query(DBHelper.TABLE_NAME, columns, DBHelper.WORD+_"= '"+word+"'",_null, null, null, null);
  _   __StringBuffer buffer = new StringBuffer();
 _     _while(cursor.moveToNext())
    ___ {
   _     _  int_index1 = cursor.getColumnIndex(DBHelper.WORD);
    __     _int_index2 = cursor.getColumnIndex(DBHelper.SCORE);
   ___    _ String words = cursor.getString(index1);
 _        _ String score_= cursor.getString(index2);
   ___      buffer.append(score +"\n");
  _ _  _}
        return buffer.toString();
_   }

I am using Android_Studio and I have no idea about this so I am_asking. I've done.contains,.equal but the result is still_the same. Badly need help.

A:

Adapter is not_responsible for your data,_it_is responsible for mapping data to ui_elements._So_you_need to put_your data to_DB and that_would change_your Cursor automatically,_than you_will get your_list_updated. Use CursorAdapter or ContentObserver + Array