我花了很多时间在这上面并且无法弄清楚这一点.
我需要以隐身模式启动Chrome浏览器.
我的代码:
private void launchBrowser() {
String url = "http://foyr.com";
Intent launchGoogleChrome = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
launchGoogleChrome.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
launchGoogleChrome.setPackage("com.android.chrome");
try {
startActivity(launchGoogleChrome);
} catch (ActivityNotFoundException e) {
launchGoogleChrome.setPackage(null);
startActivity(launchGoogleChrome);
}
}
Run Code Online (Sandbox Code Playgroud)
我发现了几个帖子,但无法找到解决方案. 这里
这个链接给了我一些关于隐身模式的想法,但我也试过这个.
private void launchBrowser() {
String url = "http://foyr.com";
Intent launchGoogleChrome = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
launchGoogleChrome.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
launchGoogleChrome.setPackage("com.android.chrome");
launchGoogleChrome.putExtra("com.android.chrome.EXTRA_OPEN_NEW_INCOGNITO_TAB", true);
try {
startActivity(launchGoogleChrome);
} catch (ActivityNotFoundException e) {
launchGoogleChrome.setPackage(null);
startActivity(launchGoogleChrome);
}
}
Run Code Online (Sandbox Code Playgroud)
但Chrome浏览器没有从应用程序接收任何意图信息.任何人都可以帮助我哪里出错了,该怎么办?
任何人都遇到过这种情况.我需要为edittext显示最少4行,当minLines给出itworks时,但是当添加inputType标签时,Min Lines失败..
<EditText
android:id="@+id/my_review_review_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:inputType="textCapSentences|textAutoCorrect"
android:background="@drawable/rect"
android:gravity="top|left"
android:hint="Add a review"
android:maxLines="5"
android:minLines="4"
android:padding="10dp" />
Run Code Online (Sandbox Code Playgroud)
如果我错了请纠正我并给我一个解决方案....