0

我在 ReportedData 变量中接收数据。而且我不知道如何将数据导出为可解析的形式,请帮助。

javadoc不是很有帮助。

就是一切的开始。

我试过getCollumns、getRows,但无济于事。或者我只是做错了。有什么想法吗?

这是代码:

 ReportedData data = null;
                  UserSearchManager search = new UserSearchManager(ChatList.connection);
                  Form searchForm = null;
                try {
                    searchForm =   search.getSearchForm("search.webserv.xyz.com");
                } catch (XMPPException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
                  Form answerForm = searchForm.createAnswerForm();
                    answerForm.setAnswer("Username", true);
                    answerForm.setAnswer("search", "android");
                  answerForm.setAnswer("last", "android");
                  try {
                     data = search.getSearchResults(answerForm, "search.webserv.xyz.com"); 
                } catch (XMPPException e) {
                    e.printStackTrace();
                }
4

1 回答 1

0

下面是一个代码片段,展示了如何解析 ReportedData 变量:

if(data.getRows() != null)
    {
        Iterator<Row> it = data.getRows();
        while(it.hasNext())
        {
            Row row = it.next();
            Iterator iterator = row.getValues("jid");
            if(iterator.hasNext())
            {
                String value = iterator.next().toString();
                Log.i("Iteartor values......"," "+value);
            }
            //Log.i("Iteartor values......"," "+value);
        }
         Toast.makeText(_service,"Username Exists",Toast.LENGTH_SHORT).show();
         );
    }
于 2013-02-09T13:42:47.653 回答