Hello, you need to add the ability to like a post in the application, the documentation says that you need to call likes.add() . But the VKApi class VKApi not have this method. What am I doing wrong?
|
1 answer
The following method puts like:
public static String setLike(String type, String owner_id, int item_id ) { final String[] res = {""}; VKRequest request = new VKRequest("likes.add", VKParameters.from("type", type, "owner_id", owner_id, "item_id", item_id)); request.executeSyncWithListener(new VKRequest.VKRequestListener() { @Override public void onComplete(VKResponse response) { super.onComplete(response); try { JSONObject jsonObject = response.json.getJSONObject("response"); res[0] = jsonObject.getString("likes"); } catch (JSONException e) { e.printStackTrace(); } } }); return res[0]; } Run method:
setLike("post", "-id_группы_ВК", i); I think the input parameters for the method
String type, String owner_id, int item_id
you replace yourself.
|