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

1 Answer 1

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)};
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.