首页 \ 问答 \ 如果用户在其设备中禁用了Chrome浏览器,则Chrome自定义标签会崩溃(Chrome custom tab crashes if chrome browser is disabled by the user in his device)

如果用户在其设备中禁用了Chrome浏览器,则Chrome自定义标签会崩溃(Chrome custom tab crashes if chrome browser is disabled by the user in his device)

我试图在chrome custom tab打开pdf file ,使用此代码可以正常工作

CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
CustomTabsIntent customTabsIntent = builder.build();
customTabsIntent.launchUrl(this, Uri.parse("https://docs.google.com/viewerng/viewer?url=" +pdflink));

但问题是,如果用户已从应用程序设置中禁用了Chrome,并且没有其他浏览器崩溃。 那么如果禁用它,我如何在chrome自定义选项卡中打开它。

提前致谢。

这是logcat中出现的异常。

 Caused by: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=https://docs.google.com/... (has extras) }

I am trying to open pdf file in chrome custom tab, it works fine by using this code

CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
CustomTabsIntent customTabsIntent = builder.build();
customTabsIntent.launchUrl(this, Uri.parse("https://docs.google.com/viewerng/viewer?url=" +pdflink));

But the problem is, if the user have disabled chrome from app settings and there is no other browser it crashes. So how can i open it in the chrome custom tab if it is disabled.

Thanks in advance.

this is the exception that is showing up in the logcat.

 Caused by: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=https://docs.google.com/... (has extras) }

原文:https://stackoverflow.com/questions/45561595
更新时间:2023-10-27 16:10

最满意答案

“算法”的最常见定义不允许算法指定图灵机不能执行的计算。 假设您正在使用其中一个传统定义,

不可以。所有图灵机都可以用图灵完整语言指定(模数资源限制)。 这些确定性语言大体上是图灵完备的。

也就是说,您可能无法编写某些类型的软件(而不是算法),例如设备驱动程序,因硬件接口原因需要处理易失性内存 ,而且出于安全原因,特殊用途软件有时会出于不可预测的行为,例如加密生成键,盐或non。 密码学上强大的PRNG是确定性的,但生成密钥的最佳方法是通过真正随机性的来源。

例如,最小的JavaScript(并且只有JavaScript;没有DOM绑定)解释器减去Math.randomDate.now以及一些其他非确定性来源将有资格作为确定性,因为它的事件循环并发模型指定了交错。 JavaScript是一种图灵完备语言,可以表达像Java这样的语言可以使用的任何算法。 您可以在该基本JavaScript中包含类似setTimeout的工具,该工具仅允许0作为延迟,以允许确定性延迟评估,从而提供切片时间的丰富确定性方法。

Verilog是另一种事件循环并发语言,具有图灵完备的富有表现力的确定性子集。

Joe-E是图灵完整的Java子集,旨在提供确定性保证,作为提供“Java中可验证的功能纯度”的一部分,尽管它试图支持Java的线程模型。

除了事件循环并发之外,还有各种各样的actor模型提供了确定性,正如什么是*确定性并发*所讨论的那样


Most common definitions of "algorithm" do not allow an algorithm to specify a computation that cannot be performed by a Turing machine. Assuming you are using one of those conventional definitions,

No. All Turing machines can be specified (modulo resource limits) in a Turing complete language. These deterministic languages are Turing complete by and large.

That said, you may not be able to write some kinds of software (not algorithms) like device drivers that need to deal well with volatile memory for hardware interface reasons and special purpose software sometimes wants to behave unpredictably for security reasons, e.g. generation of cryptographically strong keys, salts, or nonces. There are cryptographically strong PRNGs that are deterministic, but the best way to generate a key is via a source of true randomness.

As an example, a minimal JavaScript (and only JavaScript; no DOM bindings) interpreter minus Math.random and Date.now and a few other sources of non-determinism would qualify as deterministic since its event-loop concurrency model specifies the interleaving. JavaScript is a Turing-complete language that can express any algorithm that a language like Java can. You can include in that basic JavaScript a facility like setTimeout that only allows 0 as the delay to allow deterministic delayed evaluation providing a rich deterministic way to slice time.

Verilog is another event-loop concurrent language that has a Turing-complete richly expressive deterministic subset.

Joe-E is a Turing complete subset of Java that aims to provide determinism guarantees as part of providing "Verifiable Functional Purity in Java" though it punts on trying to support Java's threading model.

Besides event-loop concurrency, there are varieties of the actor model that provide determinism as discussed at What's *Deterministic concurrency*?

相关问答

更多
  • 通常,相同的数据将以完全相同的方式序列化。 但是,protobuf规范无法保证这一点。 例如,编码中的以下差异是允许的,并且必须在所有符合的库中解码为相同的结果: 编码字段的顺序与标签编号顺序不同。 将打包字段编码为解压缩。 将整数编码为比所需更长的varint字节序列。 多次编码相同(非重复)字段。 可能是其他人。 In general, the same data will serialize in exactly the same way. However, this is not guarantee ...
  • CONVERT(DATE, DATEADD(d, 13 - DATEDIFF(d, CONVERT(DATE, '9/23/10',101), serviceDate) % 14, serviceDate),101) 当您在SQL Server中的索引计算列中引用日期数据类型字符串文字时,我们建议您使用确定性日期格式样式将文字显式转换为所需的日期类型。 有关确定性的日期格式样式的列表,请参阅CAST和CONVERT。 涉及将字符串隐式转换为日期数据类型的表达式被认为是不确定的,除非数据库兼容性级别设置为 ...
  • 我会说“测试应该是确定性的,可重复的”并不总是适用。 他们显然有相当大的地方,但随机测试也很有用。 除了QuickCheck / ScalaCheck和朋友之外,还有诸如模糊测试之类的方法。 I'd say that "tests should be deterministic and repeatable" doesn't always apply. They obviously have their rather large place, but randomized testing is useful ...
  • BOL实际上指出: 以下函数并不总是确定性的 ,但可以在计算列上的索引视图或索引中以确定性方式指定它们。 然后在下面说明必须满足哪些条件才能使其具有确定性。 例如 CAST - 除非与datetime,smalldatetime或sql_variant一起使用,否则为确定性 换句话说,你需要满足这些条件以确定性的方式使用它们 例如,当你创建一个表 CREATE TABLE [dbo].[deterministicTest]( [intDate] [int] NULL, [dateDateTi ...
  • 我知道截止日期已过,但有人可能会在未来发现它有用。 (a + b + c)* WcW ^ R,其中W在(a + b)+中; 这是不确定的,因为你不知道“WcW”位开始的位置。 W ^ RcW(a + b + c)*,其中W在(a + b)+中; 这是确定性的,因为你可以写一个确定性PDA来接受形式为“W ^ RcW”的简单回文并修改接受状态以在a,b和c中的任何一个上循环。 这里的诀窍是,PDA必须从左到右读取输入。 I know the deadline has passed, but somebody ...
  • 解决方案是添加 WITH SCHEMABINDING 正如在这个问题中建议的Sql Server确定性的用户定义函数 FUNCTION [dbo].[QDay] ( @Date DATETIME ) RETURNS INT WITH SCHEMABINDING AS BEGIN RETURN YEAR(@Date)*10000+MONTH(@Date)*100+DAY(@Date) END The solution was to add WITH SCHEMABINDING as s ...
  • “算法”的最常见定义不允许算法指定图灵机不能执行的计算。 假设您正在使用其中一个传统定义, 不可以。所有图灵机都可以用图灵完整语言指定(模数资源限制)。 这些确定性语言大体上是图灵完备的。 也就是说,您可能无法编写某些类型的软件(而不是算法),例如设备驱动程序,因硬件接口原因需要处理易失性内存 ,而且出于安全原因,特殊用途软件有时会出于不可预测的行为,例如加密生成强键,盐或non。 密码学上强大的PRNG是确定性的,但生成密钥的最佳方法是通过真正随机性的来源。 例如,最小的JavaScript(并且只有Ja ...
  • NOW()非常不确定,只是你给出的定义。 确定性的观点是,如果结果取决于当前时间,它允许基于假设的各种优化。 有关示例讨论,请参见http://forums.mysql.com/read.php?98,406891,406895#msg-406895 。 NOW() is very much non-deterministic, just by the definition you gave. The point of deterministic is that it allows various opti ...
  • “在形式语言的CHOMSHY分类的背景下” (1) L 3 = {ww R | w∈{a,b} * } 语言L 3是非确定性上下文自由语言,也是非明确和线性语言。 (2) L p是括号匹配的语言。 有两个终端符号“(”和“)”。 L p的语法是: S → SS S → (S) S → () 这种语言也是非线性的,确定性的和明确的。 作为L p和L 3的并集的语言L是明确的,非线性的(由于L p ),并且是非确定性的(由于L 3 )(假设两种语言的语言符号不同)。 这个语言是维恩图中语言的一个例子,我 ...
  • haskell具有许多并行和并发功能 。 自从haskell实施以来, STM已经普及并得到了很多讨论。 你可能也喜欢Go,它有一个可能感兴趣的频道功能 。 haskell has a host of parallelism and concurrency features. STM has been popularized and much-discussed since being implemented by haskell. you might also like Go, it has a chan ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)