Using int value in selection args argument of sqlite for android

android, database, sqlite

Solution

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)};

Problem

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); ```

Original source