String.valueOf(int value) gives error [closed]
- by Davidrd91
I am trying to convert an int into a String so that I can put the String values into an SQLite Cursor. I've tried multiple syntax and methods but none seem to work for me.
The Error occurs in MangaItemDB() while trying to convert any Int types aswell as the boolean.
I've looked through several articles like this one but none works for me.
Here's my code:
public class MangaItem {
private int _id;
private String mangaName;
private String mangaLink;
private static String mangaAlpha;
private static int mangaCount;
private static int alphaCount;
private boolean mangaComplete = false;
public MangaItem MangaItemDB(int id, String mangaName, String mangaLink, String mangaAlpha, String mangaCount, String alphaCount, String mangaComplete) {
MangaItem MangaItemDB = new MangaItem();
MangaItemDB._id = id;
MangaItemDB.mangaName = mangaName;
MangaItemDB.mangaLink = mangaLink;
MangaItemDB.mangaAlpha = mangaAlpha;
MangaItemDB.mangaCount = String.valueOf(int mangaCount);
MangaItemDB.alphaCount = Integer.toString(getAlphaCount());
MangaItemDB.mangaComplete = String.valueOf(getMangaComplete());
return MangaItemDB;
}
public void incrementMangaCount() {
mangaCount++;
}
public int getMangaCount() {
return mangaCount;
}
public void incrementAlphaCount() {
alphaCount++;
}
public int getAlphaCount() {
return alphaCount;
}
public boolean setMangaComplete(boolean mangaComplete) {
return true;
}
public boolean getMangaComplete() {
return mangaComplete;
}
/**
* @return the mangaName
*/
public String getMangaName() {
return mangaName;
}
/**
* @param mangaName the mangaName to set
*/
public void setMangaName(String mangaName) {
this.mangaName = mangaName;
}
/**
* @return the mangaLink
*/
public String getMangaLink() {
return mangaLink;
}
/**
* @param mangaLink the mangaLink to set
*/
public void setMangaLink(String mangaLink) {
this.mangaLink = mangaLink;
}
/**
* @return the mangaAlpha
*/
public String getMangaAlpha() {
return mangaAlpha;
}
/**
* @param mangaAlpha the mangaAlpha to set
*/
public void setMangaAlpha(String mangaAlpha) {
this.mangaAlpha = mangaAlpha;
}
/**
* @return the _id
*/
public int get_id() {
return _id;
}
/**
* @param _id the _id to set
*/
public void set_id(int _id) {
this._id = _id;
}
}
The lines :
MangaItemDB.mangaCount = String.valueOf(mangaCount);
MangaItemDB.alphaCount = Integer.toString(getAlphaCount());
MangaItemDB.mangaComplete = String.valueOf(getMangaComplete());
all give "Type mismatch: cannot convert from String to Int"