Save To Activity


Source link: https://github.com/Metroxe/Save-to-Activity

Save To Activity (Deprecated)

This library is an easy to use series of commands to interact with a hashmap across multiple fragments attached to any running activity. This also allows users to pass information between fragments, without a transaction or bundle.

Please Note this solution for a data structure is very inefficient compared to using bundles, but this library allows users with an over whelming amounts of fragments to manage semi-global variables easily, rather than writing bundle logic for often overly complicated fragment transactions

Implementation

In the activity you wish to store your variables in, please incorporate this line and these classes...

Start the HashMap

SaveToActivity saveToActivity = new SaveToActivity();
 HashMap<String, String> hashMap = saveToActivity.startHashMap();

saveInformation()

public void saveInformation(HashMap<String, String> newHashMap) {

  hashMap = newHashMap; 
}

loadInformation()

public HashMap<String, String> loadInformation() {

  return hashMap; 
}

Integrate with Gradle

Add this in your root build.gradle

 allprojects {

repositories {

 ...
 maven {
 url "https://jitpack.io" 
}

}
  
}

Add the Dependency

Call from Activity

 dependencies {

 compile 'com.github.Metroxe:Save-to-Activity:v1.0'  
}

Methods

For the methods its necessary to send in the activity. If the class is being called from the activity, then simply send in...

ActivityName.this

but, if being called from a fragment use

getActivity()

all methods assume the class has already called this line

SaveToActivity saveToActivity = new SaveToActivity();

Put Methods

putSingleString

Puts a single string into the activity.

saveToActivity.putSingleString(Activity, Key, String)

putStrings

Puts a String[] of strings into the activity. The strings will be added individually, so using putSingleString will work for any of these values. This class will not work unless there are an equal amount of keys and strings. Keys and strings will be paired accoridng to their index in the array (e.g. the key at index 3, will be paired with the string at index 3).

saveToActivity.getStrings(Activity, Keys, Strings)

Get Methods

If the Keys don't exist when getting called, nothing will be returned.

getSingleString

Gets a String[] from the activity. Strings are returned in the same index of the keys that were sent in.

saveToActivity.getSingleHashString(Activity, Key)  Returns String

getStrings

Gets a String[] from the activity. Strings are returned in the same index of the keys that were sent in.

saveToActivity.getStrings(Activity, Keys)  Returns String[]

Resources

Simple lifecycle for your MVWhatever on Android. No kidding.

A simple Bash script to record screen.

This library provides a wave loading animation as a Drawable.

A quick settings tile to quickly toggle "Don't keep activities".

The library provides a custom TextView and Helper for Android to convert timestamp to time String. The library also provides a singleton thread that automatically updates the TextView.

Zaman also provides a helper that returns the relative time according to the timestamp sent.

Inspection the Android HTTP(S) traffic in Chrome Developer Tools.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes