Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/215.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
获取Android中Chrome的所有URL_Android_Google Chrome - Fatal编程技术网

获取Android中Chrome的所有URL

获取Android中Chrome的所有URL,android,google-chrome,Android,Google Chrome,我开始将我的应用程序与Android上的Google Chrome集成。我想检查我的URL是否已经被Chrome打开,然后我将开始打算打开该URL,或者切换到已经打开该URL的选项卡 所以我有两个问题: 我可以在当前Chrome应用程序中获取所有URL吗 我可以在Chrome应用程序中切换到tab吗 关于使用内容提供商,您可以阅读chrome的这些共享数据 content://com.android.chrome.browser/bookmarks content://com.androi

我开始将我的应用程序与Android上的Google Chrome集成。我想检查我的URL是否已经被Chrome打开,然后我将开始打算打开该URL,或者切换到已经打开该URL的选项卡

所以我有两个问题:

  • 我可以在当前Chrome应用程序中获取所有URL吗
  • 我可以在Chrome应用程序中切换到tab吗

关于

使用内容提供商,您可以阅读chrome的这些共享数据

  • content://com.android.chrome.browser/bookmarks
  • content://com.android.chrome.browser/searches
  • content://com.android.chrome.browser/history
  • content://com.android.chrome.browser/combined
  • content://com.android.chrome.browser/hierarchy
使用内容提供程序Uri访问数据

    String URL = "content://com.android.chrome.browser/bookmarks";

    Uri students = Uri.parse(URL);
    Cursor cursor = managedQuery(students, null, null, null, null);

    if (cursor.moveToFirst()) {
        do {
            StringBuilder sb = new StringBuilder();
            int columnsQty = cursor.getColumnCount();
            for (int idx=0; idx<columnsQty; ++idx) {
                try {
                    sb.append(cursor.getInt(idx));
                }catch (Exception e1){
                    try {
                        sb.append(cursor.getString(idx));
                    }catch (Exception e2){
                        try {
                            sb.append(cursor.getDouble(idx));
                        }catch (Exception e3){
                            try {
                                sb.append(cursor.getBlob(idx));
                            }catch (Exception e4){
                                try {
                                    sb.append(cursor.getFloat(idx));
                                }catch (Exception e5){
                                    try {
                                        sb.append(cursor.getLong(idx));
                                    }catch (Exception e6){
                                        sb.append("Error");
                                    }
                                }
                            }
                        }
                    }
                }

                if (idx < columnsQty)
                    sb.append(" ").append("( ").append(cursor.getColumnName(idx)).append(" )").append(" | ");
            }
            Log.e(TAG, String.format("Row: %d, Values: %s", cursor.getPosition(),
                    sb.toString()));
        } while (cursor.moveToNext());
    }
stringurl=”content://com.android.chrome.browser/bookmarks";
uristudents=Uri.parse(URL);
Cursor Cursor=managedQuery(学生,null,null,null,null);
if(cursor.moveToFirst()){
做{
StringBuilder sb=新的StringBuilder();
int columnsQty=cursor.getColumnCount();

对于(intidx=0;idx使用内容提供者,您可以读取这些chrome的共享数据

  • content://com.android.chrome.browser/bookmarks
  • content://com.android.chrome.browser/searches
  • content://com.android.chrome.browser/history
  • content://com.android.chrome.browser/combined
  • content://com.android.chrome.browser/hierarchy
使用内容提供程序Uri访问数据

    String URL = "content://com.android.chrome.browser/bookmarks";

    Uri students = Uri.parse(URL);
    Cursor cursor = managedQuery(students, null, null, null, null);

    if (cursor.moveToFirst()) {
        do {
            StringBuilder sb = new StringBuilder();
            int columnsQty = cursor.getColumnCount();
            for (int idx=0; idx<columnsQty; ++idx) {
                try {
                    sb.append(cursor.getInt(idx));
                }catch (Exception e1){
                    try {
                        sb.append(cursor.getString(idx));
                    }catch (Exception e2){
                        try {
                            sb.append(cursor.getDouble(idx));
                        }catch (Exception e3){
                            try {
                                sb.append(cursor.getBlob(idx));
                            }catch (Exception e4){
                                try {
                                    sb.append(cursor.getFloat(idx));
                                }catch (Exception e5){
                                    try {
                                        sb.append(cursor.getLong(idx));
                                    }catch (Exception e6){
                                        sb.append("Error");
                                    }
                                }
                            }
                        }
                    }
                }

                if (idx < columnsQty)
                    sb.append(" ").append("( ").append(cursor.getColumnName(idx)).append(" )").append(" | ");
            }
            Log.e(TAG, String.format("Row: %d, Values: %s", cursor.getPosition(),
                    sb.toString()));
        } while (cursor.moveToNext());
    }
stringurl=”content://com.android.chrome.browser/bookmarks";
uristudents=Uri.parse(URL);
Cursor Cursor=managedQuery(学生,null,null,null,null);
if(cursor.moveToFirst()){
做{
StringBuilder sb=新的StringBuilder();
int columnsQty=cursor.getColumnCount();

对于(int idx=0;idx检查chrome自定义选项卡@JineshFrancis我不使用chrome选项卡,我想使用chrome应用检查chrome自定义选项卡@JineshFrancis我不使用chrome选项卡,我想使用chrome应用我可以看到此数据返回的示例吗?我可以看到此数据返回的示例吗?