Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- How to have persistent variable in android module?
- private static int counter = 0;
- @Kroll.method
- public int increment() {
- setIncrementProp(1);
- return counter;
- }
- @Kroll.setProperty
- public void setIncrementProp(int value) {
- counter = counter + value;
- }
- var module = require("com.modulewhatever");
- var testToast = Titanium.UI.createNotification({ message :module.increment().toString() });
- var button = Titanium.UI.createButton({ title : "Test" });
- button.addEventListener("click", function(e) { testToast.show(); });
- SharedPreferences p = PreferenceManager.getDefaultSharedPreferences(context);
- p.edit().putString("username", username).commit();
- p.edit().putString("password", password).commit(); //SECURITY HAZARD: read below...
- String username = p.getString("username", "");
- String password = p.getString("password", "");
Add Comment
Please, Sign In to add comment