问题描述
我想在VK的android应用程序集成。对于这个我想按照这个链接下面的说明。
I am trying to integrate vk in android application . For this I am trying to follow the following instructions in this link . Vk integration .
我已经成功登录VK这个code。但尝试后在我的墙上状态之后,我有以下错误。
I have successfully logged in vk with this code . But after trying to post a status in my wall , I have got the following error .
02-20 14:08:54.779: W/System.err(2945): java.lang.NullPointerException
02-20 14:08:54.789: W/System.err(2945): at com.perm.kate.api.Api.createWallPost(Api.java:1200)
02-20 14:08:54.789: W/System.err(2945): at com.perm.kate.api.sample.MainActivity$5.run(MainActivity.java:100)
在MainActivity.java的100线以下$ C $,c定义。
In 100th line of MainActivity.java the following code is defined .
api.createWallPost(account.user_id, text, null, null, false, false, false, null, null, null, null, null, null);
在API.java的第一千二百线以下$ C $,c定义。
In 1200th line of API.java the following code is defined .
public WallMessage repostWallPost(String object, String message, Long gid, String captcha_key, String captcha_sid) throws IOException, JSONException, KException{
Params params = new Params("wall.repost");
params.put("group_id", gid);
params.put("message", message);
params.put("object", object);
addCaptchaParams(captcha_key, captcha_sid, params);
JSONObject root = sendRequest(params);
JSONObject response = root.getJSONObject("response");
WallMessage wall=new WallMessage();
wall.id = response.optLong("post_id");
wall.like_count=response.optInt("likes_count");
wall.reposts_count=response.optInt("reposts_count");
return wall;
}
createwallpost的方法被定义如下:
The method of createwallpost is defined as following:
public long createWallPost(long owner_id, String text, Collection<String> attachments, String export, boolean only_friends, boolean from_group, boolean signed, String lat, String lon, Long publish_date, Long post_id, String captcha_key, String captcha_sid) throws IOException, JSONException, KException{
Params params = new Params("wall.post");
params.put("owner_id", owner_id);
params.put("attachments", arrayToString(attachments));
params.put("lat", lat);
params.put("long", lon);
params.put("message", text);
if(export!=null && export.length()!=0)
params.put("services",export);
if (from_group)
params.put("from_group","1");
if (only_friends)
params.put("friends_only","1");
if (signed)
params.put("signed","1");
params.put("publish_date", publish_date);
if (post_id > 0)
params.put("post_id", post_id);
addCaptchaParams(captcha_key, captcha_sid, params);
JSONObject root = sendRequest(params, true);
JSONObject response = root.getJSONObject("response");
long res_post_id = response.optLong("post_id");
return res_post_id;
}
这是什么原因?你能帮我消除这个错误?
What is the reason ? Can you help me to eradicate this error ?
推荐答案
这帮助我:
api.createWallPost(account.user_id,信息,空,空,假的,假的,假的,NULL,NULL,新长征(0),新长征(0),NULL,NULL);
我希望这将是对你有所帮助。
I hope it will be helpful for you
这篇关于错误在VK发布状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!