Giter Club home page Giter Club logo

architecture's Introduction

Android Architecture examples

legacy/ Examples are no longer updated and likely deprecated.

ViewModel Examples:

viewModelDemo (java) is an example of how to use the viewModel class. Also shows viewModel can survive a rotation.

viewModelDemo_kt (kotlin) is an example of how to use the viewModel class. Also shows viewModel can survive a rotation.

AndroidviewModelDemo (java) is an example of how to use the AndroidviewModel class, which is just a viewModel that can get context.

AndroidviewModelDemo_kt (kotlin) is an example of how to use the AndroidviewModel class, which is just a viewModel that can get context.

liveDataDemo (java) is a simple demo of how to wrap LiveData classes with a the viewModel object to display data as it changes.

liveDataDemo_kt (kotlin) is a simple demo of how to wrap LiveData classes with a the viewModel object to display data as it changes.


Room Examples:

roomDemo (java) is an example of use the new room objects to create and access a database.

roomDemo_kt (kotlin) is an example of use the new room objects to create and access a database.

LiveDataRoomDemo (java) shows how to use the liveData object with the database to have the display updated when new data is added.

LiveDataRoomDemo_kt (kotlin) shows how to use the liveData object with the database to have the display updated when new data is added.

LiveDataRoomRecyclerDemo (java) shows a room database with livedata/viewModel that auto updates a recyclerview (using an observer in the adapter) as the data changes.

LiveDataRoomRecyclerDemo_kt (kotlin) shows a room database with livedata/viewModel that auto updates a recyclerview (using an observer in the adapter) as the data changes.

ContentProviderRoomDemo shows how to create a contentprovider around a room database. It's based on sqliteDemo in saveData Repo

RxJavaRoomDemo is an example of using the Flow in RxJava and room to display data as it changes. Similar to LiveData.


Other Architecture examples:

retrofit2Demo is a very simple example using the retrofit2 ReST API and JSON, instead of httpURLconnection.

Retrofit2LiveDataDemo is a basic attempt at Google's user example (on their web pages) using retrofit2 and LiveData. This example is still pretty rough, but it does work. It uses a private ReST server. the php backend will be added later on. This doesn't use JSON, instead the ReST is a basic CSV.

FcmRetrrofit2LiveDemo is a complex example using many of the examples above that uses a local room database to hold the cache data and receive push updates when the data on the rest service is update. It uses firebase messaging as well.

WorkManagerDemo is an example of using the Architecture Worker Tasks. This example is in located in https://github.com/JimSeker/service repo.


These may also be helpful links https://medium.com/google-developers/viewmodels-a-simple-example-ed5ac416317e
https://developer.android.com/topic/libraries/architecture/index.html
https://medium.com/@taman.neupane/basic-example-of-livedata-and-viewmodel-14d5af922d0
https://medium.com/google-developers/lifecycle-aware-data-loading-with-android-architecture-components-f95484159de4
https://medium.com/@iammert/offline-app-with-rxjava-2-and-room-ccd0b5c18101 good example, uses older library.
https://developer.android.com/reference/android/arch/lifecycle/LiveDataReactiveStreams.html
https://android.jlelse.eu/android-reactive-architecture-part-1-introduction-60466bc88774 (kotlin)
https://developer.android.com/topic/libraries/architecture/guide.html (able halfway down the page), doesn't work ,but some explanations.
https://github.com/googlesamples/android-architecture-components/tree/master/BasicRxJavaSample is Google's example for it, poorly documented and almost no comments.


These are example code for University of Wyoming, Cosc 4730 Mobile Programming course. All examples are for Android.

architecture's People

Contributors

jimseker avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

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.