Android library for displaying data based on JSON configuration fetched from server. With this library, you can kiss goodbye to string.xml, dimen.xml, arrays.xml. Keep all your string/integer/array config in one file. The library will automatically fetch the data from the url you provide.
Android library for displaying data based on JSON configuration fetched from server.
With this library, you can kiss goodbye to string.xml, dimen.xml, arrays.xml. Keep all your string/integer/array config in one file. The library will automatically fetch the data from the url you provide.
Gradle Dependecy
dependencies {
implementation 'com.an.optimize:optimize:0.1.0'
}
Maven Dependecy
<dependency>
<groupId>com.an.optimize</groupId>
<artifactId>optimize</artifactId>
<version>0.1.0</version>
<type>pom</type>
</dependency>
<uses-permission android:name="android.permission.INTERNET" ></uses-permission>
Step 2: Add the following code to your Application class or your Main Activity file
Optimize.getInstance().init(getApplicationContext(), "<Add the url of the json file>");
Step 3: All you have to do now to display a value from the json file is to call the below code
String stringData = Optimize.getInstance().getStringValue("<the name of the param key>", "<Default value to be displayed in case the backend data does not contain this key>");
//The same can be applied for Integers:
Optimize.getInstance().getIntegerValue("<the name of the param key>", <Default value in case the backend data does not contain this key>);
//The same can be applied for Double:
Double doubleData = Optimize.getInstance().getDoubleValue("<the name of the param key>", 0.00);
//The same can be applied for Boolean:
Boolean booleanData = Optimize.getInstance().getBooleanValue("boolean_data", false);
//The same can be applied for Number:
Number floatData = Optimize.getInstance().getNumberValue("float_data", -1.1);
//The same can be applied for a List:
List<String> listData = Optimize.getInstance().getList("list_data", Collections.emptyList());
And that’s it! It’s super simple.