11# CachePot - Android Simple Data Cache
22
3- A basic sample which shows how to transfer object of model between fragments simply without Pacelable and Serializable.
3+ CachePot is a simple open source for data cache management and passing data object between Fragments without Pacelable and Serializable.
4+
5+ > WARNING: It would be inappropriate to pass data both ways between different android applications, it's a better way to use ` Intent ` properly.
46
57# Download
6- ``` java
8+
9+ Gradle:
10+
11+ ``` bash
712repositories {
813 jcenter ()
914}
@@ -13,19 +18,31 @@ dependencies {
1318}
1419```
1520
21+ Maven:
22+
23+ ``` bash
24+ < dependency>
25+ < groupId> com.github.kimkevin< /groupId>
26+ < artifactId> cachepot< /artifactId>
27+ < version> 1.0.0< /version>
28+ < /dependency>
29+ ```
30+
1631# Usage
1732
18- It works anywhere as below
19- * Between Activizty and Activity
20- * Between Activity and Fragment
21- * Between Fragment and Fragment
33+ It works anywhere. there're examples as below
34+ * Between ` Activizty ` and ` Activity `
35+ * Between ` Activity ` and ` Fragment `
36+ * Between ` Fragment ` and ` Fragment `
37+ * From ` PagerAdapter ` to individual ` Fragment `
2238
23- #### 1. Transfer Object(Model) Synchronously
39+ #### 1. Pass Object(Model) Synchronously
2440
2541First push your data object to ` CachePot ` instance in your ` Activity ` or ` Fragment ` .
2642
2743``` java
28- KoreanFood foodItem = new KoreanFood (1 , " Kimchi" , " Traditional fermented Korean side dish made of vegetables" ) // Sample Model
44+ // Sample data model
45+ KoreanFood foodItem = new KoreanFood (1 , " Kimchi" , " Traditional fermented Korean side dish made of vegetables" )
2946
3047CachePot . getInstance(). push(foodItem);
3148// open your activity or fragment
@@ -45,7 +62,7 @@ public class MainFragment extends Fragment{
4562 }
4663```
4764
48- #### 2. Transfer Collection or Map Synchronously
65+ #### 2. Pass Collection or Map Synchronously
4966
5067First push your collection to `CachePot ` instance in your `Activity ` or `Fragment `.
5168
@@ -64,7 +81,7 @@ Get your collection in your `Activity` or `Fragment`
6481List<KoreanFood > foodItems = CachePot.getInstance ().pop (ArrayList .class );
6582```
6683
67- #### 3. Transfer Object (Model ) Asynchronously when using ViewPager
84+ #### 3. Pass Object (Model ) Asynchronously when using ViewPager
6885
6986First push your data object with position to `CachePot` instance in `FragmentStatePagerAdapter`(or `FragmentPagerAdapter`)
7087
0 commit comments