Git Product home page Git Product logo

ion-warpper-with-sqlite-cache's Introduction

this wrapper makes usage of ion library https://github.com/koush/ion simple and with less code , it supports also caching by sqlite using this wonderful repository https://github.com/teabow/android-json-data-cache

Usage :

1 - for ion library

in build.gradle add

compile 'com.koushikdutta.ion:ion:2.+'

2 - copy the following from our library folder to your project :

a - IonWrapper.java

b - sqlite package

c - copy raw to your res folder " it is used by sqlite package "

3 - change import statements to be suitable to your package name

4 - you will find

    this.progressBar = (ProgressBar) ((Activity) context).findViewById(R.id.progressBar);

in IonWrapper.java

this is because I show ProgressBar while loading

and my layout must contains

   <ProgressBar
    android:id="@+id/progressBar"
    android:layout_width="60dp"
    android:layout_height="60dp"
    android:layout_centerInParent="true"
    android:indeterminate="true"
    android:visibility="gone"/>

if you don't want this then simply remove progressBar variable and any usage of it in

IonWrapper.java

5 - in AndroidManifest.xml

add permissions

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />

////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////

I used https://github.com/teabow/android-json-data-cache

"Json data cache for Android using SQLite " repository

to cache json response

and I made some changes to it to support string response

6- see

https://github.com/omar-adel/ion-warpper-with-sqlite-cache/blob/master/sample%20-%20weather%20forecast%20app/WeatherForecast/app/src/main/java/com/freelanceapps33/weather/WeatherForecast.java

at sample project to see how integration with activity is done simply .

////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////

Sample :

there is sample weather forecast app

to show my usage

it displays weather in the current day and next 3 days

in ListView

if sample doesn't work with you it would because

key of weather api that I use is expired or has high traffic than

what supposed to be

so go here

and register for account

and get your key to use it

2368cebf3c52e4eeccd2f8ba9b297c1b37f1997c

and register for account

and get your key to use it

ion-warpper-with-sqlite-cache's People

Watchers

James Cloos 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.