use of android.widget.SimpleAdapter in project android-betterpickers by code-troopers.
the class ListSamples method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.list);
Intent intent = getIntent();
String path = intent.getStringExtra(INTENT_PATH);
if (path == null) {
path = "";
} else {
getSupportActionBar().setTitle(path);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
final ListView list = (ListView) findViewById(R.id.list);
list.setAdapter(new SimpleAdapter(this, getData(path), android.R.layout.simple_list_item_1, new String[] { "title" }, new int[] { android.R.id.text1 }));
list.setTextFilterEnabled(true);
list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Map<String, Object> map = (Map<String, Object>) list.getItemAtPosition(position);
Intent intent = (Intent) map.get("intent");
startActivity(intent);
}
});
}
use of android.widget.SimpleAdapter in project android-app by eoecn.
the class DetailsDiscussActivity method initList.
private void initList() {
mlist = new ArrayList<Map<String, Object>>();
mAdapter = new SimpleAdapter(this, mlist, R.layout.details_discuss_item, new String[] { "image", "name", "content", "time" }, new int[] { R.id.details_imageview_head, R.id.details_textview_name, R.id.details_textview_content, R.id.details_textview_time }) {
@Override
public void setViewImage(ImageView v, String value) {
// TODO Auto-generated method stub
super.setViewImage(v, value);
ImageUtil.setThumbnailView(value, v, DetailsDiscussActivity.this, callback, false);
}
ImageCallback callback = new ImageCallback() {
@Override
public void loadImage(Bitmap bitmap, String imagePath) {
// TODO Auto-generated method stub
try {
ImageView img = (ImageView) mListview.findViewWithTag(imagePath);
img.setImageBitmap(bitmap);
} catch (Exception e) {
e.printStackTrace();
}
}
};
};
mListview.setAdapter(mAdapter);
}
use of android.widget.SimpleAdapter in project UltimateAndroid by cymcsg.
the class ObservableScrollViewActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.observable_scroll_view_activity_main);
ListView listView = (ListView) findViewById(android.R.id.list);
listView.setAdapter(new SimpleAdapter(this, getData(), R.layout.observable_scroll_view_list_item_main, new String[] { TAG_CLASS_NAME, TAG_DESCRIPTION }, new int[] { R.id.className, R.id.description }));
listView.setOnItemClickListener(this);
}
use of android.widget.SimpleAdapter in project TextJustify-Android by bluejamesbond.
the class ListViewTest method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ArrayList<HashMap<String, ?>> data = new ArrayList<HashMap<String, ?>>();
data.add(new HashMap<String, Object>() {
{
put("Title", "Item 1");
}
});
data.add(new HashMap<String, Object>() {
{
put("Title", "Item 2");
}
});
data.add(new HashMap<String, Object>() {
{
put("Title", "Item 3");
}
});
final ListView listview = (ListView) findViewById(R.id.list);
SimpleAdapter adapter = new SimpleAdapter(this, data, R.layout.test_listview_item, new String[] { "Title" }, new int[] { R.id.title });
listview.setAdapter(adapter);
}
use of android.widget.SimpleAdapter in project Signal-Android by WhisperSystems.
the class CountrySelectionFragment method onLoadFinished.
@Override
public void onLoadFinished(Loader<ArrayList<Map<String, String>>> loader, ArrayList<Map<String, String>> results) {
String[] from = { "country_name", "country_code" };
int[] to = { R.id.country_name, R.id.country_code };
this.setListAdapter(new SimpleAdapter(getActivity(), results, R.layout.country_list_item, from, to));
if (this.countryFilter != null && this.countryFilter.getText().length() != 0) {
((SimpleAdapter) getListAdapter()).getFilter().filter(this.countryFilter.getText().toString());
}
}
Aggregations