Example #1
0
 public _CursorAdapter_873(AlertParams _enclosing, [email protected]
                           .RecycleListView listView, [email protected] dialog, android.content.Context
                           baseArg1, android.database.Cursor baseArg2, bool baseArg3) : base(baseArg1, baseArg2
                                                                                             , baseArg3)
 {
     this._enclosing = _enclosing;
     this.listView   = listView;
     this.dialog     = dialog;
     {
         android.database.Cursor cursor = this.getCursor();
         this.mLabelIndex     = cursor.getColumnIndexOrThrow(this._enclosing.mLabelColumn);
         this.mIsCheckedIndex = cursor.getColumnIndexOrThrow(this._enclosing.mIsCheckedColumn
                                                             );
     }
 }
Example #2
0
 private void initFromColumns(android.database.Cursor cursor, string[] fromColumnNames
                              , int[] fromColumns)
 {
     {
         for (int i = fromColumnNames.Length - 1; i >= 0; i--)
         {
             fromColumns[i] = cursor.getColumnIndexOrThrow(fromColumnNames[i]);
         }
     }
 }
Example #3
0
        public override void onActivityResult(int requestCode, int resultCode, Intent data)
        {
            base.onActivityResult(requestCode, resultCode, data);

            if (requestCode == REQUEST_CODE_ACTION_PICK)
            {
                if (data != null)
                {
                    Uri uri = data.Data;
                    System.IO.Stream @is = null;
                    try
                    {
                        @is = ContentResolver.openInputStream(uri);
                    }
                    catch (FileNotFoundException e)
                    {
                        Console.WriteLine(e.ToString());
                        Console.Write(e.StackTrace);
                        return;
                    }

                    try
                    {
                        BitmapFactory.Options opts = new BitmapFactory.Options();
                        opts.inJustDecodeBounds = false;
                        opts.inSampleSize       = 1;
                        opts.inPreferredConfig  = Bitmap.Config.RGB_565;
                        Bitmap bm = BitmapFactory.decodeStream(@is, null, opts);
                        mImageView.ImageBitmap = bm;
                    }
                    catch (System.OutOfMemoryException e)
                    {
                        Console.WriteLine(e.ToString());
                        Console.Write(e.StackTrace);
                        return;
                    }

                    ContentResolver cr = ContentResolver;
                    Cursor          c  = cr.query(uri, new string[] { MediaStore.Images.Media.DATA }, null, null, null);
                    if (c == null || c.Count == 0)
                    {
                        return;
                    }
                    c.moveToFirst();
                    int    columnIndex = c.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
                    string text        = c.getString(columnIndex);
                    mTextView.Text = text;
                }
            }
        }
Example #4
0
 /// <summary>Swap in a new Cursor, returning the old Cursor.</summary>
 /// <remarks>
 /// Swap in a new Cursor, returning the old Cursor.  Unlike
 /// <see cref="changeCursor(android.database.Cursor)">changeCursor(android.database.Cursor)
 ///     </see>
 /// , the returned old Cursor is <em>not</em>
 /// closed.
 /// </remarks>
 /// <param name="newCursor">The new cursor to be used.</param>
 /// <returns>
 /// Returns the previously set Cursor, or null if there wasa not one.
 /// If the given new Cursor is the same instance is the previously set
 /// Cursor, null is also returned.
 /// </returns>
 public virtual android.database.Cursor swapCursor(android.database.Cursor newCursor
                                                   )
 {
     if (newCursor == mCursor)
     {
         return(null);
     }
     android.database.Cursor oldCursor = mCursor;
     if (oldCursor != null)
     {
         if (mChangeObserver != null)
         {
             oldCursor.unregisterContentObserver(mChangeObserver);
         }
         if (mDataSetObserver != null)
         {
             oldCursor.unregisterDataSetObserver(mDataSetObserver);
         }
     }
     mCursor = newCursor;
     if (newCursor != null)
     {
         if (mChangeObserver != null)
         {
             newCursor.registerContentObserver(mChangeObserver);
         }
         if (mDataSetObserver != null)
         {
             newCursor.registerDataSetObserver(mDataSetObserver);
         }
         mRowIDColumn = newCursor.getColumnIndexOrThrow("_id");
         mDataValid   = true;
         // notify the observers about the new cursor
         notifyDataSetChanged();
     }
     else
     {
         mRowIDColumn = -1;
         mDataValid   = false;
         // notify the observers about the lack of a data set
         notifyDataSetInvalidated();
     }
     return(oldCursor);
 }
Example #5
0
        internal virtual void init(android.content.Context context, android.database.Cursor
                                   c, int flags)
        {
            if ((flags & FLAG_AUTO_REQUERY) == FLAG_AUTO_REQUERY)
            {
                flags       |= FLAG_REGISTER_CONTENT_OBSERVER;
                mAutoRequery = true;
            }
            else
            {
                mAutoRequery = false;
            }
            bool cursorPresent = c != null;

            mCursor      = c;
            mDataValid   = cursorPresent;
            mContext     = context;
            mRowIDColumn = cursorPresent ? c.getColumnIndexOrThrow("_id") : -1;
            if ((flags & FLAG_REGISTER_CONTENT_OBSERVER) == FLAG_REGISTER_CONTENT_OBSERVER)
            {
                mChangeObserver  = new android.widget.CursorAdapter.ChangeObserver(this);
                mDataSetObserver = new android.widget.CursorAdapter.MyDataSetObserver(this);
            }
            else
            {
                mChangeObserver  = null;
                mDataSetObserver = null;
            }
            if (cursorPresent)
            {
                if (mChangeObserver != null)
                {
                    c.registerContentObserver(mChangeObserver);
                }
                if (mDataSetObserver != null)
                {
                    c.registerDataSetObserver(mDataSetObserver);
                }
            }
        }