Monday, 15 February 2010

Android; SQLite database Cursor is null. It should not be. I don't know why it is -


I had a method that used to get records from a SQLite database, but after some time I changed it a bit and a secondary Method made

I do not know why but my basic method is now returning empty.

CardDbAdapter:

  throws public cardDb adapter open2 () SQLException {string meath = DB_PATH + DB_NAME; MyDatabaseR = SQLiteDatabase.openDatabase (myPath, blank, SQLiteDatabase.OPEN_READONLY); MyDatabaseW = SQLiteDatabase.openDatabase (myPath, Blank, SQLiteDatabase.OPEN_READWRITE); This return; } Public Zero MyDatabaseClose () {myDatabaseW.close (); MyDatabaseR.close (); } Public Array List & lt; String & gt; GetAllCardNames () {ArrayList & lt; String & gt; ReturnedAllCardNames; ArrayList & LT; String & gt; No results; ArrayList & LT; String & gt; NoResults2; NoResults = New ArrayList & lt; String & gt; (); NoResults.add ("cursor is zero"); NoResults2 = New ArrayList & lt; String & gt; (); NoResults2.add ("no identical card was found."); All Returned CardNames = New Array's & lt; String & gt; (); / * String named sqlquery_cardNames = "SELECT" + KEY_CARDNAME + "with the card where card_name '%" + passes + "%' ORDER card_name ASC"; * / // string sqlquery_cardNames; String sqlquery_cardNames = "select a different card card"; Cursor c_cardNames; C_cardNames = myDatabaseW.rawQuery (sqlquery_cardNames, null); C_cardNames.moveToFirst (); If (c_cardNames! = Null) {do (if (c_cardNames.getCount () & gt; 0) {string name came back = c_cardNames.getString (c_cardNames .getColumnIndex (KEY_CARDNAME)); returnedAllCardNames.add (returnedName);} and { return NoResults2;}} while (c_cardNames.moveToNext ());} return Noarslts;}   

I have to use it:

  Karddb Editor Yugioh db = new Karddbadaptr (this); yugiohDB.open2 (); Search_results = (ListView) Khojwubiaiaidi (Arkaidi.alkwhi.ask search_results.setOnItemClickListener (this); ArrayList & LT; string & gt; returned Kard_suchi 1 = New Arrestist & lt; st Ring & gt; (); returnedCards_list1.addAll (yugiohDB.getAllCardNames ()); ListAdapter = new Arreadptr & lt; String & gt; (Srcmodasim. This, Android. R. Lett. Sinpl_li_litimi_l, returned Kard_suchi 1); search_results. setAdapter (listAdapter); yugiohDB.MyDatabaseClose ();   

would appreciate any help.

If you do it that really want it to do Then download my app named UGOOH Library + Tools. Click the Search Library button from the main menu and then do the search button simple. It should display a list of cards from the database.

Because of this, I was changing it because I am setting up spinners so users can choose different business card sets to choose something, which will then list all the cards from that specific set .

Fixed the time I string array forgot to return "Lutaalkardnam", which is when the process The card used to keep records names. While

No comments:

Post a Comment