android - 计算器在某些设备上不起作用

标签 android android-intent calculator

我在我的应用程序中使用计算器。它在某些设备上工作,但在其他一些设备上不起作用。我怎样才能让它兼容所有设备。

我正在使用这个代码。

Intent i = new Intent(); 
i.setClassName("com.android.calculator2", "com.android.calculator2.Calculator"); 
startActivity(i);   

请给我解决这个问题。

最佳答案

您的代码假设手机制造商没有用他们自己的自定义计算器替换标准的 Android 计算器。

您可以使用 Android 源代码 (or a derivative like this one) 并在您的应用中包含您自己的计算器实现。

这将与其他设备兼容,因为它没有外部依赖性。

关于android - 计算器在某些设备上不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13969215/

相关文章:

java - 两个按钮导致相同的 Activity

android - 发送电子邮件 Intent 选择器

python - 如何在我的第一个 python 计算器中修复这个 while 循环?

assembly - TI-84 asm 崩溃 - 它会删除 RAM 还是所有内容?

java - 从服务启动应用程序

java - 我计算阶乘的java代码有什么问题?

java - 为什么保存按钮在我的示例 Android 应用程序中不起作用

android - CapabilityClient 返回 null

java - 在带有文本和图像的 ListView 中使用 MatrixCursor 和 SimpleCursorAdapter

android - 在 Firebase 中存储信息应用程序数据的最佳方式是什么?