I want to display a list of posts from the wall of the group in my Android application. I write this:

VKRequest request = VKApi.wall().get(VKParameters.from(VKApiConst.OWNER_ID,-95640286,VKApiConst.EXTENDED,1,VKApiConst.FIELDS,"text")); 

But my application displays a list with lines of this type:

 com.vk.sdk.api.model.VKApiPost@3c496ce0 

Why not display text posts on the wall of the group?

When replacing the line above with this:

 VKRequest request = VKApi.friends().get(VKParameters.from(VKApiConst.FIELDS,"first_name,last_name")); 

So I have a list of strings with the name and last name of my friends. The output of lines through ListView is carried out.

  • You received an instance of the com.vk.sdk.api.model.VKApiPost class. What you see in the list is the result of calling its toString method. Obviously, you need to pull the text out of this class, not the class itself. - Yuriy SPb
  • 2
    I’ll add to the previous comment: look at what get * methods are available for the com.vk.sdk.api.model.VKApiPost class. The documentation indicates the text field ( vkcom.imtqy.com/vk-android-sdk/com/vk/sdk/api/model/… ), it may have a public modifier, and is available for retrieval. This field contains the text of the post. - DimXenon
  • I understood the essence, but I don’t understand how to get the text out. Can you make an example for me to catch? - Vladimir

1 answer 1

Implement as described here.

The link is organized to receive the latest posts and their output to the console.