Questions tagged [native-activity]

NativeActivity is a convenience class provided by the Android SDK that notifies native code of any activity lifecycle callbacks and makes it possible to write Android application without any Java code at all.

The Android SDK provides the NativeActivity class, which is a convenience class that notifies your native code of any activity lifecycle callbacks (onCreate(), onPause(), onResume(), etc). You can implement the callbacks in your native code to handle these events when they occur. Applications that use native activities must be run on Android 2.3 (API Level 9) or later. You cannot access features such as Services and Content Providers natively, so if you want to use them or any other framework API, you can still write JNI code to do so.

http://developer.android.com/sdk/ndk/overview.html

http://developer.android.com/reference/android/app/NativeActivity.html

132 questions
14
votes
3 answers

Problem using OpenCV2.3.1 with Android Native Activity

i'm developing a computer vision application for Android. That work involves getting camera frames as fast as possible, so I'm trying to build a android application directly in c++ using "android_native_app_glue" and "libnative_camera" to get…
Edanna
  • 183
  • 8
14
votes
2 answers

Is it possible to create UI elements with the NDK ? - lack of specs in Android docs

After reading the related docs I don't get if I can create things like buttons or other UI elements used to get user inputs with just the use of C++/C code compiled with the NDK. There are no problems when i want to handle a "window" or activity…
12
votes
1 answer

Android pass parameter to Native Activity

My android application compirises two Activities: ".MainActivity" and "android.app.NativeActivity". The latter is implemented purely in C++. On button click in ".MainActivity" I start a native one trying to pass some parameters: public void…
Nick
  • 3,205
  • 9
  • 57
  • 108
12
votes
2 answers

Access Android APK Asset data directly in c++ without Asset Manager and copying

I'm using pure C++ in my engine to create a game engine in android. There is no single java file. Basically it is a game which should only be stored to external memory. When I move my asset data manually via adb to my external sd card the game works…
user312684
10
votes
1 answer

"Unable to find native library" error in Native Activity app

I have some problems with my Native Activity application. It works fine on 99% of devices. But sometimes users get the following error: java.lang.RuntimeException: Unable to start activity…
NightRadio
  • 101
  • 1
  • 4
8
votes
1 answer

Getting a Context from a NativeActivity

I have an application using NativeActivity. I want to call out into Java to do something that requires a Context (e.g., accessing TelephonyManager to query the IMEI). How do I get a valid Context for my activity? The ANativeActivity structure…
David Given
  • 13,277
  • 9
  • 76
  • 123
8
votes
4 answers

Can't load native shared library with dependencies in a native activity app

In my Android app I have 4 libraries: libTemplate.so depends on libPorkholt.so libPorkholt.so depends on libpng15.so depends on liblua.so depends on libopenal.so libpng15.so liblua.so libopenal.so If I write a small command line…
da_petcu21
  • 527
  • 4
  • 15
7
votes
1 answer

How-to use a shared library in native-activity

I have an Android project with a native activity. This native activity uses a shared library named "main" (libmain.so file) for starting. ( with the code of ndk/samples/native-activity ) This app works fine. the "main" module Android.mk file…
Gaetan
  • 721
  • 7
  • 5
7
votes
2 answers

NativeActivity does not finish

I call a NativeActivity from a JavaActivity. The entry point of my NativeActivity is android_main(struct android_app* state) At the end of this, I call ANativeActivity_finish However my native activity just hangs, instead of returning to the…
lost_bits1110
  • 2,380
  • 6
  • 33
  • 44
7
votes
1 answer

How to set content view of NativeActivity to component created in Java

Is there a way to set the content of a NativeActivity to a component created in Java (such as a FrameLayout, ImageView, etc)? I have a need to use a NativeActivity (for getting touchpad input on Xperia Play), but I also need to be able to view…
paulscode
  • 1,049
  • 1
  • 12
  • 29
7
votes
0 answers

Android EditText over NativeActivity: long press popup tap doesn't work on some device

I looking for help with strange issue in Android UI. I have a NativeActivity, subclassed in Java, like this: public class MainActivity extends NativeActivity { ... in AndroidManifest.xml:
6
votes
1 answer

Race condition in android dlopen()?

My Android app has a simple "loader" NativeActivity with a very simple android_main() which only loads a different shared object and passes control to it: typedef void (*Tandroid_main)( android_app*); void android_main( android_app* state ) { …
shoosh
  • 76,898
  • 55
  • 205
  • 325
6
votes
2 answers

java.lang.IllegalArgumentException: Unable to load native library

I'm using purely native NDK in my project (Native Activity). It works fine when I add Prebuilt static libraries with my .so in Android.mk file. But when I try linking Prebuilt shared library, it shows the below exception: 03-27 16:42:09.982:…
Karthik Sivam
  • 2,505
  • 3
  • 18
  • 24
6
votes
2 answers

OpenGL ES Error to String

Is there a standard for getting an error string from glGetError() (Android and iOS) and eglGetError() (Android) in OpenGL ES 1.1 or 2.0? I'm using something like this: #define AssertGL(x) { x; GLenum __gle = glGetError(); Assert(__gle ==…
Mike Weir
  • 3,094
  • 1
  • 30
  • 46
6
votes
2 answers

fopen/fread APK Assets from NativeActivity on Android

I have only been able to find solutions dated 2010 and earlier. So I wanted to see if there was a more up-to-date stance on this. I'd like to avoid using Java and purely use C++, to access files (some less-or-more than 1MB) stored away in the APK. …
Mike Weir
  • 3,094
  • 1
  • 30
  • 46
1
2 3
8 9