1

所以这是我的代码:

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.merken);

    DatabaseStuff dbStuff = new DatabaseStuff(this);

    itDetails = new Intent(Merken.this, MerkDetails.class);
    lstMerken = (ListView) findViewById(R.id.ListViewMerken);

    ListAdapter adapter = new SimpleAdapter(
        this,
        dbStuff.getMerken(),
        R.layout.merkcell,
        new String[] { "name", "id" },
        new int[] { R.id.title, R.id.id }
    );
    lstMerken.setFastScrollEnabled(true);
    lstMerken.setAdapter(adapter);
    lstMerken.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView<?> aV, View vW, int pos, long lng) {
            Log.v("YH", lstMerken.getItemAtPosition(pos).toString());

            //MerkDetails.MerkUid = lstMerken.getItemAtPosition(i).toString();
            //startActivity(itDetails);
        }                 
    });
}

我现在得到的输出是:{name="someName", id="187"}

我的问题是我如何才能只输出187,所以只有id

4

1 回答 1

1

试试这个

  String uid = (String)((TextView) vW.findViewById(R.id.title)).getText().toString();
于 2013-03-23T15:09:44.270 回答