问题描述
我能找到的所有示例都旨在打开特定的互联网地址,而不仅仅是带有新标签的 Chrome 浏览器。下面是打开“about:blank”页面和新标签页区别的截图:
关于:空白:
新标签:
这是我现在的活动课程:
public void openChrome(View view) {
String url = "http://www.stackoverflow.com";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
}
我如何只启动 chrome 应用程序(所以我返回到上一个会话),或者用一个空白的“新标签”页面打开它?有没有办法做到这一点?
解决方法
UPD:由于您的目标不是简单的“about:blank”页面,因此可能对您有用的是chrome://newtab
或chrome://new-tab-page
(可以在 chrome://about 中看到)。如果两者都使应用程序崩溃,那么我会认为这是一个错误。
对于普通的空白标签,请使用特殊的 about:blank
作为网址。
输入你想要的搜索引擎网址。
public static boolean canSum(int target,int[] arr) {
Map<Integer,Boolean> memo = new HashMap<>();
return canSum(target,arr,memo);
}
private static boolean canSum(int target,int[] arr,Map<Integer,Boolean> memo) {
if (memo.containsKey(target)) {
return memo.get(target);
}
if (target == 0) {
return true;
}
if (target < 0) {
return false;
}
for (int i = 0; i < arr.length; i++) {
int remainder = target - arr[i];
if (canSum(remainder,memo)) {
memo.put(target,true);
return true;
}
}
memo.put(target,false);
return false;
}
或者这个来启动chrome
String url = "https://google.com"; //In My case Google