- Update to Android 1.5 SDK

- Fix RouterContext problem
This commit is contained in:
zzz
2009-07-03 22:13:18 +00:00
parent 7972c0c862
commit 2e5caac8bf
5 changed files with 290 additions and 240 deletions

View File

@ -10,10 +10,10 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.IOException;
import java.util.List;
import net.i2p.router.Router;
import net.i2p.router.RouterLaunch;
import net.i2p.router.web.ContextHelper;
// import net.i2p.util.NativeBigInteger;
public class I2PAndroid extends Activity
@ -66,8 +66,15 @@ public class I2PAndroid extends Activity
{
System.err.println("onStop called");
super.onStop();
// from routerconsole ContextHelper
List contexts = RouterContext.listContexts();
if ( (contexts == null) || (contexts.size() <= 0) )
throw new IllegalStateException("No contexts. This is usually because the router is either starting up or shutting down.");
RouterContext ctx = (RouterContext)contexts.get(0);
// shutdown() doesn't return so use shutdownGracefully()
ContextHelper.getContext(null).router().shutdownGracefully(Router.EXIT_HARD);
ctx.router().shutdownGracefully(Router.EXIT_HARD);
System.err.println("shutdown complete");
}