title: Content provider uris from one app to other access
body: <p>I have created a content uri from one app :</p>
  
  <pre><code>content://SendDataProvider/bookevent
  </code></pre>
  
  <p>i am able to insert the values into it.
  like : </p>
  
  <pre><code>content://SendDataProvider/bookevent/1
  content://SendDataProvider/bookevent/2 etc...
  </code></pre>
  
  <p>but when i call it to other app for geting all record from this URI i use</p>
  
  <pre><code>String bookContentDataLog = "content://SendDataProvider/bookevent";
  Uri bookrecord = Uri.parse(bookContentDataLog);
  Cursor cursor = BookShelfActivity.this.getContentResolver().query(
                      bookrecord, null, null, null, null);
  
  if (cursor.moveToFirst()) {  // I got Null pointer exception here
                  String sessionId = cursor.getString(cursor.getColumnIndex(BOOK_COLUMN_SESSIONID));
                  String magId = cursor.getString(cursor.getColumnIndex(BOOK_COLUMN_MAG_ID));
  }
  </code></pre>
  
  <p>I debug it and i found that </p>
  
  <pre><code>BookShelfActivity.this.getContentResolver().query(
                      bookrecord, null, null, null, null);
  </code></pre>
  
  <p>this return null value to cursor.</p>
  
  <p>How i get all value inserted to this "content://SendDataProvider/bookevent"?</p>
  
  <p>============== I have Used method to insert to uri ===================
  1) Class Name and variables</p>
  
  <pre><code>public class SendDataProvider extends ContentProvider {
  
  
  public SendDataProvider(Context c) {
          this.context = c;//getContext();
          BookDb dbHelper = new BookDb(context);
          db = dbHelper.getWritableDatabase();
      }
  </code></pre>
  
  <p>2) content provider class methode :===</p>
  
  <pre><code>@Override
      public Uri insert(Uri uri, ContentValues contentValues) throws NullPointerException {
          Log.e("SendDataProvider @Override inserted call","Uri insert");
          long rowID = db.insert(BOOK_TABLE_NAME, null, contentValues);
          Log.e("SendDataProvider @Override inserted ID","Uri insert ID"+rowID);
          if (rowID &gt; 0) {
              Uri _uri = ContentUris.withAppendedId(CONTENT_URI, rowID);
              this.context.getContentResolver().notifyChange(_uri, null);
              return _uri;
          }
          throw new SQLException("Failed to add a record into " + uri);
      }
  </code></pre>
  
  <p>3) query </p>
  
  <pre><code>@Override
      public Cursor query(Uri uri, String[] projection, String selection,
              String[] selectionArgs, String sortOrder) {
  
                SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
                qb.setTables(BOOK_TABLE_NAME);
  
                switch (uriMatcher.match(uri)) {
                case uriCode:
                 qb.setProjectionMap(this.values);
                 break;
                default:
                 throw new IllegalArgumentException("Unknown URI " + uri);
                }
                if (sortOrder == null || sortOrder == "") {
                 sortOrder = BOOK_COLUMN_MAG_ID;
                }
                Cursor c = qb.query(db, projection, selection, selectionArgs, null,
                  null, sortOrder);
                c.setNotificationUri(this.context.getContentResolver(), uri);
                return c;
      }
  </code></pre>