[android-developers] How to load resources like texture images & sound files in native code?
Dear Friends, I am trying to load resources(e.g. texture images, sound files) in my native .CPP file. As I have to use the resources like texture images in native code, this why I am looking for any method to add them in my native code itself. Is this possible to add resources in my JAVA file and access these resources in my native code? If yes then how? Please guide me. Atul Prakash Singh -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: How to load resources like texture images & sound files in native code?
Dear Stephen, I am new to Android Development through native code. As per your directions, I followed the example http://lol.zoy.org/blog/2011/3/2/load-pngs-using-android-ndk Unfortunately, I am not able to fully understand it. I am bit confused about its integration with actual code. Plz help. Rgds/Atul Prakash Singh On May 19, 11:56 am, Stephen Damm wrote: > On 11-05-19 12:50 AM, Atul Prakash wrote:> Dear Friends, > > > I am trying to load resources(e.g. texture images, sound files) in my > > native .CPP file. As I have to use the resources like texture images > > in native code, this why I am looking for any method to add them in my > > native code itself. > > > Is this possible to add resources in my JAVA file and access these > > resources in my native code? If yes then how? > > > Please guide me. > > > Atul Prakash Singh > > You can load the PNG for example into a Bitmap Java side. The standard > way you normally would in Android using AssetManager. Then fetch the > pixels into an array and then read from native side. Example > here:http://lol.zoy.org/blog/2011/3/2/load-pngs-using-android-ndk > > The alternative is to use libzip and unzip the apk (yes they are really > just a zip, even after signed and zipalign this still works). Once you > have used libzip to get a handle to the archive you can start reading > files. This is definitely a lot more work but depending your needs it > might be a necessity. Example here:http://androgeek.info/?p=275 > > Stephen Damm -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: How to know when home button pressed was pressed
Activity will be paused on pressing Home button. OnStop() function is also being called when we press the Home button. On May 30, 1:38 pm, Dianne Hackborn wrote: > Well first of all, pressing the home button does not close the app... > > > > > > > > > > On Mon, May 30, 2011 at 1:37 AM, Droid wrote: > > I have a workflow of about 15 activities. When a user presses the home > > button to close the whole app I cannot find a way of determining if > > the home button has been actuated that would allow me to stop a timer > > thread. > > > I have tried using life cycle methods (onStop(), OnStart() etc) to no > > avail because they are always stopping and starting when the app is > > running correctly anyway and I do not know the activity being viewed > > at the time of actuating the home button either. > > > I know there are many posts about this issue, but nevertheless I > > cannot seem to solve it. > > > -- > > You received this message because you are subscribed to the Google > > Groups "Android Developers" group. > > To post to this group, send email to android-developers@googlegroups.com > > To unsubscribe from this group, send email to > > android-developers+unsubscr...@googlegroups.com > > For more options, visit this group at > >http://groups.google.com/group/android-developers?hl=en > > -- > Dianne Hackborn > Android framework engineer > hack...@android.com > > Note: please don't send private questions to me, as I don't have time to > provide private support, and so won't reply to such e-mails. All such > questions should be posted on public forums, where I and others can see and > answer them. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: System.loadLibrary() failes in Android with UnsatisfiedLinkError
I recommend you to install cygwin along with Android NDK. Compile your native code using cygwin, refresh your project in Project Explorer then run the activity. Rgds/ Atul Prakash Singh On May 31, 1:36 pm, Vijay wrote: > Can you please tellme How can I do that ? (i.e compiling it for ARM? > I'm running my SDK in windows xp.? > > regards. > Vijay > > On Tue, May 31, 2011 at 2:02 PM, Nikolay Elenkov > wrote: > > > > > > > > > On Tue, May 31, 2011 at 5:27 PM, Viju wrote: > > > > I have added the lib folder in my project which contains both > > > jpcap.dll and libjpcap.so. Also I have given the Native library > > > location to this lib folder. > > > > When I try to call this function System.loadLibrary("jpcap") it throws > > > UnsatisfiedLinkError and the applications is getting crashed. > > > You certainly don't need the dll. Did you compile libjpcap.so for > > Android (ARM)? > > > -- > > You received this message because you are subscribed to the Google > > Groups "Android Developers" group. > > To post to this group, send email to android-developers@googlegroups.com > > To unsubscribe from this group, send email to > > android-developers+unsubscr...@googlegroups.com > > For more options, visit this group at > >http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] java.lang.RuntimeException: android.view.InflateException : Binary XML file: Error inflating class
ss.java:660) 03-25 12:28:50.842: ERROR/AndroidRuntime(1107): at java.lang.Class.getConstructor(Class.java:477) 03-25 12:28:50.842: ERROR/AndroidRuntime(1107): at android.view.LayoutInflater.createView(LayoutInflater.java:475) 03-25 12:28:50.842: ERROR/AndroidRuntime(1107): ... 21 more 03-25 12:28:50.882: WARN/ActivityManager(71): Force finishing activity com.myapp/.MyApp 03-25 12:28:51.392: WARN/ActivityManager(71): Activity pause timeout for HistoryRecord{441c18d0 com.myapp/.MyApp} 03-25 12:29:01.981: WARN/ActivityManager(71): Activity destroy timeout for HistoryRecord{441c18d0 com.myapp/.MyApp} 03-25 12:33:50.912: INFO/Process(1107): Sending signal. PID: 1107 SIG: 9 Please help me to solve this RunTime Exception. Thanks & Regards. Atul Prakash Singh -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: java.lang.RuntimeException: android.view.InflateException : Binary XML file: Error inflating class
Thanks a lot!! It worked. On Mar 26, 10:23 am, Romain Guy wrote: > To inflate a View from XML you need to implement the constructors that take > an AttributeSet. The constructor that only takes a Context is not invoked > when inflating from XML. > > On Fri, Mar 25, 2011 at 10:06 PM, Atul Prakash > wrote: > > > > > > > > > > > Dear Friends, > > > I am trying to inflate View class from xml resource. Moreover i am > > following all the conventions of Building Custom Components given on > > Android developer site. I have defined View class as subclass of My > > Activity class which is as follows: > > > public class MyApp extends Activity { > > @Override > > public void onCreate(Bundle savedInstanceState) { > > super.onCreate(savedInstanceState); > > setContentView(R.layout.main); > > } > > public static class MyAppView extends View { > > Bitmap menu; > > int menudemo[]; > > public MyAppView(Context context) { > > super(context); > > // TODO Auto-generated constructor stub > > menudemo = new int[] > > {R.drawable.menu,R.drawable.icon}; > > } > > @Override > > public void onDraw(Canvas canvas) { > > Resources res = getResources(); > > canvas.drawBitmap(BitmapFactory.decodeResource(res, > > menudemo[0]), > > 0, 0, null); > > System.gc(); > > invalidate(); > > } > > } > > } > > My main.xml is as follows: > > > > http://schemas.android.com/apk/res/ > > android" > > android:orientation="vertical" > > android:layout_width="fill_parent" > > android:layout_height="fill_parent" > > > > android:id="@+id/my" > > android:layout_width="fill_parent" > > android:layout_height="fill_parent" > > /> > > > android:layout_width="fill_parent" > > android:layout_height="wrap_content" > > android:text="@string/hello" > > /> > > > > > I do not know what is wrong with my coding, but when i am running this > > application i am getting run time exception like: > > > 03-25 12:28:50.842: ERROR/AndroidRuntime(1107): FATAL EXCEPTION: main > > 03-25 12:28:50.842: ERROR/AndroidRuntime(1107): > > java.lang.RuntimeException: Unable to start activity > > ComponentInfo{com.myapp/com.myapp.MyApp}: > > android.view.InflateException: Binary XML file line #7: Error > > inflating class com.myapp.MyApp$MyAppView > > 03-25 12:28:50.842: ERROR/AndroidRuntime(1107): at > > android.app.ActivityThread.performLaunchActivity(ActivityThread.java: > > 2663) > > 03-25 12:28:50.842: ERROR/AndroidRuntime(1107): at > > android.app.ActivityThread.handleLaunchActivity(ActivityThread.java: > > 2679) > > 03-25 12:28:50.842: ERROR/AndroidRuntime(1107): at > > android.app.ActivityThread.access$2300(ActivityThread.java:125) > > 03-25 12:28:50.842: ERROR/AndroidRuntime(1107): at > > android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033) > > 03-25 12:28:50.842: ERROR/AndroidRuntime(1107): at > > android.os.Handler.dispatchMessage(Handler.java:99) > > 03-25 12:28:50.842: ERROR/AndroidRuntime(1107): at > > android.os.Looper.loop(Looper.java:123) > > 03-25 12:28:50.842: ERROR/AndroidRuntime(1107): at > > android.app.ActivityThread.main(ActivityThread.java:4627) > > 03-25 12:28:50.842: ERROR/AndroidRuntime(1107): at > > java.lang.reflect.Method.invokeNative(Native Method) > > 03-25 12:28:50.842: ERROR/AndroidRuntime(1107): at > > java.lang.reflect.Method.invoke(Method.java:521) > > 03-25 12:28:50.842: ERROR/AndroidRuntime(1107): at > > com.android.internal.os.ZygoteInit > > $MethodAndArgsCaller.run(ZygoteInit.java:868) > > 03-25 12:28:50.842: ERROR/AndroidRuntime(1107): at > > com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) > > 03-25 12:28:50.842: ERROR/AndroidRuntime(1107): at > > dalvik.system.NativeStart.main(Native Method) > > 03-25 12:28:50.842: ERROR/AndroidRuntime(1107): Caused by: > > android.view.InflateException: Binary XML file line #7: Error > > inflating class com.myapp.MyApp$MyAppView > > 03-25 12:28:50.842: ERROR/AndroidRuntime(1107): at > > android.view.LayoutInflater.
[android-developers] Problem in setting Camera in 3D Android using opengles
hii m working on android 3D animation..i need to rotate my camera settings..using GLSURFACEVIEW i set up a viewport and frustum...now i want to rotate my camera in scene ...for that i need matrix of each object and of camera too...can anybody suggest any method so that i can render my scene from any view i want...source code will be really helpful thanks... -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Getting started with Android NDK
Hi, I have to use NDK for porting of my C/C++ code into ANDROID Game. Now that I am having problem to start with NDK. I have downloaded the NDK-r5b from developer.android.com But now, I am not even able to run the Hello-jni program provided within NDK samples. I have installed CYGWIN When i run: $ cd /cygdrive/c/android/android-ndk-r5b/samples/hello-jni $ ndk-build I get an ERROR: You are using a non-Cygwin compatible Make program. I tried installing GNUMake 3.81 but the problem persist. ** I tried to run HELLO-JNI sample program of NDK through Eclipse IDE There is force close on the Android AVD. & logcat was showing exception like below - 04-08 12:32:11.609: ERROR/AndroidRuntime(274): FATAL EXCEPTION: main 04-08 12:32:11.609: ERROR/AndroidRuntime(274): java.lang.ExceptionInInitializerError 04-08 12:32:11.609: ERROR/AndroidRuntime(274): at java.lang.Class.newInstanceImpl(Native Method) 04-08 12:32:11.609: ERROR/AndroidRuntime(274): at java.lang.Class.newInstance(Class.java:1429) 04-08 12:32:11.609: ERROR/AndroidRuntime(274): at android.app.Instrumentation.newActivity(Instrumentation.java:1021) 04-08 12:32:11.609: ERROR/AndroidRuntime(274): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java: 2577) 04-08 12:32:11.609: ERROR/AndroidRuntime(274): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java: 2679) 04-08 12:32:11.609: ERROR/AndroidRuntime(274): at android.app.ActivityThread.access$2300(ActivityThread.java:125) 04-08 12:32:11.609: ERROR/AndroidRuntime(274): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033) 04-08 12:32:11.609: ERROR/AndroidRuntime(274): at android.os.Handler.dispatchMessage(Handler.java:99) 04-08 12:32:11.609: ERROR/AndroidRuntime(274): at android.os.Looper.loop(Looper.java:123) 04-08 12:32:11.609: ERROR/AndroidRuntime(274): at android.app.ActivityThread.main(ActivityThread.java:4627) 04-08 12:32:11.609: ERROR/AndroidRuntime(274): at java.lang.reflect.Method.invokeNative(Native Method) 04-08 12:32:11.609: ERROR/AndroidRuntime(274): at java.lang.reflect.Method.invoke(Method.java:521) 04-08 12:32:11.609: ERROR/AndroidRuntime(274): at com.android.internal.os.ZygoteInit $MethodAndArgsCaller.run(ZygoteInit.java:868) 04-08 12:32:11.609: ERROR/AndroidRuntime(274): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 04-08 12:32:11.609: ERROR/AndroidRuntime(274): at dalvik.system.NativeStart.main(Native Method) 04-08 12:32:11.609: ERROR/AndroidRuntime(274): Caused by: java.lang.UnsatisfiedLinkError: Library hello-jni not found 04-08 12:32:11.609: ERROR/AndroidRuntime(274): at java.lang.Runtime.loadLibrary(Runtime.java:461) 04-08 12:32:11.609: ERROR/AndroidRuntime(274): at java.lang.System.loadLibrary(System.java:557) 04-08 12:32:11.609: ERROR/AndroidRuntime(274): at com.example.hellojni.HelloJni.(HelloJni.java:67) 04-08 12:32:11.609: ERROR/AndroidRuntime(274): ... 15 more 04-08 12:32:11.678: WARN/ActivityManager(59): Force finishing activity com.example.hellojni/.HelloJni 04-08 12:32:12.340: WARN/ActivityManager(59): Activity pause timeout for HistoryRecord{44f925c8 com.example.hellojni/.HelloJni} Thanks in advance. Atul Prakash Singh -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Best way to convert iPhone 3-D game code to run on Android devices?
Dear Friends, I need to convert our existing iPhone 3-D action game code to run on Android. Recently, I have developed 2-D game on Android platform and now I am moving towards 3-D. These days I am exploring the options to convert iPhone/iPad & Symbian code to run on Android devices. Should I write the entire code of iPhone 3-D game(previously written in Objective C using OpenGL ES) from scratch in Java using OpenGL apis, once again? I have also successfully installed and studied samples of Android NDK(specially San Angles sample code) as well. I am also looking for 3- D game using OpenGL example in Android as well. Is the use of Android NDK is recommended in order to convert iPhone code on Android platform or I should code in Java? I am looking forward for piece of suggestions from your side. Thanks in advance. Atul Prakash Singh -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Does Google support Google Check Out Merchant Account in India?
Currently Indian Developers can not sell their apps on Android Market. Rgds/Atul Prakash Singh On Jul 16, 1:51 am, Joy wrote: > Hello Everyone, > I am a developer from India. And, I wanna make some cool apps for > Android users and make money from it. I need to know, does Google > support Google Check Out Merchant Account for Indian Developers. I red > a book (from Apress Publications ) on Android, and the author claimed > that, Indian Developer can sell apps in Android Market. But, India is > not listed under the supported location for merchants. I am totally > confused about this. I think, Google had not updated their Android > Market Support database since few months (:P :P) !! Does anyone has > any latest information about this topic. Please let me know. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en