On Tue, Jul 19, 2011 at 5:27 PM, s.rawat <[email protected]> wrote: > HI > I am developing a simple c application and interfacing it with the android > application using the jni calls.The c application is basically an IO related > operation on sqlite db.I wanted to know the way to handle the errors > -exception at the c level.Shall i pass the error codes to the > application(android) level or shall i do it on the c level only.I am > thinking to pass the error codes to the android application and decode it > (creating a simlliar enums at the android application level same as at the c > level in the errorcodes.h) and then pop up the alert dialog box to the > user.Plz suggets a better design pattern for this.
As usual, it depends. If the Java side only needs to know if an error occurred or not, you return boolean and log there error in C. If you need more fine-grained control, return int and check the error code in Java to determine what you need to do next. It's a bit more work, but you can also throw exceptions from your native code and catch those in Java. On another note, why do you need native code to access SQLite? Android has Java APIs for this. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

