Answer the question
In order to leave comments, you need to log in
How to get the text of the wiki page in the context using Android Studio and vk sdk?
Hello! I am writing a java application in Android Studio using the VK SDK. The group has a wiki page, you need to get its text. I use this get-request method https://vk.com/dev/pages.get in the parameters I send the id of the page owner, the id of the page, the need_source flag, which actually returns the text, and the site_preview flag (without it, the method fails).
textView = (TextView) findViewById(R.id.textView);
VKRequest request = new VKRequest("pages.get", VKParameters.from("owner_id", 289807139, "page_id", 52394462, "site_preview", 1, "need_source", 1));
Log.d(LOG_TAG, request.toString());
request.executeWithListener(new VKRequest.VKRequestListener() {
@Override
public void onComplete(VKResponse response) {
super.onComplete(response);
Log.d(LOG_TAG, response.responseString);
try {
JSONObject jsonObject = response.json.getJSONObject("response");
VKApiWikiPage vkApiWikiPage = new VKApiWikiPage();
vkApiWikiPage.parse(jsonObject);
textView.setText(vkApiWikiPage.source);
} catch (JSONException e) {
e.printStackTrace();
}
}
@Override
public void onError(VKError error) {
super.onError(error);
Log.d(LOG_TAG, error.toString());
}
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question