我想使用一项服务。我 100% 确定这项服务可以正常工作。
服务电话
public void add(User user) {
ConnectionRequest con = new ConnectionRequest();
String url="http://localhost/NY/untitled/web/app_dev.php/user/new"
+ "?Fonctionuser="+user.getUserFunction()
+"&Fullname="+user.getUserName()
+"&Imageproduit="+user.getUserImage()
+"&Latitude="+user.getLatitude()
+"&Longitude="+user.getLongitude()
+"&State="+user.getUserState();
System.out.println(user.getUserState());
con.setUrl(url);
NetworkManager.getInstance().addToQueue(con);
}
错误
Exception in thread "main" java.lang.NullPointerException
at com.codename1.io.NetworkManager.isAPSupported(NetworkManager.java:866)
at com.codename1.io.ConnectionRequest.<init>(ConnectionRequest.java:330)
at Services.UserServices.add(UserServices.java:18)
at Services.Main.main(Main.java:30)
主要方法
public static void main(String[] args) {
User user = new User();
user.setLatitude(111);
user.setLongitude(111);
user.setUserFunction( UserFunction.Client.ordinal());
user.setUserImage("uezfniez");
user.setUserState((int)UserState.Hold.ordinal());
user.setUserName("jamel");
UserServices userServices = new UserServices();
userServices.add(user);
}