Skip to main content

Retrieve data from database and show to PieChart


activity_main.xml


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    
xmlns:app="http://schemas.android.com/apk/res-auto"    
xmlns:tools="http://schemas.android.com/tools"    
android:layout_width="match_parent"    
android:layout_height="match_parent"    
tools:context="np.com.sitalmandal.shopchart.MainActivity">


    <com.github.mikephil.charting.charts.PieChart        
    android:id="@+id/piechart"        
     android:layout_width="match_parent"        
    android:layout_height="match_parent" />


</LinearLayout>



MainActivity.java


package np.com.sitalmandal.shopchart;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;

import com.github.mikephil.charting.charts.PieChart;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.data.PieData;
import com.github.mikephil.charting.data.PieDataSet;
import com.github.mikephil.charting.utils.ColorTemplate;

import java.util.ArrayList;
import java.util.List;

import np.com.sitalmandal.shopchart.Order.Order;
import retrofit.Call;
import retrofit.Callback;
import retrofit.GsonConverterFactory;
import retrofit.Response;
import retrofit.Retrofit;



public class MainActivity extends Activity {
   static String url = "https://battery-75d95.firebaseio.com/";
   
    PieChart pieChart;
    public static  List<Order>  salArry;
    public static  List<Order>  hosArry;
    public static List<Order> ProductData;

    @Override    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        pieChart =(PieChart) findViewById(R.id.piechart);

        ProductData = new ArrayList<>();
        hosArry = new ArrayList();
        salArry = new ArrayList();


       getOrderArray();
        pieChart.notifyDataSetChanged();


    }

    //arrayOrder    void getOrderArray() {

        Retrofit retrofit = new Retrofit.Builder()
                .baseUrl(url)
                .addConverterFactory(GsonConverterFactory.create())
                .build();

        RetrofitArrayAPI service = retrofit.create(RetrofitArrayAPI.class);

        Call<List<Order>> call = service.getOrderDetails();

        call.enqueue(new Callback<List<Order>>() {
            @Override            public void onResponse(Response<List<Order>> response, Retrofit retrofit) {

                try {

                 // ProductData = response.body();
                    ProductData = response.body();
                    for (int i = 0; i < ProductData.size(); i++) {

                        //displaying the string array into gridView
                        Order b = new Order();
                        b.setId(ProductData.get(i).getId());
                        b.setStatus(ProductData.get(i).getStatus());
                        hosArry.add(b);
                    }

                 //   Log.v("hosarry", String.valueOf(hosArry.size()));                    for (int i =0; i<hosArry.size(); i++){

                        if(hosArry.get(i).getStatus().contains("completed"))
                        {
                            Order b = new Order();
                            b.setId(hosArry.get(i).getId());
                            b.setStatus(hosArry.get(i).getStatus());
                            salArry.add(b);
                        }

                    }
                    Log.v("hosarry", String.valueOf(salArry.size()));



                    ArrayList yVals = new ArrayList();
                    for (int i = 0; i < salArry.size(); i++) {
                        Order x = salArry.get(i);
                        int a22 = x.getId();
                        yVals.add(new Entry(a22, 0));
                    }


                    ArrayList<String> xVals = new ArrayList<String>();
                    for (int i = 0; i < salArry.size(); i++) {
                        Order x = salArry.get(i);
                        String a22 = x.getStatus();
                        xVals.add(a22);
                    }

                    PieDataSet dataSet = new PieDataSet(yVals, "Number Of Employees");
                    dataSet.setValueTextSize(15f);
                    dataSet.notifyDataSetChanged();
                    PieData data = new PieData(xVals, dataSet);
                    data.notifyDataChanged();
                    pieChart.setData(data);
                    dataSet.setColors(ColorTemplate.COLORFUL_COLORS);
                    pieChart.animateXY(5000, 5000);
                    pieChart.notifyDataSetChanged();

                } catch (Exception e) {
                    Log.d("onResponse", "There is an error");
                    e.printStackTrace();
                }

            }

            @Override            public void onFailure(Throwable t) {
                Log.d("onFailure", t.toString());
            }
        });
    }


    @Override    public String toString() {
        return "SalesByProductPieFragment";
    }
}




RetrofitArrayAPI.java


public interface RetrofitArrayAPI {

    /*     * Retrofit get annotation with our URL     * And our method that will return us details of student.    */
    @GET(".json")
    Call<List<Order>> getOrderDetails();

}




gladefile:

compile 'com.android.support:appcompat-v7:26.+'compile 'com.android.support:support-v4:26.+'compile 'com.android.support:design:26.+'compile 'com.squareup.retrofit:retrofit:2.0.0-beta2'compile 'com.google.code.gson:gson:1.7.2'compile 'com.squareup.retrofit:converter-gson:2.0.0-beta2'compile 'com.squareup.okhttp:okhttp:2.4.0'compile 'com.android.support:multidex:1.0.1'compile 'com.github.lecho:hellocharts-library:1.5.8@aar'compile files('libs/mpandroidchartlibrary-2-2-4.jar')




Json:


[
    {
        "_links": {
            "collection": [
                {
                    "href": "https://shop.btownmedia.com/wp-json/wc/v2/orders"
                }
            ],
            "customer": [
                {
                    "href": "https://shop.btownmedia.com/wp-json/wc/v2/customers/1"
                }
            ],
            "self": [
                {
                    "href": "https://shop.btownmedia.com/wp-json/wc/v2/orders/758"
                }
            ]
        },
        "billing": {
            "address_1": "I had work with Different RestFull WebService develop by PHP, .Net . And MicroService develop by Java. So, I want To work in iOS Developer using Xcode with Swift Language in your company.",
            "address_2": "",
            "city": "Bangalore",
            "company": "gkk",
            "country": "NP",
            "email": "sitalmandal.info@gmail.com",
            "first_name": "sital prasad mandal",
            "last_name": "gfgh",
            "phone": "8317324484",
            "postcode": "560048",
            "state": "MEC"
        },
        "cart_hash": "772fc8bf1ffc9dfc64a5dea6eb183053",
        "cart_tax": "0.00",
        "created_via": "checkout",
        "currency": "NPR",
        "customer_id": 1,
        "customer_ip_address": "113.199.251.228",
        "customer_note": "",
        "customer_user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36",
        "date_created": "2019-01-30T08:36:32",
        "date_created_gmt": "2019-01-30T02:51:32",
        "date_modified": "2019-01-30T08:36:32",
        "date_modified_gmt": "2019-01-30T02:51:32",
        "discount_tax": "0.00",
        "discount_total": "0.00",
        "id": 758,
        "line_items": [
            {
                "id": 4,
                "name": "Marathon T-shirts",
                "price": 30,
                "product_id": 172,
                "quantity": 1,
                "sku": "",
                "subtotal": "30.00",
                "subtotal_tax": "0.00",
                "tax_class": "",
                "total": "30.00",
                "total_tax": "0.00",
                "variation_id": 0
            }
        ],
        "meta_data": [
            {
                "id": 8637,
                "key": "_wcfmmp_order_processed",
                "value": "yes"
            },
            {
                "id": 8642,
                "key": "_wcfm_new_order_notified",
                "value": "yes"
            }
        ],
        "number": "758",
        "order_key": "wc_order_5c51113482f46",
        "parent_id": 0,
        "payment_method": "cod",
        "payment_method_title": "Cash on delivery",
        "prices_include_tax": false,
        "shipping": {
            "address_1": "I had work with Different RestFull WebService develop by PHP, .Net . And MicroService develop by Java. So, I want To work in iOS Developer using Xcode with Swift Language in your company.",
            "address_2": "",
            "city": "Bangalore",
            "company": "gkk",
            "country": "NP",
            "first_name": "sital prasad mandal",
            "last_name": "gfgh",
            "postcode": "560048",
            "state": "MEC"
        },
        "shipping_lines": [
            {
                "id": 5,
                "instance_id": "1",
                "meta_data": [
                    {
                        "id": 42,
                        "key": "Items",
                        "value": "Marathon T-shirts &times; 1"
                    },
                    {
                        "id": 43,
                        "key": "vendor_id",
                        "value": "0"
                    },
                    {
                        "id": 44,
                        "key": "package_qty",
                        "value": "1"
                    },
                    {
                        "id": 45,
                        "key": "method_slug",
                        "value": "free_shipping"
                    },
                    {
                        "id": 46,
                        "key": "processing_time",
                        "value": "-"
                    }
                ],
                "method_id": "free_shipping",
                "method_title": "Free shipping",
                "total": "0.00",
                "total_tax": "0.00"
            }
        ],
        "shipping_tax": "0.00",
        "shipping_total": "0.00",
        "status": "processing",
        "total": "30.00",
        "total_tax": "0.00",
        "transaction_id": "",
        "version": "3.5.1"
    },
    {
        "_links": {
            "collection": [
                {
                    "href": "https://shop.btownmedia.com/wp-json/wc/v2/orders"
                }
            ],
            "self": [
                {
                    "href": "https://shop.btownmedia.com/wp-json/wc/v2/orders/756"
                }
            ]
        },
        "billing": {
            "address_1": "#4, SEA EDUCATIONAL TRUST RD.",
            "address_2": "LOURDU NAGAR, SWATHANTRA NAGAR, KR PURAM",
            "city": "BANGALORE",
            "company": "sdfasdf",
            "country": "NP",
            "email": "sitalmandal.info@gmail.com",
            "first_name": "SHREE",
            "last_name": "MANDAL",
            "phone": "8317324484",
            "postcode": "560049",
            "state": "MEC"
        },
        "cart_hash": "edb49451533e95cfbb7dde9e9bb9f4ee",
        "cart_tax": "0.00",
        "created_via": "checkout",
        "currency": "NPR",
        "customer_id": 0,
        "customer_ip_address": "113.199.248.36",
        "customer_note": "",
        "customer_user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36",
        "date_created": "2019-01-22T18:12:48",
        "date_created_gmt": "2019-01-22T12:27:48",
        "date_modified": "2019-01-22T18:12:49",
        "date_modified_gmt": "2019-01-22T12:27:49",
        "discount_tax": "0.00",
        "discount_total": "0.00",
        "id": 756,
        "line_items": [
            {
                "id": 3,
                "name": "Casual Chic Dress",
                "price": 60,
                "product_id": 182,
                "quantity": 1,
                "sku": "",
                "subtotal": "60.00",
                "subtotal_tax": "0.00",
                "tax_class": "",
                "total": "60.00",
                "total_tax": "0.00",
                "variation_id": 0
            }
        ],
        "meta_data": [
            {
                "id": 8584,
                "key": "_wcfmmp_order_processed",
                "value": "yes"
            },
            {
                "id": 8589,
                "key": "_wcfm_new_order_notified",
                "value": "yes"
            }
        ],
        "number": "756",
        "order_key": "wc_order_5c470c44a3e12",
        "parent_id": 0,
        "payment_method": "cod",
        "payment_method_title": "Cash on delivery",
        "prices_include_tax": false,
        "shipping": {
            "address_1": "",
            "address_2": "",
            "city": "",
            "company": "",
            "country": "",
            "first_name": "",
            "last_name": "",
            "postcode": "",
            "state": ""
        },
        "shipping_tax": "0.00",
        "shipping_total": "0.00",
        "status": "processing",
        "total": "60.00",
        "total_tax": "0.00",
        "transaction_id": "",
        "version": "3.5.1"
    },
    {
        "_links": {
            "collection": [
                {
                    "href": "https://shop.btownmedia.com/wp-json/wc/v2/orders"
                }
            ],
            "customer": [
                {
                    "href": "https://shop.btownmedia.com/wp-json/wc/v2/customers/1"
                }
            ],
            "self": [
                {
                    "href": "https://shop.btownmedia.com/wp-json/wc/v2/orders/755"
                }
            ]
        },
        "billing": {
            "address_1": "I had work with Different RestFull WebService develop by PHP, .Net . And MicroService develop by Java. So, I want To work in iOS Developer using Xcode with Swift Language in your company.",
            "address_2": "",
            "city": "Bangalore",
            "company": "gkk",
            "country": "NP",
            "email": "sitalmandal.info@gmail.com",
            "first_name": "sital prasad mandal",
            "last_name": "gfgh",
            "phone": "8317324484",
            "postcode": "560048",
            "state": "MEC"
        },
        "cart_hash": "fb467ff7de4de21ba4a2c74e42615944",
        "cart_tax": "0.00",
        "created_via": "checkout",
        "currency": "NPR",
        "customer_id": 1,
        "customer_ip_address": "113.199.249.52",
        "customer_note": "",
        "customer_user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36",
        "date_completed": "2019-01-23T13:31:26",
        "date_completed_gmt": "2019-01-23T07:46:26",
        "date_created": "2019-01-21T08:18:35",
        "date_created_gmt": "2019-01-21T02:33:35",
        "date_modified": "2019-01-23T13:31:26",
        "date_modified_gmt": "2019-01-23T07:46:26",
        "discount_tax": "0.00",
        "discount_total": "0.00",
        "id": 755,
        "line_items": [
            {
                "id": 2,
                "name": "Shoe For Men",
                "price": 50,
                "product_id": 175,
                "quantity": 1,
                "sku": "",
                "subtotal": "50.00",
                "subtotal_tax": "0.00",
                "tax_class": "",
                "total": "50.00",
                "total_tax": "0.00",
                "variation_id": 0
            }
        ],
        "meta_data": [
            {
                "id": 8533,
                "key": "_wcfmmp_order_processed",
                "value": "yes"
            },
            {
                "id": 8538,
                "key": "_wcfm_new_order_notified",
                "value": "yes"
            }
        ],
        "number": "755",
        "order_key": "wc_order_5c452f7fef6c0",
        "parent_id": 0,
        "payment_method": "cod",
        "payment_method_title": "Cash on delivery",
        "prices_include_tax": false,
        "shipping": {
            "address_1": "",
            "address_2": "",
            "city": "",
            "company": "",
            "country": "",
            "first_name": "",
            "last_name": "",
            "postcode": "",
            "state": ""
        },
        "shipping_tax": "0.00",
        "shipping_total": "0.00",
        "status": "completed",
        "total": "50.00",
        "total_tax": "0.00",
        "transaction_id": "",
        "version": "3.5.1"
    },
    {
        "_links": {
            "collection": [
                {
                    "href": "https://shop.btownmedia.com/wp-json/wc/v2/orders"
                }
            ],
            "self": [
                {
                    "href": "https://shop.btownmedia.com/wp-json/wc/v2/orders/752"
                }
            ]
        },
        "billing": {
            "address_1": "I had work with Different RestFull WebService develop by PHP, .Net . And MicroService develop by Java. So, I want To work in iOS Developer using Xcode with Swift Language in your company.",
            "address_2": "",
            "city": "Bangalore",
            "company": "",
            "country": "NP",
            "email": "sitalmandal.info@gmail.com",
            "first_name": "sital prasad mandal",
            "last_name": "dsdfsdf",
            "phone": "8317324484",
            "postcode": "560048",
            "state": "MEC"
        },
        "cart_hash": "fb467ff7de4de21ba4a2c74e42615944",
        "cart_tax": "0.00",
        "created_via": "checkout",
        "currency": "NPR",
        "customer_id": 0,
        "customer_ip_address": "113.199.248.14",
        "customer_note": "",
        "customer_user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36",
        "date_completed": "2019-01-15T06:51:42",
        "date_completed_gmt": "2019-01-15T01:06:42",
        "date_created": "2019-01-14T07:25:10",
        "date_created_gmt": "2019-01-14T01:40:10",
        "date_modified": "2019-01-15T06:51:42",
        "date_modified_gmt": "2019-01-15T01:06:42",
        "discount_tax": "0.00",
        "discount_total": "0.00",
        "id": 752,
        "line_items": [
            {
                "id": 1,
                "name": "Shoe For Men",
                "price": 50,
                "product_id": 175,
                "quantity": 1,
                "sku": "",
                "subtotal": "50.00",
                "subtotal_tax": "0.00",
                "tax_class": "",
                "total": "50.00",
                "total_tax": "0.00",
                "variation_id": 0
            }
        ],
        "meta_data": [
            {
                "id": 8438,
                "key": "_wcfmmp_order_processed",
                "value": "yes"
            },
            {
                "id": 8443,
                "key": "_wcfm_new_order_notified",
                "value": "yes"
            }
        ],
        "number": "752",
        "order_key": "wc_order_5c3be87a483be",
        "parent_id": 0,
        "payment_method": "cod",
        "payment_method_title": "Cash on delivery",
        "prices_include_tax": false,
        "shipping": {
            "address_1": "",
            "address_2": "",
            "city": "",
            "company": "",
            "country": "",
            "first_name": "",
            "last_name": "",
            "postcode": "",
            "state": ""
        },
        "shipping_tax": "0.00",
        "shipping_total": "0.00",
        "status": "completed",
        "total": "50.00",
        "total_tax": "0.00",
        "transaction_id": "",
        "version": "3.5.1"
    },
    {
        "_links": {
            "collection": [
                {
                    "href": "https://shop.btownmedia.com/wp-json/wc/v2/orders"
                }
            ],
            "self": [
                {
                    "href": "https://shop.btownmedia.com/wp-json/wc/v2/orders/736"
                }
            ]
        },
        "billing": {
            "address_1": "text",
            "address_2": "text",
            "city": "terxt",
            "company": "text",
            "country": "IN",
            "email": "text@gmail.com",
            "first_name": "namita",
            "last_name": "terxt",
            "phone": "0123",
            "postcode": "201301",
            "state": "UP"
        },
        "cart_hash": "264106cc8fab5b089b6ad79422d940a2",
        "cart_tax": "0.00",
        "created_via": "checkout",
        "currency": "USD",
        "customer_id": 0,
        "customer_ip_address": "103.83.127.90",
        "customer_note": "",
        "customer_user_agent": "mozilla/5.0 (windows nt 6.1; win64; x64) applewebkit/537.36 (khtml, like gecko) chrome/68.0.3423.2 safari/537.36",
        "date_created": "2018-05-13T08:24:36",
        "date_created_gmt": "2018-05-13T02:39:36",
        "date_modified": "2018-05-13T08:24:36",
        "date_modified_gmt": "2018-05-13T02:39:36",
        "discount_tax": "0.00",
        "discount_total": "0.00",
        "id": 736,
        "number": "736",
        "order_key": "wc_order_5af7a5681bacb",
        "parent_id": 0,
        "payment_method": "paypal",
        "payment_method_title": "PayPal",
        "prices_include_tax": false,
        "shipping": {
            "address_1": "",
            "address_2": "",
            "city": "",
            "company": "",
            "country": "",
            "first_name": "",
            "last_name": "",
            "postcode": "",
            "state": ""
        },
        "shipping_tax": "0.00",
        "shipping_total": "0.00",
        "status": "pending",
        "total": "1000.00",
        "total_tax": "0.00",
        "transaction_id": "",
        "version": "3.3.5"
    },
    {
        "_links": {
            "collection": [
                {
                    "href": "https://shop.btownmedia.com/wp-json/wc/v2/orders"
                }
            ],
            "self": [
                {
                    "href": "https://shop.btownmedia.com/wp-json/wc/v2/orders/726"
                }
            ]
        },
        "billing": {
            "address_1": "A",
            "address_2": "1",
            "city": "W",
            "company": "",
            "country": "GM",
            "email": "1@2.33",
            "first_name": "A",
            "last_name": "A",
            "phone": "999 111",
            "postcode": "12345",
            "state": "QWE"
        },
        "cart_hash": "04baa20a66cb264a1016aa789a037d93",
        "cart_tax": "0.00",
        "created_via": "checkout",
        "currency": "USD",
        "customer_id": 0,
        "customer_ip_address": "155.56.68.218",
        "customer_note": "",
        "customer_user_agent": "mozilla/5.0 (windows nt 10.0; win64; x64; rv:59.0) gecko/20100101 firefox/59.0",
        "date_created": "2018-05-10T12:31:03",
        "date_created_gmt": "2018-05-10T06:46:03",
        "date_modified": "2018-05-10T12:31:03",
        "date_modified_gmt": "2018-05-10T06:46:03",
        "discount_tax": "0.00",
        "discount_total": "0.00",
        "id": 726,
        "number": "726",
        "order_key": "wc_order_5af3eaab77d31",
        "parent_id": 0,
        "payment_method": "paypal",
        "payment_method_title": "PayPal",
        "prices_include_tax": false,
        "shipping": {
            "address_1": "",
            "address_2": "",
            "city": "",
            "company": "",
            "country": "",
            "first_name": "",
            "last_name": "",
            "postcode": "",
            "state": ""
        },
        "shipping_tax": "0.00",
        "shipping_total": "0.00",
        "status": "cancelled",
        "total": "565.00",
        "total_tax": "0.00",
        "transaction_id": "",
        "version": "3.3.5"
    },
    {
        "_links": {
            "collection": [
                {
                    "href": "https://shop.btownmedia.com/wp-json/wc/v2/orders"
                }
            ],
            "self": [
                {
                    "href": "https://shop.btownmedia.com/wp-json/wc/v2/orders/735"
                }
            ]
        },
        "billing": {
            "address_1": "asdf",
            "address_2": "asdf",
            "city": "asdf",
            "company": "asdf",
            "country": "NP",
            "email": "exe@gmail.com",
            "first_name": "asdf",
            "last_name": "asdf",
            "phone": "1234567890",
            "postcode": "15000",
            "state": "BAG"
        },
        "cart_hash": "a56f4e0fa9ba5b242e3bec63df5d2b34",
        "cart_tax": "0.00",
        "created_via": "checkout",
        "currency": "USD",
        "customer_id": 0,
        "customer_ip_address": "45.64.160.175",
        "customer_note": "",
        "customer_user_agent": "mozilla/5.0 (windows nt 6.3; win64; x64) applewebkit/537.36 (khtml, like gecko) chrome/66.0.3359.139 safari/537.36",
        "date_created": "2018-05-09T22:59:03",
        "date_created_gmt": "2018-05-09T17:14:03",
        "date_modified": "2018-05-09T22:59:03",
        "date_modified_gmt": "2018-05-09T17:14:03",
        "discount_tax": "0.00",
        "discount_total": "0.00",
        "id": 735,
        "number": "735",
        "order_key": "wc_order_5af32c5b59827",
        "parent_id": 0,
        "payment_method": "paypal",
        "payment_method_title": "PayPal",
        "prices_include_tax": false,
        "shipping": {
            "address_1": "",
            "address_2": "",
            "city": "",
            "company": "",
            "country": "",
            "first_name": "",
            "last_name": "",
            "postcode": "",
            "state": ""
        },
        "shipping_tax": "0.00",
        "shipping_total": "0.00",
        "status": "pending",
        "total": "60.00",
        "total_tax": "0.00",
        "transaction_id": "",
        "version": "3.3.5"
    },
    {
        "_links": {
            "collection": [
                {
                    "href": "https://shop.btownmedia.com/wp-json/wc/v2/orders"
                }
            ],
            "self": [
                {
                    "href": "https://shop.btownmedia.com/wp-json/wc/v2/orders/734"
                }
            ]
        },
        "billing": {
            "address_1": "Bhhyg",
            "address_2": "",
            "city": "Janfn",
            "company": "",
            "country": "IN",
            "email": "ak@g.com",
            "first_name": "Dj",
            "last_name": "Band b",
            "phone": "12346589",
            "postcode": "478889",
            "state": "MP"
        },
        "cart_hash": "3dca1907376f01cc01f7a286966593e1",
        "cart_tax": "0.00",
        "created_via": "checkout",
        "currency": "USD",
        "customer_id": 0,
        "customer_ip_address": "47.247.214.71",
        "customer_note": "",
        "customer_user_agent": "mozilla/5.0 (x11; linux x86_64) applewebkit/537.36 (khtml, like gecko) chrome/66.0.3359.126 safari/537.36",
        "date_created": "2018-05-08T13:05:58",
        "date_created_gmt": "2018-05-08T07:20:58",
        "date_modified": "2018-05-08T13:05:58",
        "date_modified_gmt": "2018-05-08T07:20:58",
        "discount_tax": "0.00",
        "discount_total": "0.00",
        "id": 734,
        "number": "734",
        "order_key": "wc_order_5af14fda906cf",
        "parent_id": 0,
        "payment_method": "paypal",
        "payment_method_title": "PayPal",
        "prices_include_tax": false,
        "shipping": {
            "address_1": "",
            "address_2": "",
            "city": "",
            "company": "",
            "country": "",
            "first_name": "",
            "last_name": "",
            "postcode": "",
            "state": ""
        },
        "shipping_tax": "0.00",
        "shipping_total": "0.00",
        "status": "pending",
        "total": "250.00",
        "total_tax": "0.00",
        "transaction_id": "",
        "version": "3.3.5"
    },
    {
        "_links": {
            "collection": [
                {
                    "href": "https://shop.btownmedia.com/wp-json/wc/v2/orders"
                }
            ],
            "customer": [
                {
                    "href": "https://shop.btownmedia.com/wp-json/wc/v2/customers/190"
                }
            ],
            "self": [
                {
                    "href": "https://shop.btownmedia.com/wp-json/wc/v2/orders/733"
                }
            ]
        },
        "billing": {
            "address_1": "barisal",
            "address_2": "wfmwocm",
            "city": "barisal",
            "company": "rhrthnnt",
            "country": "BD",
            "email": "samrathossain56@gmail.com",
            "first_name": "dgrbrn",
            "last_name": "ghth",
            "phone": "01924248735",
            "postcode": "8207",
            "state": "BARI"
        },
        "cart_hash": "dab8c59f3ee908a281d9b990628b0dbe",
        "cart_tax": "0.00",
        "created_via": "checkout",
        "currency": "USD",
        "customer_id": 190,
        "customer_ip_address": "103.230.107.14",
        "customer_note": "",
        "customer_user_agent": "mozilla/5.0 (windows nt 10.0; wow64; rv:54.0) gecko/20100101 firefox/54.0",
        "date_created": "2018-05-08T01:50:37",
        "date_created_gmt": "2018-05-07T20:05:37",
        "date_modified": "2018-05-08T01:50:37",
        "date_modified_gmt": "2018-05-07T20:05:37",
        "discount_tax": "0.00",
        "discount_total": "0.00",
        "id": 733,
        "number": "733",
        "order_key": "wc_order_5af0b1918dbbe",
        "parent_id": 0,
        "payment_method": "paypal",
        "payment_method_title": "PayPal",
        "prices_include_tax": false,
        "shipping": {
            "address_1": "",
            "address_2": "",
            "city": "",
            "company": "",
            "country": "",
            "first_name": "",
            "last_name": "",
            "postcode": "",
            "state": ""
        },
        "shipping_tax": "0.00",
        "shipping_total": "0.00",
        "status": "pending",
        "total": "150.00",
        "total_tax": "0.00",
        "transaction_id": "",
        "version": "3.3.5"
    },
    {
        "_links": {
            "collection": [
                {
                    "href": "https://shop.btownmedia.com/wp-json/wc/v2/orders"
                }
            ],
            "customer": [
                {
                    "href": "https://shop.btownmedia.com/wp-json/wc/v2/customers/186"
                }
            ],
            "self": [
                {
                    "href": "https://shop.btownmedia.com/wp-json/wc/v2/orders/732"
                }
            ]
        },
        "billing": {
            "address_1": "no 5",
            "address_2": "",
            "city": "chennai",
            "company": "",
            "country": "IN",
            "email": "mkcsakthi@gmail.com",
            "first_name": "Sakthivel",
            "last_name": "K",
            "phone": "9524003844",
            "postcode": "600015",
            "state": "TN"
        },
        "cart_hash": "d68f512a2274201eb3bee3e377eeffbf",
        "cart_tax": "0.00",
        "created_via": "checkout",
        "currency": "USD",
        "customer_id": 186,
        "customer_ip_address": "1.23.23.44",
        "customer_note": "",
        "customer_user_agent": "mozilla/5.0 (windows nt 10.0; win64; x64) applewebkit/537.36 (khtml, like gecko) chrome/65.0.3325.181 safari/537.36",
        "date_created": "2018-05-02T22:19:18",
        "date_created_gmt": "2018-05-02T16:34:18",
        "date_modified": "2018-05-02T22:19:18",
        "date_modified_gmt": "2018-05-02T16:34:18",
        "discount_tax": "0.00",
        "discount_total": "0.00",
        "id": 732,
        "number": "732",
        "order_key": "wc_order_5ae9e88af2f0c",
        "parent_id": 0,
        "payment_method": "paypal",
        "payment_method_title": "PayPal",
        "prices_include_tax": false,
        "shipping": {
            "address_1": "",
            "address_2": "",
            "city": "",
            "company": "",
            "country": "",
            "first_name": "",
            "last_name": "",
            "postcode": "",
            "state": ""
        },
        "shipping_tax": "0.00",
        "shipping_total": "0.00",
        "status": "pending",
        "total": "50.00",
        "total_tax": "0.00",
        "transaction_id": "",
        "version": "3.3.4"
    }
]

Comments

Popular posts from this blog

web2apk

http://web2apk.com/create.aspx Create App   Intro   About   Changes   MalWare ?   Contact   Privacy Useful Links Bluetooth Mini Keyboards Android Mini PC Reset Android URL App Title Icon or

Android Bar Chart Using MpAndroidChart Library Tutorial

https://www.numetriclabz.com/android-bar-chart-using-mpandroidchart-library-tutorial/ Android Bar Chart Using MpAndroidChart Library Tutorial Objective In this tutorial we learn how to implement Bar Chart using MpAndroidChart Library in your Android App. Download Source Code       Step 1 Contents ·        1  Introduction ·        2  Creating Bar chart o    2.1  Create a new Project o    2.2  Adding library in Project o    2.3  Create Layout o    2.4  To Plot Bar Chart §   2.4.1  Initialize the graph id §   2.4.2  Creating a Dataset §   2.4.3  Defining X-axis labels §   2.4.4  Set the data §   2.4.5  Add the description to the chart §   2.4.6  Run your App §   2.4.7  Set the color §   2.4.8  Adding Animations o    2.5  To plot grouped bar chart §   2.5.1  Creating Dataset o    2.6  Get the best of Android plus exclusive deals and freebies in your inbox!

how to retrieve image from sqlite database in android and display in listview

 Android platform provides several ways to store data in our application. 1. SQLite database 2. SharedPreferences etc For our post, we will only work with SQLite database. First and foremost, we need to understand what an SQLite database is? SQLite database  is an open source SQL database that stores data to a text file on a device. It executes SQL Commands to perform a set of functions, that is, create, read, update and delete operations. On my previous post, I showed how to  store data in SQLite database from edit text, retrieve and populate it in a listview . For this post, I will show the SQLite CRUD operations with images from gallery and text from EditText. We need to understand this; images are stored in SQLite database as BLOB data type. A BLOB is a large binary object that can hold a variable amount of data.  Note, we can only store images in the database as BLOB data type. We need to convert our image path to a bitmap then to bytes. Also