小编And*_*hev的帖子

无法在外部应用程序中打开PDF文件

我想在用户点击按钮时打开PDF文件.目前,我正在使用此代码来实现此目的:

Uri path = Uri.fromFile(new File("file:///android_asset/regola11_1.pdf"));
            Intent pdfIntent = new Intent(Intent.ACTION_VIEW);
            pdfIntent.setDataAndType(path, "application/pdf");
            pdfIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
            startActivity(pdfIntent);
Run Code Online (Sandbox Code Playgroud)

但它不起作用.

当我选择使用Adobe Acrobat时,我会收到一条显示为Toast的消息

"This file could not be accessed Check the location or the network and try again."
Run Code Online (Sandbox Code Playgroud)

当我尝试使用Drive PDF Viewer时,我明白了

"Cannot display PDF ( regola11_1.pdf cannot be opened)"
Run Code Online (Sandbox Code Playgroud)

PDF文件存储在

app > build > intermediates > assets
Run Code Online (Sandbox Code Playgroud)

问题出在哪儿?

编辑

现在我使用以下代码:

File file = new File("\"file:///android_asset/regola11_1.pdf");
            Uri path = Uri.fromFile(file);
            Intent intent = new Intent(Intent.ACTION_VIEW);
            intent.setDataAndType(path, "application/pdf");
            intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

            try {
                context.startActivity(intent);
            }
            catch (ActivityNotFoundException e) { …
Run Code Online (Sandbox Code Playgroud)

pdf android uri assets

11
推荐指数
1
解决办法
2万
查看次数

用 Manim 同时显示两个动画

Manim noobie 在这里。

我试图同时运行两个动画,特别是,我试图显示一个从上方过渡到两个字母之间的点。在此期间,这两个字母应该在它们之间留出一些空间。关于如何这样做的任何建议?提前致谢。

python-3.x manim

6
推荐指数
1
解决办法
1601
查看次数

一次创建具有多个图形的场景

例如,许多不同的学科,物理学或经济学,需要一次显示多张图表,通常一个重叠显示,以展示某些冲击或事件如何影响不同的变量。这怎么能在 Manim 中完成?

python-3.x manim

4
推荐指数
1
解决办法
1206
查看次数

标签 统计

manim ×2

python-3.x ×2

android ×1

assets ×1

pdf ×1

uri ×1