Something went wrong. Try again.
Java applet template for the Amazon Kindle (with JNI x Rust support)
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637package com.test.app;
import com.amazon.kindle.kindlet.KindletContext;import com.amazon.kindle.kindlet.ui.KTextArea;import com.cowlark.kindlet.KindletWrapper;
import com.test.jni.Example;
public class Main extends KindletWrapper { @Override public void onKindletStart() { KindletContext context = getContext(); KTextArea kta = new KTextArea("Hello, world!"); context.getRootContainer().add(kta);
Example exp = new Example();
// Return a simple string exp.PrintMessage("Hello from java!");
int id = exp.GetPokemonId("lopunny");
exp.PrintMessage("Got ".concat(Integer.toString(id)).concat(" from the api!")); }
@Override public void onKindletDestroy() { // Restart the CVM on exit // We need to do this because the JNI lib still exists after we exit, but we can // never load it back in // // There are some 'hacks' to load the library using our own System, but they // will crash the CVM if we edit the JNI in any way System.exit(0); }}