2

Is this the correct way to convert an int into a string before use with Integer.toString()? Is there another way to do this where conversion is not required?

Example:

 int value = 10;
 Cursor cursor = database.query(
    "TABLE_X", 
    new String[] { "COLUMN_A", "COLUMN_B" },
    "COLUMN_C = ?",
    new String[] { Integer.toString(value) },
    null,
    null,
    null);
chuff
  • 5,846
  • 1
  • 21
  • 26
Kevik
  • 9,181
  • 19
  • 92
  • 148

1 Answers1

7

Yes, you can use the following ways to convert int to String.

int i=10;
String[] str = new String[]{String.valueOf(i)};
String[] str1 = new String[]{Integer.toString(i)};
Zaid Daghestani
  • 8,555
  • 3
  • 34
  • 44
Avadhani Y
  • 7,566
  • 19
  • 63
  • 90