通过解析查询使用parse.com在listview中添加子项

时间:2014-12-20 14:04:28

标签: android eclipse parse-platform subitem android-parsequeryadapter

我已经从parse中显示了listview中的数据,应该显示的数据是用户名作为项目,血液组是该用户的子项目。我的应用程序正在显示该项目,但我不知道如何显示该子项目。来自解析的字段名称是"用户名"和" BloodGroup"。请问如何显示子项目。

这是

的代码
public class donar_list extends Activity {
// Declare Variables
 ListView listview;
 SimpleCursorAdapter adapter;
 List<ParseObject> ob;

   ProgressDialog mProgressDialog;
     // ParseQueryAdapter<ParseObject> adapter;


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

    ParseQueryAdapter.QueryFactory<ParseObject> factory =
             new ParseQueryAdapter.QueryFactory<ParseObject>() {
               public ParseQuery create() {
                 ParseQuery query = new ParseQuery("Data");
                 query.orderByDescending("createdAt");
                 query.whereContains("DonAcc", "donar");
                 return query;
               }
             };

         ParseQueryAdapter<ParseObject> Adapter = newParseQueryAdapter<ParseObject>    (this, factory);
         Adapter.setTextKey("username");
         final ListView listView = (ListView) findViewById(R.id.list);
         listView.setAdapter(Adapter);
      }
    }

布局

 <?xml version="1.0" encoding="utf-8"?>
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_width="fill_parent"
 android:layout_height="fill_parent" >

 <ListView
    android:id="@+id/list"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    />


 </RelativeLayout>

0 个答案:

没有答案