Time for action – raising & catching exceptions in native Store
- Create the Java exception
com.packtpub.exception.InvalidTypeException
of typeException
as follows:package com.packtpub.exception; public class InvalidTypeException extends Exception { public InvalidTypeException(String pDetailMessage) { super(pDetailMessage); } }
Repeat the operation for two other exceptions:
NotExistingKeyException
of typeException
andStoreFullException
of typeRuntimeException
. - Open
Store.java
and declare thrown exceptions ongetInteger()
in classStore
(StoreFullException
isRuntimeException
and does not need declaration):public class Store { ... public native int getInteger(String pKey) throws NotExistingKeyException, InvalidTypeException; public native void ...
Get Android NDK Beginner's Guide - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.