安卓的Java,C或C ++? [英] Android: Java, C or C++?

查看:164
本文介绍了安卓的Java,C或C ++?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了一些简单的应用程序在Android中使用Java。
但后来我发现这一点:

I wrote some simple apps in Android using Java.
But later I found this:

它提供头文件和库,让您共建活动,   处理用户输入,使用硬件传感器,访问应用程序的资源,   多,用C或C编程的时候++。 (来源

It provides headers and libraries that allow you to build activities, handle user input, use hardware sensors, access application resources, and more, when programming in C or C++. (Source)

如何与此相关的:

Android应用程序是用Java编程语言。 (来源

Android applications are written in the Java programming language. (Source)

是这三种语言可能吗?
很抱歉的愚蠢的问题。

Are all three languages possible?
Sorry for the dumb question.

推荐答案

您的文章链接有良好的信息。网站还链接了<一href="http://developer.android.com/sdk/ndk/overview.html">http://developer.android.com/sdk/ndk/overview.html它说:

The article you link to has good information. It also links to http://developer.android.com/sdk/ndk/overview.html which says:

NDK的将不利于大多数应用程序。作为一个开发者,你需要   来平衡其对缺点的好处;值得注意的是,使用本机   code不会导致自动性能提高,但总是   提高了应用的复杂性。一般情况下,你应该只使用   本土code。如果是必要的应用程序,这不仅是因为   您preFER在C / C ++编程。

The NDK will not benefit most applications. As a developer, you need to balance its benefits against its drawbacks; notably, using native code does not result in an automatic performance increase, but always increases application complexity. In general, you should only use native code if it is essential to your application, not just because you prefer to program in C/C++.

典型的好人选NDK是自包含的,CPU密集型   操作不分配的内存,诸如信号处理,   物理学仿真,等等。只需重新编码的方法在运行C   通常不会导致大的性能提升。什么时候   检查你是否应该发展本土code,认为   您的要求,看看Android框架API提供   你需要的功能。 NDK的可以,但是,可以是   重用现有的C / C ++ code大语料库有效的方式。

Typical good candidates for the NDK are self-contained, CPU-intensive operations that don't allocate much memory, such as signal processing, physics simulation, and so on. Simply re-coding a method to run in C usually does not result in a large performance increase. When examining whether or not you should develop in native code, think about your requirements and see if the Android framework APIs provide the functionality that you need. The NDK can, however, can be an effective way to reuse a large corpus of existing C/C++ code.

这篇关于安卓的Java,C或C ++?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆