i want to execute the following code in aysnc_task.I tried but doing background is not running full code . Please help me .Anybody guide me.i Want to execute the following code in aysnc_task.But the code crashes on webapi call in postexecute.please help me.
 public class Asynctaskc extends AsyncTask<Void, Void, Void> {
        private ProgressDialog progressDialog;
        String rcode;
        String rResponseMesssage;
        CustomerValidationResponse customerValidationResponse;
        CustomerValidationRequest customerValidationRequest;
        TokenResponse tokenResponse;
        String tokens;
        @Override
        protected void onPreExecute() {
            super.onPreExecute();
            progressDialog = new ProgressDialog(Login_activity.this);
            progressDialog.setMessage("Saving image to SD Card");
            progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
            progressDialog.setCancelable(false);
            progressDialog.show();
        }
 @Override
        protected Void doInBackground(Void... voids) {
            final GenerateOAuthToken generateOAuthToken = new GenerateOAuthToken();
            generateOAuthToken.OAuthToken(new Callback() {
                @Override
                public void onFailure(Call call, IOException e) {
                    e.printStackTrace();
                }
                @Override
                public void onResponse(Call call, Response response) throws IOException {
                    String tokenReponseJson = response.body().string();
                    //Json string to Class
                    tokenResponse = new Gson().fromJson(tokenReponseJson, TokenResponse.class);
                    tokens = tokenResponse.access_token;
                }
            });
            return null;
        }
    @Override
        protected void onPostExecute(Void vvoid) {
            super.onPostExecute(vvoid);
            customerValidationRequest = new CustomerValidationRequest(
                    usrname,
                    usrpass,
                    ConstantVariables.getAppversioncode(),
                    false
            );
            String JSONBody = new Gson().toJson(customerValidationRequest);
            final WebAPICall webAPICall = new WebAPICall();
            webAPICall.POSTCall(tokens, "customer/CustomerValidation", JSONBody, new Callback() {
                @Override
                public void onFailure(Call call, IOException e) {
                    e.printStackTrace();
                }
                @Override
                public void onResponse(Call call, Response response) throws IOException {
                    String responseJSON = response.body().string();
                    customerValidationResponse = new Gson().fromJson(responseJSON, CustomerValidationResponse.class);
                    rResponseMesssage = String.valueOf(customerValidationResponse.ResponseMessage);
                    rcode = String.valueOf(customerValidationResponse.ResponseCode);
                    //Json string to Class
                }
            });
            progressDialog.dismiss();
            if (rcode.equals(ConstantVariables.ResponseCodeSucess)) {
                ConstantVariables.seteEmail(usrname);
                startActivity(new Intent(getApplicationContext(), Navigationdrawer.class));
            } else {
                Toast.makeText(Login_activity.this, "" + rResponseMesssage, Toast.LENGTH_SHORT).show();
            }
        }
    }
 
    