I have a function which saves Android data in sqlite
but I have to convert the String
data to an Integer
.
Whenever the S
You can use following method,
String id = jsonarray.getJSONObject(i).getString("block_id")
int blockId = getBlockId(id);
@NonNull
private Integer getBlockId(String id) {
Integer blockId= 0;
try {
blockId= Integer.parseInt(id);
} catch (NumberFormatException e) {
e.printStackTrace();
}
return blockId;
}