return the early text from sql



  • We need to return the early text on the sqlite name to the textview. I was in the interior, nothing came out. Ask the plugs how to describe it after applying to the OBD through the cadet. Or maybe there's another way. Thank you.

     case R.id.btn_text:
                Cursor c = db.query("mytable", null, null, null, null, null, null);
    }
        // закрываем подключение к БД
        dbHelper.close();
    }
    


  • So you're supposed to have string names in your table, and you have to get one of them with a rand? Then there will be an approximate algorithm:

    (1) The handler runs and records all values ArrayList<String>(2) Then we call the method .size() to know its length (3) If size > 0♪ that's what we do ♪

    Random random = new Random();
    int randomValue = random.nextInt(size);
    String name = list.get(randomValue + 1);
    

    That's how it's supposed to work.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2