Reputation: 9351
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);
Upvotes: 2
Views: 5329
Reputation: 7626
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)};
Upvotes: 7