Sunday, December 15, 2013

[Android][Java][solved] Invalid character constant


Solution is change the code from
viewedRecordDao.viewArticle('sdgd','sdgsg');
to:
viewedRecordDao.viewArticle("sdgd","sdgsg");

Reason :
I use this line of statement to pass the parameters to a function in another class.
The parameters are in String Type

public int viewArticle(String articleId, String articleSection){
        Log.d("ViewRecordDao","Save View article_id");
        return 0;
}

text within " " is String in java & within ' ' is for one character.
So if you want pass String but not char in Java, use "" and not ''

Reference:
http://stackoverflow.com/questions/16061578/invalid-character-constant-in-java


No comments :

Post a Comment