Android java.lang.NumberFormatException:存储字符串时int无效
我犯了最奇怪的错误。我试图将一个字符串存储到Azure移动服务表中,我遇到了此异常。我正在生成一个GCM IDAndroid java.lang.NumberFormatException:存储字符串时int无效,android,azure-mobile-services,Android,Azure Mobile Services,我犯了最奇怪的错误。我试图将一个字符串存储到Azure移动服务表中,我遇到了此异常。我正在生成一个GCM ID java.lang.NumberFormatException: Invalid int: "C3960965-ECE0-4533-B99D-84DB3881A50F" public class User { private int id; private String gcmChannel; public User() { } /
java.lang.NumberFormatException: Invalid int: "C3960965-ECE0-4533-B99D-84DB3881A50F"
public class User
{
private int id;
private String gcmChannel;
public User()
{
}
/**
* Getters and setters
*
*/
public String getRegistrationId() {
return gcmChannel;
}
public final void setRegistrationId(String registrationId) {
gcmChannel = registrationId;
}
在Azure Mobile Services中创建的表发生了更改-默认情况下,表现在的ID类型为string,而不是integer,与以前一样。如果将类型定义更改为以下内容:
public class User
{
private String id;
private String gcmChannel;
// ... rest the same
}
它应该很好用。请注意,您还需要最新的Azure Mobile Services SDK for Android版本1.1.0,该版本支持字符串ID的类型-您可以在中找到该SDK
您可以在中找到此更改的公告,或在中找到有关此更改的更多信息