当前位置: 首页>>代码示例>>Java>>正文


Java SimpleCursorAdapter.setViewBinder方法代码示例

本文整理汇总了Java中android.widget.SimpleCursorAdapter.setViewBinder方法的典型用法代码示例。如果您正苦于以下问题:Java SimpleCursorAdapter.setViewBinder方法的具体用法?Java SimpleCursorAdapter.setViewBinder怎么用?Java SimpleCursorAdapter.setViewBinder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.SimpleCursorAdapter的用法示例。


在下文中一共展示了SimpleCursorAdapter.setViewBinder方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreate

import android.widget.SimpleCursorAdapter; //导入方法依赖的package包/类
@Override
public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setHasOptionsMenu(true);

    adapter = new SimpleCursorAdapter(activity, R.layout.address_book_row, null,
            new String[] { AddressBookProvider.KEY_LABEL, AddressBookProvider.KEY_ADDRESS },
            new int[] { R.id.address_book_row_label, R.id.address_book_row_address }, 0);
    adapter.setViewBinder(new ViewBinder() {
        @Override
        public boolean setViewValue(final View view, final Cursor cursor, final int columnIndex) {
            if (!AddressBookProvider.KEY_ADDRESS.equals(cursor.getColumnName(columnIndex)))
                return false;

            ((TextView) view).setText(WalletUtils.formatHash(cursor.getString(columnIndex),
                    Constants.ADDRESS_FORMAT_GROUP_SIZE, Constants.ADDRESS_FORMAT_LINE_SIZE));

            return true;
        }
    });
    setListAdapter(adapter);

    loaderManager.initLoader(0, null, this);
}
 
开发者ID:guodroid,项目名称:okwallet,代码行数:26,代码来源:SendingAddressesFragment.java

示例2: getSmsListAdapter

import android.widget.SimpleCursorAdapter; //导入方法依赖的package包/类
private SimpleCursorAdapter getSmsListAdapter() {
    SimpleCursorAdapter adapter = new SimpleCursorAdapter(
            this,
            android.R.layout.simple_list_item_2,
            DbHelper.getDbHelper(this).getCursor(),
            new String[] { DbHelper.COLUMN_MESSAGE, DbHelper.COLUMN_RECIPIENT_NAME },
            new int[] { android.R.id.text1, android.R.id.text2 }
    );
    adapter.setViewBinder(new SimpleCursorAdapter.ViewBinder() {
        public boolean setViewValue(View view, Cursor cursor, int columnIndex) {
            TextView textView = (TextView) view;
            if (textView.getId() == android.R.id.text2) {
                textView.setText(getFormattedSmsInfo(cursor));
                return true;
            }
            return false;
        }
    });
    return adapter;
}
 
开发者ID:yeriomin,项目名称:SmsScheduler,代码行数:21,代码来源:SmsListActivity.java

示例3: onActivityCreated

import android.widget.SimpleCursorAdapter; //导入方法依赖的package包/类
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    getListView().setEmptyView(getActivity().findViewById(R.id.empty_bookmarks_layout));

    getLoaderManager().initLoader(0, null, this);

    //Setting up the adapter..
    String[] tFromColumnsSg = new String[]{ArticleTableM.COLUMN_TITLE, ArticleTableM.COLUMN_TEXT, ArticleTableM.COLUMN_TIME_MONTH, ArticleTableM.COLUMN_TIME_DAYOFMONTH};
    int[] tToGuiIt = new int[]{R.id.favorite_row_title, R.id.favorite_row_quote, R.id.favorite_row_date_month, R.id.favorite_row_date_dayofmonth}; //-contained in the layout
    mAdapter = new SimpleCursorAdapter(getActivity(), R.layout.element_favorite_row, null, tFromColumnsSg, tToGuiIt, 0);
    mAdapter.setViewBinder(new FavoriteViewBinderM());

    //..adding it to the ListView contained within this activity
    setListAdapter(mAdapter);
}
 
开发者ID:MettaCenter,项目名称:DailyMettaApp,代码行数:18,代码来源:BookmarksFragmentC.java

示例4: initData

import android.widget.SimpleCursorAdapter; //导入方法依赖的package包/类
private void initData() {
	final DataHelper dataHelper = new DataHelper(getActivity());
	mSession = dataHelper.getActiveSessionId();
	
	final String[] from = new String []{
			Schema.COL_ID,
			Schema.COL_BSSID,
			Schema.COL_SSID,
			"MAX(" + Schema.COL_LEVEL + ")",
			/*Schema.COL_IS_NEW_WIFI,*/
			Schema.COL_KNOWN_WIFI,
			Schema.COL_CAPABILITIES};

	final int[] to = new int [] {
			R.id.wifilistfragment_id,
			R.id.wifilistfragment_bssid,
			R.id.wifilistfragment_ssid,
			R.id.wifilistfragment_level,
			R.id.wifilistfragment_statusicon,
			R.id.wifilistfragment_capabilities};

	mAdapter = new SimpleCursorAdapter(getActivity().getBaseContext(),
			R.layout.wifilistitems, null, from, to, 0);
	mAdapter.setViewBinder(new WifiViewBinder());
	setListAdapter(mAdapter);
}
 
开发者ID:openbmap,项目名称:radiocells-scanner-android,代码行数:27,代码来源:WifiListContainer.java

示例5: initData

import android.widget.SimpleCursorAdapter; //导入方法依赖的package包/类
/**
 * 
 */
private void initData() {
	final DataHelper dataHelper = new DataHelper(getActivity());
	mSession = dataHelper.getActiveSessionId();

	final String[] from = new String[] {
			Schema.COL_ACTUAL_CELLID,
			Schema.COL_OPERATORNAME,
			Schema.COL_NETWORKTYPE,
			Schema.COL_AREA
	};

	final int[] to = new int[] {
			R.id.textViewCellID,
			R.id.textViewOperator,
			R.id.textViewNetworkType,
			R.id.textViewArea
	};

	mAdapter = new SimpleCursorAdapter(getActivity().getBaseContext(),
			R.layout.celllistitems, null, from, to, 0);

	mAdapter.setViewBinder(new NetworkTypeDescriptionViewBinder());
	setListAdapter(mAdapter);
}
 
开发者ID:openbmap,项目名称:radiocells-scanner-android,代码行数:28,代码来源:CellsListContainer.java

示例6: onCreate

import android.widget.SimpleCursorAdapter; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Uri uri = getIntent().getData();
    if (uri == null) {
        uri = NotificationSQLFormat.CONTENT_URI;
    }
    
    Cursor cursor = managedQuery(uri, PROJECTION, 
    		NotificationSQLFormat.DOWNLOADED + "=1", null, 
    		NotificationSQLFormat.DEFAULT_SORT_ORDER);

    SimpleCursorAdapter adapter = new SimpleCursorAdapter(this,
            android.R.layout.two_line_list_item, cursor,
            new String[] { NotificationSQLFormat.PATIENT_ID, 
    					   NotificationSQLFormat.FULL_MESSAGE },
            new int[] { android.R.id.text1, android.R.id.text2 });
    adapter.setViewBinder(this);
    setListAdapter(adapter);
}
 
开发者ID:SahilArora92,项目名称:vit-04,代码行数:23,代码来源:NotificationList.java

示例7: onCreate

import android.widget.SimpleCursorAdapter; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mInCallList = (ListView)findViewById(R.id.list_in_calls);

    mAdapter = new SimpleCursorAdapter(this,
                                       R.layout.list_recent_in_call,
                                       null,
                                       IN_CALL_COLUMNS,
                                       IN_CALL_RES_IDS,
                                       0);
    mAdapter.setViewBinder(MY_VIEW_BINDER);
    mInCallList.setAdapter(mAdapter);

    Log.d(TAG, "onResume: initializing loader...");
    getLoaderManager().initLoader(LOADER_MY_ID, null, this);
}
 
开发者ID:hiq-larryschiefer,项目名称:BasicLoader,代码行数:20,代码来源:MainActivity.java

示例8: onCreate

import android.widget.SimpleCursorAdapter; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Uri uri = getIntent().getData();
    if (uri == null) {
        uri = Notifications.CONTENT_URI;
    }
    
    Cursor cursor = managedQuery(uri, PROJECTION, 
    		Notifications.Contract.DOWNLOADED + "=1", null, 
    		Notifications.DEFAULT_SORT_ORDER);

    SimpleCursorAdapter adapter = new SimpleCursorAdapter(this,
            android.R.layout.two_line_list_item, cursor,
            new String[] { Notifications.Contract.PATIENT_ID, 
    					   Notifications.Contract.FULL_MESSAGE },
            new int[] { android.R.id.text1, android.R.id.text2 });
    adapter.setViewBinder(this);
    setListAdapter(adapter);
}
 
开发者ID:SanaMobile,项目名称:sana.mobile,代码行数:23,代码来源:NotificationList.java

示例9: changeDirection

import android.widget.SimpleCursorAdapter; //导入方法依赖的package包/类
private void changeDirection() {
	// handle change in direction
	// airportId below 10 (0 = Heathrow
	//                     1 = Gatwick
	//                     2 = Luton
	//                     3 = Stansted
	//                     4 = City
	//                     5 = Southend)
	// means direction is from airport to station. + 10 means it's from station to airport
	if (airportId < 10) {
		airportId += 10;
	} else {
		airportId -= 10;
	}
	Log.i("TrainListActivity", "Airport: " + airportId);
	cursor = loadData();
	Log.i("TrainListActivity", "Cursor: " + cursor.getCount());
	startManagingCursor(cursor);
	adapter = new SimpleCursorAdapter(this, R.layout.listrow, cursor, new String[] { "departTime", "arriveTime", "company" }, new int[] { R.id.from_time, R.id.to_time, R.id.img_logo });
	adapter.setViewBinder(new LogoViewBinder());
	setListAdapter(adapter);
}
 
开发者ID:androideverde,项目名称:airport-train-london,代码行数:23,代码来源:TrainListActivity.java

示例10: setCursorAdapter

import android.widget.SimpleCursorAdapter; //导入方法依赖的package包/类
public boolean setCursorAdapter()
  {
  	try
{
   	startManagingCursor(cursor);
	
	listView = (ListView) findViewById(android.R.id.list);
	
	simpleCursorAdapter = new SimpleCursorAdapter(this, R.layout.record, cursor, from, to);
      
	simpleCursorAdapter.setViewBinder(new ViewBinder()
	{
	    public boolean setViewValue(View aView, Cursor aCursor, int aColumnIndex)
	    {
	    	return setRecordViewValue(aView, aCursor, aColumnIndex);
	    }
	});
	
	listView.setAdapter(simpleCursorAdapter);
	
   	return true;
}
catch (Exception e)
{
	Log.w("Records", "setCursorAdapter : " + getApplicationContext().getString(R.string.log_records_error_set_cursor) + " : " + e);
	databaseManager.insertLog(getApplicationContext(), "" + getApplicationContext().getString(R.string.log_records_error_set_cursor), new Date().getTime(), 2, false);
	return false;
}
  }
 
开发者ID:vassela,项目名称:AC2RD,代码行数:30,代码来源:Records.java

示例11: setCursorAdapter

import android.widget.SimpleCursorAdapter; //导入方法依赖的package包/类
public boolean setCursorAdapter()
  {
  	try
{
   	startManagingCursor(cursor);
	
	listView = (ListView) findViewById(android.R.id.list);
	
	simpleCursorAdapter = new SimpleCursorAdapter(this, R.layout.log, cursor, from, to);
      
	simpleCursorAdapter.setViewBinder(new ViewBinder()
	{
	    public boolean setViewValue(View aView, Cursor aCursor, int aColumnIndex)
	    {
	    	return setLogViewValue(aView, aCursor, aColumnIndex);
	    }
	});
	
	listView.setAdapter(simpleCursorAdapter);
	
   	return true;
}
catch (Exception e)
{
	Log.w("TelephoneCallLogger", "setCursorAdapter : " + getApplicationContext().getString(R.string.log_telephone_call_logger_error_set_cursor) + " : " + e);
	databaseManager.insertLog(getApplicationContext(), "" + getApplicationContext().getString(R.string.log_telephone_call_logger_error_set_cursor), new Date().getTime(), 2, false);
	return false;
}
  }
 
开发者ID:vassela,项目名称:AC2RD,代码行数:30,代码来源:TelephoneCallLogger.java

示例12: setCursorAdapter

import android.widget.SimpleCursorAdapter; //导入方法依赖的package包/类
public boolean setCursorAdapter()
  {
  	try
{
   	startManagingCursor(cursor);
	
	listView = (ListView) findViewById(android.R.id.list);
	
	simpleCursorAdapter = new SimpleCursorAdapter(this, R.layout.filter, cursor, from, to);
      
	simpleCursorAdapter.setViewBinder(new ViewBinder()
	{
	    public boolean setViewValue(View aView, Cursor aCursor, int aColumnIndex)
	    {
	    	return setFilterViewValue(aView, aCursor, aColumnIndex);
	    }
	});
    	
	listView.setAdapter(simpleCursorAdapter);
	
   	return true;
}
catch (Exception e)
{
	return false;
}
  }
 
开发者ID:vassela,项目名称:AC2RD,代码行数:28,代码来源:Filters.java

示例13: onCreate

import android.widget.SimpleCursorAdapter; //导入方法依赖的package包/类
@Override
public void onCreate(final Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);

    setHasOptionsMenu(true);

    adapter = new SimpleCursorAdapter(activity, R.layout.address_book_row, null, new String[] { AddressBookProvider.KEY_LABEL,
            AddressBookProvider.KEY_ADDRESS }, new int[] { R.id.address_book_row_label, R.id.address_book_row_address }, 0);
    adapter.setViewBinder(new ViewBinder()
    {
        @Override
        public boolean setViewValue(final View view, final Cursor cursor, final int columnIndex)
        {
            if (!AddressBookProvider.KEY_ADDRESS.equals(cursor.getColumnName(columnIndex)))
                return false;

            ((TextView) view).setText(WalletUtils.formatHash(cursor.getString(columnIndex), Constants.ADDRESS_FORMAT_GROUP_SIZE,
                    Constants.ADDRESS_FORMAT_LINE_SIZE));

            return true;
        }
    });
    setListAdapter(adapter);

    loaderManager.initLoader(0, null, this);
}
 
开发者ID:soapboxsys,项目名称:ombuds-android,代码行数:28,代码来源:SendingAddressesFragment.java

示例14: onCreate

import android.widget.SimpleCursorAdapter; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Get a cursor with all phones
    Cursor c = getContentResolver().query(Phone.CONTENT_URI,
            PHONE_PROJECTION, null, null, null);
    startManagingCursor(c);

    // Map Cursor columns to views defined in simple_list_item_2.xml
    SimpleCursorAdapter adapter = new SimpleCursorAdapter(this,
            android.R.layout.simple_list_item_2, c,
                    new String[] {
                        Phone.TYPE,
                        Phone.NUMBER
                    },
                    new int[] { android.R.id.text1, android.R.id.text2 });
    //Used to display a readable string for the phone type
    adapter.setViewBinder(new SimpleCursorAdapter.ViewBinder() {
        public boolean setViewValue(View view, Cursor cursor, int columnIndex) {
            //Let the adapter handle the binding if the column is not TYPE
            if (columnIndex != COLUMN_TYPE) {
                return false;
            }
            int type = cursor.getInt(COLUMN_TYPE);
            String label = null;
            //Custom type? Then get the custom label
            if (type == Phone.TYPE_CUSTOM) {
                label = cursor.getString(COLUMN_LABEL);
            }
            //Get the readable string
            String text = (String) Phone.getTypeLabel(getResources(), type, label);
            //Set text
            ((TextView) view).setText(text);
            return true;
        }
    });
    setListAdapter(adapter);
}
 
开发者ID:luoqii,项目名称:ApkLauncher,代码行数:40,代码来源:List3.java

示例15: fillData

import android.widget.SimpleCursorAdapter; //导入方法依赖的package包/类
private void fillData() {
    String[] from = new String[] { FavoritesColumns.NAME, FavoritesColumns.FAVICON };
    //String[] from = new String[] { FavoritesColumns.NAME };
    int[] to = new int[] { R.id.favorite_name, R.id.favicon };

    mAdapter = new SimpleCursorAdapter(getActivity(), R.layout.favorites_row,
            null, from, to, CursorAdapter.NO_SELECTION);

    mAdapter.setViewBinder(new ViewBinder() {
        @Override
        public boolean setViewValue(View view, Cursor cursor, int columnIndex) {
            if (columnIndex == FavoritesQuery.FAVICON) {
                ImageView faviconView = (ImageView) view;
                // views are recycled, so need to reset the image in each
                // one before returning or we'll get the wrong image for a
                // favorite without a favicon
                faviconView.setImageBitmap(null);

                final byte[] blob = cursor.getBlob(FavoritesQuery.FAVICON);
                if (blob == null || blob.length == 0) {
                    faviconView.setVisibility(View.GONE);
                    return true;
                }
                faviconView.setVisibility(View.VISIBLE);
                Bitmap bitmap = BitmapFactory.decodeByteArray(blob, 0, blob.length);
                if (bitmap != null) {
                    faviconView.setImageBitmap(bitmap);
                    faviconView.setScaleType(ImageView.ScaleType.CENTER_CROP);
                }
                return true;
            }
            return false;
        }
    });
}
 
开发者ID:svrana,项目名称:Viz,代码行数:36,代码来源:Favorites.java


注:本文中的android.widget.SimpleCursorAdapter.setViewBinder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。