本文整理了Java中android.widget.SimpleCursorAdapter.<init>()
方法的一些代码示例,展示了SimpleCursorAdapter.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SimpleCursorAdapter.<init>()
方法的具体详情如下:
包路径:android.widget.SimpleCursorAdapter
类名称:SimpleCursorAdapter
方法名:<init>
暂无
代码示例来源:origin: stackoverflow.com
ListAdapter adapter = new SimpleCursorAdapter(MyList, Layout, c,
new String[] { "Name", "Score" }, to)
{
public boolean areAllItemsEnabled()
{
return false;
}
public boolean isEnabled(int position)
{
return false;
}
};
代码示例来源:origin: stackoverflow.com
SimpleCursorAdapter adapter = new SimpleCursorAdapter(this, android.R.layout.simple_list_item_1, null, from, to, 0) {
@Override
public boolean isEnabled(int position) {
return false;
}
};
代码示例来源:origin: stackoverflow.com
SimpleCursorAdapter cursorAdapter = new SimpleCursorAdapter(/* ur stuff */);
cursorAdapter.setViewBinder(new SimpleCursorAdapter.ViewBinder() {
public boolean setViewValue(View view, Cursor cursor, int columnIndex) {
if(columnIndex == 1) {
CheckBox cb = (CheckBox) view;
cb.setChecked(cursor.getInt(1) > 0);
return true;
}
return false;
}
});
代码示例来源:origin: stackoverflow.com
final SimpleCursorAdapter adapter = new SimpleCursorAdapter (context, cursor) {
@Override
public View getView (int position, View convertView, ViewGroup parent) {
final View view = super.getView(position, convertView, parent);
final TextView text = (TextView) view.findViewById(R.id.tvRow);
final LayoutParams params = text.getLayoutParams();
if (params != null) {
params.height = mRowHeight;
}
return view;
}
}
代码示例来源:origin: commonsguy/cw-omnibus
SpinnerAdapter buildPhonesAdapter(Activity a) {
String[] PROJECTION=new String[] { Contacts._ID,
Contacts.DISPLAY_NAME,
Phone.NUMBER
};
String[] ARGS={String.valueOf(Phone.TYPE_MOBILE)};
Cursor c=a.managedQuery(Phone.CONTENT_URI,
PROJECTION, Phone.TYPE+"=?",
ARGS, Contacts.DISPLAY_NAME);
SimpleCursorAdapter adapter=new SimpleCursorAdapter(a,
android.R.layout.simple_spinner_item,
c,
new String[] {
Contacts.DISPLAY_NAME
},
new int[] {
android.R.id.text1
});
adapter.setDropDownViewResource(
android.R.layout.simple_spinner_dropdown_item);
return(adapter);
}
}
代码示例来源:origin: commonsguy/cw-omnibus
SpinnerAdapter buildPhonesAdapter(Activity a) {
String[] PROJECTION=new String[] { Contacts.Phones._ID,
Contacts.Phones.NAME,
Contacts.Phones.NUMBER
};
String[] ARGS={String.valueOf(Contacts.Phones.TYPE_MOBILE)};
Cursor c=a.managedQuery(Contacts.Phones.CONTENT_URI,
PROJECTION,
Contacts.Phones.TYPE+"=?", ARGS,
Contacts.Phones.NAME);
SimpleCursorAdapter adapter=new SimpleCursorAdapter(a,
android.R.layout.simple_spinner_item,
c,
new String[] {
Contacts.Phones.NAME
},
new int[] {
android.R.id.text1
});
adapter.setDropDownViewResource(
android.R.layout.simple_spinner_dropdown_item);
return(adapter);
}
}
代码示例来源:origin: commonsguy/cw-omnibus
@Override
public void onViewCreated(View view, Bundle state) {
super.onViewCreated(view, state);
SimpleCursorAdapter adapter=
new SimpleCursorAdapter(getActivity(),
R.layout.row,
null,
new String[] {
DatabaseHelper.TITLE,
DatabaseHelper.PROFILE_IMAGE
},
new int[] { R.id.title, R.id.icon },
0);
adapter.setViewBinder(new QuestionBinder());
setListAdapter(adapter);
}
代码示例来源:origin: commonsguy/cw-omnibus
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
SimpleCursorAdapter adapter=
new SimpleCursorAdapter(getActivity(), R.layout.row,
current, new String[] {
DatabaseHelper.TITLE,
DatabaseHelper.VALUE },
new int[] { R.id.title, R.id.value },
0);
setListAdapter(adapter);
if (current==null) {
task=new LoadCursorTask(getActivity()).execute();
}
}
代码示例来源:origin: robolectric/robolectric
@Test
public void testChangeCursor() {
SimpleCursorAdapter adapter =
new SimpleCursorAdapter(context, 1, null, new String[] {"name"}, new int[] {2}, 0);
Cursor cursor = setUpDatabase();
adapter.changeCursor(cursor);
assertThat(adapter.getCursor()).isSameAs(cursor);
}
代码示例来源:origin: robolectric/robolectric
@Test
public void testSwapCursor() {
SimpleCursorAdapter adapter =
new SimpleCursorAdapter(context, 1, null, new String[] {"name"}, new int[] {2}, 0);
Cursor cursor = setUpDatabase();
adapter.swapCursor(cursor);
assertThat(adapter.getCursor()).isSameAs(cursor);
}
代码示例来源:origin: commonsguy/cw-omnibus
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
SimpleCursorAdapter adapter=
new SimpleCursorAdapter(getActivity(), R.layout.row,
current, new String[] {
DatabaseHelper.TITLE,
DatabaseHelper.VALUE },
new int[] { R.id.title, R.id.value },
0);
setListAdapter(adapter);
if (current==null) {
db=new DatabaseHelper(getActivity());
task=new LoadCursorTask().execute();
}
}
代码示例来源:origin: commonsguy/cw-omnibus
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
SimpleCursorAdapter adapter=
new SimpleCursorAdapter(getActivity(), R.layout.row,
current, new String[] {
DatabaseHelper.TITLE,
DatabaseHelper.VALUE },
new int[] { R.id.title, R.id.value },
0);
setListAdapter(adapter);
if (current==null) {
db=new DatabaseHelper(getActivity());
task=new LoadCursorTask().execute();
}
}
代码示例来源:origin: commonsguy/cw-omnibus
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
SimpleCursorAdapter adapter=
new SimpleCursorAdapter(getActivity(), R.layout.row,
current, new String[] {
DatabaseHelper.TITLE,
DatabaseHelper.VALUE },
new int[] { R.id.title, R.id.value },
0);
setListAdapter(adapter);
if (current==null) {
db=new DatabaseHelper(getActivity());
task=new LoadCursorTask().execute();
}
}
代码示例来源:origin: commonsguy/cw-omnibus
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
SimpleCursorAdapter adapter=
new SimpleCursorAdapter(getActivity(), R.layout.row,
current, new String[] {
DatabaseHelper.TITLE,
DatabaseHelper.VALUE },
new int[] { R.id.title, R.id.value },
0);
setListAdapter(adapter);
if (current==null) {
db=new DatabaseHelper(getActivity());
task=new LoadCursorTask().execute();
}
}
代码示例来源:origin: commonsguy/cw-omnibus
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
SimpleCursorAdapter adapter=
new SimpleCursorAdapter(getActivity(), R.layout.row,
current, new String[] {
DatabaseHelper.TITLE,
DatabaseHelper.VALUE },
new int[] { R.id.title, R.id.value },
0);
setListAdapter(adapter);
if (current==null) {
db=new DatabaseHelper(getActivity());
task=new LoadCursorTask().execute();
}
}
代码示例来源:origin: robolectric/robolectric
@Test
public void testSwapCursorToNull() {
SimpleCursorAdapter adapter =
new SimpleCursorAdapter(context, 1, null, new String[] {"name"}, new int[] {2}, 0);
Cursor cursor = setUpDatabase();
adapter.swapCursor(cursor);
adapter.swapCursor(null);
assertThat(adapter.getCursor()).isNull();
}
代码示例来源:origin: stackoverflow.com
Spinner spinner = (Spinner) findViewById(R.id.spinner);
spinner.setAdapter(new SimpleCursorAdapter(...));
for (int i = 0; i < spinner.getCount(); i++) {
Cursor value = (Cursor) spinner.getItemAtPosition(i);
long id = value.getLong(value.getColumnIndex("_id"));
if (id == rowid) {
spinner.setSelection(i);
}
}
代码示例来源:origin: stackoverflow.com
SimpleCursorAdapter shows = new SimpleCursorAdapter(this, R.layout.somelayout, accountCursor, from, to)
{
@Override
public void setViewText(TextView v, String text) {
super.setViewText(v, convText(v, text));
}
};
private String convText(TextView v, String text)
{
switch (v.getId())
{
case R.id.date:
String formatedText = text;
//do format
return formatedText;
}
return text;
}
代码示例来源:origin: stackoverflow.com
String[] fromColumns = {DBAdapter.KEY_CONDITIONS};
int[] toViews = {android.R.id.text1}; // The TextView in simple_list_item_1
setListAdapter(new SimpleCursorAdapter(this,
android.R.layout.simple_list_item_1, getData(symptoms),
fromColumns, toViews, 0));
代码示例来源:origin: NightscoutFoundation/xDrip
private void getData() {
Cursor cursor = Cache.openDatabase().rawQuery("Select * from Sensors order by _ID desc", null);
SimpleCursorAdapter adapter = new SimpleCursorAdapter(this,
R.layout.raw_data_list_item,
cursor,
new String[] { "started_at", "latest_battery_level", "uuid", "uuid" },
new int[] { R.id.raw_data_id, R.id.raw_data_value , R.id.raw_data_slope, R.id.raw_data_timestamp });
this.setListAdapter(adapter);
// ListView listView = (ListView) findViewById(R.id.list);
// listView.setAdapter(adapter);
}
内容来源于网络,如有侵权,请联系作者删除!