Posts

Showing posts from July, 2017

interface example

step 1:- create interface class package com.example.myapp import org.json.JSONObject; public interface ApiResponse {     void onApiRespond(JSONObject Resposne); } step 2:-  create async task import android.os.AsyncTask; import android.util.Log; import com.example.digital.CustomSSLSocketFactory; import com.example.digital.Model.Debugger; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.methods.HttpPost; import org.apache.http.conn.scheme.Scheme; import org.apache.http.conn.scheme.SchemeRegistry; import org.apache.http.conn.ssl.SSLSocketFactory; import org.apache.http.conn.ssl.X509HostnameVerifier; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.impl.conn.SingleClientConnManager; import org.apache.http.util.EntityUtils; import org.json.JSONException; import org.json.JSONObject; import java.security.KeyStore; ...

Async task with GSON parsing

step 1:-   download below libs https://drive.google.com/open?id=0B1dF4YSBqUooMWFZYUpUQ2MtRTQ https://drive.google.com/open?id=0B1dF4YSBqUooc3I3bDYwZnllbDg https://drive.google.com/open?id=0B1dF4YSBqUooZ3ZmUzVaREhCUVk Step 2:- compile 'com.google.code.gson:gson:2.2.4' Step 3:- packagingOptions { exclude 'META-INF/DEPENDENCIES.txt' exclude 'META-INF/LICENSE.txt' exclude 'META-INF/NOTICE.txt' exclude 'META-INF/NOTICE' exclude 'META-INF/LICENSE' exclude 'META-INF/DEPENDENCIES' exclude 'META-INF/notice.txt' exclude 'META-INF/license.txt' exclude 'META-INF/dependencies.txt' exclude 'META-INF/LGPL2.1' } Step 4:- class MyAsync extends AsyncTask<String, Void, String> { @Override protected void onPreExecute() { ConstantData.displayProgress(BaseActivity.this); } @Override...