I ha开发者_Go百科ve the following questions, please if you know the answers share it with me.
- How can I transform my working Java code to NDK? (it's an algoritm not activity)
- I am able to access the database from NDK?
- Will a backtracking algorithm with 10 millions of iterations run faster if was written with NDK?
Android NDK allows you to use native (c/c++) code in your Android application. So, you would need to convert your code to c or c++.
The Android database is typically SQLite, so you would need a c/c++ interface for interacting with it. The docs don't talk about giving you that..
From the docs:
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. The NDK can, however, can be an effective way to reuse a large corpus of existing C/C++ code.
If your algorithm is cpu intensive, doesn't allocate much memory, and could be optimized in c/c++ it might be worth a shot..
精彩评论