使用Java通过指针检索parseUser

使用Java通过指针检索parseUser,java,android,parse-platform,Java,Android,Parse Platform,我试图显示一个用户谁张贴了一些东西的应用程序,我已经能够检索到内容的帖子,但没有用户。但是,用户被保存了下来,因为在我的IOS版本中,我可以清楚地看到我为测试应用程序而发布的帖子。我需要显示用户,但是用户指针不保存为字符串 如何获取指针后面的用户名 IOS版本: var findUser:PFQuery = PFUser.query() findUser.whereKey("objectId", equalTo: posts.objectForKey("user").objectId)

我试图显示一个用户谁张贴了一些东西的应用程序,我已经能够检索到内容的帖子,但没有用户。但是,用户被保存了下来,因为在我的IOS版本中,我可以清楚地看到我为测试应用程序而发布的帖子。我需要显示用户,但是
用户指针
不保存为字符串

如何获取指针后面的用户名

IOS版本:

var findUser:PFQuery = PFUser.query()
    findUser.whereKey("objectId", equalTo: posts.objectForKey("user").objectId) 
职位类别:

@ParseClassName("Posts")
公共类发布扩展了ParseObject{

public ParseUser getUser() {

    return getParseUser("user");
}

public void setUser(ParseUser value) {

    put("user", value);
}


public String getContent(){

    return getString("content");
}

public void setContent(String content){

    put("content", content);
}

@Override
public String toString(){
    return getString("user") + "\n" + getString("content");
}
}

列出活动:

List<Posts> posts = new ArrayList<Posts>();

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.parse_list);


    ParseQuery<Posts> query = new ParseQuery<Posts>("Posts");
    query.orderByDescending("createdAt");
    query.findInBackground(new FindCallback<Posts>() {
        @Override
        public void done(List<Posts> list, ParseException e) {
            if (e != null) {
                Toast.makeText(ParseListActivity.this, "Error " + e, Toast.LENGTH_SHORT).show();
            }
            for (Posts post : list) {
                Posts newPost = new Posts();
                newPost.setUser(post.getUser());
                newPost.setContent(post.getContent());
                posts.add(newPost);
            }

            ArrayAdapter<Posts> adapter = new ArrayAdapter<Posts>(ParseListActivity.this, android.R.layout.simple_list_item_1, posts);
            setListAdapter(adapter);

        }
    });
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.my, menu);
    return true;
}

/*
 * Creating posts and refreshing the list will be controlled from the Action
 * Bar.
 */
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {

        case R.id.action_refresh: {
            updatePostList();
            break;
        }

        case R.id.action_new: {
            newPost();
            break;
        }
    }
    return super.onOptionsItemSelected(item);
}
private void newPost() {
    Intent i = new Intent(this, newPost.class);
    startActivityForResult(i, 0);
}

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (resultCode == Activity.RESULT_OK) {
        // If a new post has been added, update
        // the list of posts
        updatePostList();
    }
}


private void updatePostList() {
    ParseQuery<Posts> query = new ParseQuery<Posts>("Posts");
    query.orderByDescending("createdAt");
    query.findInBackground(new FindCallback<Posts>() {
        @Override
        public void done(List<Posts> list, ParseException e) {
            if (e != null) {
                Toast.makeText(ParseListActivity.this, "Error " + e, Toast.LENGTH_SHORT).show();
            }
            for (Posts post : list) {
                Posts newPost = new Posts();
                newPost.setContent(post.getContent());
                posts.add(newPost);
            }

            ArrayAdapter<Posts> adapter = new ArrayAdapter<Posts>(ParseListActivity.this, android.R.layout.simple_list_item_1, posts);
            setListAdapter(adapter);

        }
    });
}
List posts=new ArrayList();
@凌驾
创建时的公共void(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.parse_列表);
ParseQuery=新的ParseQuery(“Posts”);
query.orderByDescending(“createdAt”);
findInBackground(新的FindCallback(){
@凌驾
公共作废完成(列表,异常解析){
如果(e!=null){
Toast.makeText(ParseListActivity.this,“Error”+e,Toast.LENGTH_SHORT.show();
}
职位(职位:列表){
Posts newPost=新Posts();
newPost.setUser(post.getUser());
newPost.setContent(post.getContent());
添加(newPost);
}
ArrayAdapter=新的ArrayAdapter(ParseListActivity.this,android.R.layout.simple\u list\u item\u 1,posts);
setListAdapter(适配器);
}
});
}
@凌驾
公共布尔onCreateOptions菜单(菜单){
getMenuInflater().充气(R.menu.my,menu);
返回true;
}
/*
*创建帖子和刷新列表将由操作控制
*酒吧。
*/
@凌驾
公共布尔值onOptionsItemSelected(菜单项项){
开关(item.getItemId()){
案例R.id.action\u刷新:{
updatePostList();
打破
}
案例R.id.行动\新:{
newPost();
打破
}
}
返回super.onOptionsItemSelected(项目);
}
私有void newPost(){
Intent i=新Intent(这个,newPost.class);
startActivityForResult(i,0);
}
@凌驾
ActivityResult上的公共void(int请求代码、int结果代码、意图数据){
if(resultCode==Activity.RESULT\u确定){
//如果已添加新帖子,请更新
//员额清单
updatePostList();
}
}
私有void updatePostList(){
ParseQuery=新的ParseQuery(“Posts”);
query.orderByDescending(“createdAt”);
findInBackground(新的FindCallback(){
@凌驾
公共作废完成(列表,异常解析){
如果(e!=null){
Toast.makeText(ParseListActivity.this,“Error”+e,Toast.LENGTH_SHORT.show();
}
职位(职位:列表){
Posts newPost=新Posts();
newPost.setContent(post.getContent());
添加(newPost);
}
ArrayAdapter=新的ArrayAdapter(ParseListActivity.this,android.R.layout.simple\u list\u item\u 1,posts);
setListAdapter(适配器);
}
});
}
}


什么东西不起作用?你所说的指针是什么意思?在上面的图片中,你会看到user类有一个可点击的链接,它会拉起发布帖子的用户。我需要一种方法来拉起实际用户名越过指针,但是我不确定如何拉起。