Tuesday, April 29, 2014

How to add Content Provider manner in SimpleAdapter query multimedia files? ?


How about in
package com.widget.demo;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import android.app.ListActivity;
import android.os.Bundle;
import android.widget.ListView;
import android.widget.SimpleAdapter;

public class CompactListDemo extends ListActivity {

@ Override
public void onCreate (Bundle savedInstanceState) {

super.onCreate (savedInstanceState);

SimpleAdapter adapter = new SimpleAdapter (this,
getData (), / / ​​put the data
ListViewR.layout.listitem, / / ​​put the data layout
new String [] {"title", "info", "img"} key
, / / ​​Map collectionnew int [] {R.id.title, R.id.info, R.id.img}) ;/ / with the first four parameters correspond
setListAdapter (adapter);
}

private List > getData () {

List > list = new ArrayList > ();

Map map = new HashMap ();

map.put ("title", "Android");

map.put ("info", "google product");

map.put ("img", R.drawable.android);

list.add (map);

map = new HashMap ();

map.put ("title", "Monkey");

map.put ("info", "i like");

map.put ("img", R.drawable.monkey);

list.add (map);

map = new HashMap ();

map.put ("title", "Panda");

map.put ("info", "sign of china");

map.put ("img", R.drawable.panda);

list.add (map);

return list;

}

}
Canadian Content Provider inside this way? ? ?
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
Google CursorAdapter
Reply:
Content Provider statement, how to simultaneously obtain the value of Audio and video of? ? ?

No comments:

Post a Comment