Code Monkey home page Code Monkey logo

storage's Introduction

Storage

android 本地化存储

allprojects {
		repositories {
			...
			maven { url 'https://jitpack.io' }
		}
	}

dependencies {
	        implementation 'com.github.PMMKing:Storage:1.1.0'
	}
public class MainApplication extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
        Store.init(this,"testFile");
    }
}
        Store.put("zhangsan", new TestBean());
        Store.put("string", "string");
        Store.put("int", 100);
        Store.put("long", 100L);
        Store.put("byte", (byte) 100);
        Store.put("short", (short) 100);
        Store.put("float", (float) 100);
        Store.put("boolean", true);
        ArrayList<TestBean> list = new ArrayList<>();
        list.add(new TestBean());
        list.add(new TestBean());
        list.add(new TestBean());
        Store.put("listsss", list);

        ArrayList<TestBean> listsss = Store.get("listsss", ArrayList.class, null);
        TestBean testBean = listsss.get(1);


        String s = Store.get("zhangsan", TestBean.class, null).toString() + "\n" +
                Store.get("string", "") + "\n"
                + Store.get("int", 0) + "\n" +
                Store.get("long", 0L) + "\n" +
                Store.get("byte", (byte) 0) + "\n"
                + Store.get("short", (short) 0) + "\n" +
                Store.get("float", (float) 0) + "\n" +
                Store.get("boolean", true) + "\n"
                + "\n" + testBean.toString();

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.