Esempio n. 1
0
			internal virtual void changeCursor(android.database.Cursor cursor, bool releaseCursors
				)
			{
				if (cursor == this.mCursor)
				{
					return;
				}
				this.deactivate();
				this.mCursor = cursor;
				if (cursor != null)
				{
					cursor.registerContentObserver(this.mContentObserver);
					cursor.registerDataSetObserver(this.mDataSetObserver);
					this.mRowIDColumn = cursor.getColumnIndex("_id");
					this.mDataValid = true;
					// notify the observers about the new cursor
					this._enclosing.notifyDataSetChanged(releaseCursors);
				}
				else
				{
					this.mRowIDColumn = -1;
					this.mDataValid = false;
					// notify the observers about the lack of a data set
					this._enclosing.notifyDataSetInvalidated();
				}
			}
Esempio n. 2
0
		/// <summary>Gets the value of a string column by name.</summary>
		/// <remarks>Gets the value of a string column by name.</remarks>
		/// <param name="cursor">Cursor to read the value from.</param>
		/// <param name="columnName">The name of the column to read.</param>
		/// <returns>
		/// The value of the given column, or <code>null</null>
		/// if the cursor does not contain the given column.
		/// </returns>
		public static string getColumnString(android.database.Cursor cursor, string columnName
			)
		{
			int col = cursor.getColumnIndex(columnName);
			return getStringOrNull(cursor, col);
		}
Esempio n. 3
0
			internal MyCursorHelper(CursorTreeAdapter _enclosing, android.database.Cursor cursor
				)
			{
				this._enclosing = _enclosing;
				bool cursorPresent = cursor != null;
				this.mCursor = cursor;
				this.mDataValid = cursorPresent;
				this.mRowIDColumn = cursorPresent ? cursor.getColumnIndex("_id") : -1;
				this.mContentObserver = new android.widget.CursorTreeAdapter.MyCursorHelper.MyContentObserver
					(this);
				this.mDataSetObserver = new android.widget.CursorTreeAdapter.MyCursorHelper.MyDataSetObserver
					(this);
				if (cursorPresent)
				{
					cursor.registerContentObserver(this.mContentObserver);
					cursor.registerDataSetObserver(this.mDataSetObserver);
				}
			}
Esempio n. 4
0
		public override void changeCursor(android.database.Cursor c)
		{
			if (mClosed)
			{
				android.util.Log.w(LOG_TAG, "Tried to change cursor after adapter was closed.");
				if (c != null)
				{
					c.close();
				}
				return;
			}
			try
			{
				base.changeCursor(c);
				if (c != null)
				{
					mText1Col = c.getColumnIndex(android.app.SearchManager.SUGGEST_COLUMN_TEXT_1);
					mText2Col = c.getColumnIndex(android.app.SearchManager.SUGGEST_COLUMN_TEXT_2);
					mText2UrlCol = c.getColumnIndex(android.app.SearchManager.SUGGEST_COLUMN_TEXT_2_URL
						);
					mIconName1Col = c.getColumnIndex(android.app.SearchManager.SUGGEST_COLUMN_ICON_1);
					mIconName2Col = c.getColumnIndex(android.app.SearchManager.SUGGEST_COLUMN_ICON_2);
					mFlagsCol = c.getColumnIndex(android.app.SearchManager.SUGGEST_COLUMN_FLAGS);
				}
			}
			catch (System.Exception e)
			{
				android.util.Log.e(LOG_TAG, "error changing cursor and caching columns", e);
			}
		}