2012-08-01 36 views
0

如何將rawQueryContentProvider從一個應用程序傳遞到另一個應用程序?例如:select max(date) from tblename如何在ContentProvider中傳遞Rawquery?

例如:查詢主要活動:

private Uri CONTENT_URI = Uri.parse("content://ubra.c.apps.pro/Details"); 
cursor = getContentResolver().query(CONTENT_URI, null,null, null, "datePDate DESC"); 

ContentProvider

static UriMatcher uriMatcher; 
static String PRO_NAME = "ubra.c.apps.pro"; 
Uri CONTENT_URI = Uri.parse("content://" + PRO_NAME 
     + "/Details"); 

public Cursor query(Uri uri, String[] arg1, String arg2, String[] arg3, 
     String arg4) { 
    switch (uriMatcher.match(uri)) 
    { 
    case 1:   
     CPcursor = DBConnection.query("Details", arg1, arg2, arg3,arg2, arg2, arg4); 
     break; 

如何使用rawQuery在這裏?

+0

沒有解決方案嗎? – 2012-08-01 13:00:48

回答

1

該問題的最佳解決方案。

public Cursor query(Uri uri, String[] arg1, String arg2, String[] arg3,String arg4) 
{ 
    switch (uriMatcher.match(uri)) 
    { 
    case 1:   
     CPcursor = DBConnection.rawQuery("Enter your SQL query Here"')", null); 
     break; 
} 
}