1

This is my Code

ClaimRegisterPage.activity

package com.clip.android;
/**
 * 
 * @author abhishek
 *
 */

import java.util.ArrayList;
import java.util.List;
import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;


public class ClaimRegisterPage extends ClaimRegister {

    TextView custid;
    String customerid;
    String policyAutoId;

    Intent intent;
    static String[] linearray;
    static String[] linearray1;
    static String[] linearray2;

    TextView custname;
    String customername;

    TextView prdid;
    String productid;

    String clmtype;
    String getclmtype;
    TextView prdname;
    String productname;

    TextView prdline;
    String productline;

    TextView pfrom;
    String prdfrom;

    TextView pto;
    String prdto;

    TextView sumins;
    String suminsured;

    String policyId;

    LinearLayout searchButtonListner;

    ProgressDialog progress;
    ProgressDialog prDialog;
    private String NextRecords="";
    private String NextRecords1="";
    private String NextRecords2="";


    List<Policy> policys = new ArrayList<Policy>();
    static List<String> lineofbusiness = new ArrayList<String>();
    static List<String> addndeduct = new ArrayList<String>();
    static List<String> annuityinfo = new ArrayList<String>();

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setHeader("Policy Details", true, true);
        setContentView(R.layout.activity_claim_register_page);
        custid = (TextView) findViewById(R.id.pcustomerid);
        custname = (TextView) findViewById(R.id.pcustomername);
        prdid = (TextView) findViewById(R.id.pproductid);
        prdname = (TextView) findViewById(R.id.pproductname);
        prdline = (TextView) findViewById(R.id.pproductline);
        pfrom = (TextView) findViewById(R.id.pperiodfrom);
        pto = (TextView) findViewById(R.id.pperiodto);
        sumins = (TextView) findViewById(R.id.psuminsured);
        searchButtonListner = (LinearLayout) findViewById(R.id.searchButtonListner);
        searchButtonListner.setOnClickListener(new Button.OnClickListener() {
            public void onClick(View v) {
                AsyncCallWS1 task1 = new AsyncCallWS1();
                task1.execute();
         }
    });

        Intent intent = getIntent();
        if(intent!=null){
        policyId = intent.getStringExtra("userValue");
        clmtype = intent.getStringExtra("getclmType");
        Log.d("page", "1");

        AsyncCallWS task = new AsyncCallWS();
        task.execute();
        }



    }



    //Getting Policy details using webservice       

      private class AsyncCallWS extends AsyncTask<String, Void, Void> {
            @SuppressLint("NewApi")
            @Override
            protected Void doInBackground(String... params) {


                policys = PolicyWebService.invokeHelloWorldWS(policyId, "getPolicyDetails");

                for(Policy policy:policys){
                    policyAutoId = policy.getPOLICYID();
                    customerid =  policy.getID();
                    customername = policy.getFULLNAME();
                    productid =  policy.getPRODUCTID();
                    productname =  policy.getPRODUCTNAME();
                    productline =  policy.getPRODUCTLINE();
                    prdfrom =  policy.getPERIODFROM();
                    prdto =  policy.getPERIODTO();
                    suminsured= policy.getTOTALSI();
                }
                Log.d("Page", "Policys = " +policys.size());
                if(policys.size()==0){

            }
                return null;
            }

            @Override
            protected void onPreExecute() {
                Log.d("page", "onpreExecute");

                progress = ProgressDialog.show(ClaimRegisterPage.this, "Retrieving Policy Details", "Please Wait.........!");

            }
            @Override
            protected void onPostExecute(Void result) {
                Log.d("page", "onpostExecute");
                if(policys.size()==0){
                    AlertDialog.Builder builder = new AlertDialog.Builder(ClaimRegisterPage.this);
                    builder.setMessage( "Sorry No Record Found").setCancelable(false)
                        .setPositiveButton("OK", new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog,int id) {
                              finish();
                            } 
                        }); 
                    AlertDialog alert = builder.create();
                    alert.show();     
                }


                progress.dismiss();
                Log.d("page", "lolasdsad");
                custid.setText(customerid);
                custname.setText(customername);
                prdid.setText(productid);
                prdname.setText(productname);
                prdline.setText(productline);
                pfrom.setText(prdfrom);
                pto.setText(prdto);
                sumins.setText(suminsured);

            }   
      }

    //Getting Rider details based on policyID using webservice  


      private class AsyncCallWS1 extends AsyncTask<String, Void, Void> {
            @SuppressLint("NewApi")
            @Override
            protected Void doInBackground(String... params) {
                  if(clmtype.equals("ANNCLM"))
                    {
                      annuityinfo =  com.clip.webservice.GetAQuote.GetLineofBusiness(policyId,"getAnnuityValues");
                    }
                lineofbusiness = com.clip.webservice.GetAQuote.GetLineofBusiness(policyId,"getRiderinformation");
                addndeduct =  com.clip.webservice.GetAQuote.GetLineofBusiness(policyAutoId,"getClmcalculatedValue");
                return null;
        }
            @Override
            protected void onPreExecute() {     
                NextRecords="";
                NextRecords1="";
                NextRecords2="";
                prDialog = ProgressDialog.show(ClaimRegisterPage.this, "Processing", "Please Wait.........!");
            }
            protected void onPostExecute(Void result) {
                prDialog.dismiss();
                for(int i=0;i<lineofbusiness.size();i++){
                linearray= new String[lineofbusiness.size()+1]; 
                linearray[i]=lineofbusiness.get(i); 
                NextRecords  += lineofbusiness.get(i);
            //------------------------------------------------------------------//
                //ADD N DEDUCT
            //------------------------------------------------------------------//  
                for(int j=0;j<addndeduct.size();j++){
                    linearray1= new String[addndeduct.size()+1]; 
                    linearray1[j]=addndeduct.get(j);    
                    NextRecords1  += addndeduct.get(j);
                }
                //------------------------------------------------------------------//
                    //ANNUITY
                //------------------------------------------------------------------//  
                  if(clmtype.equals("ANNCLM"))
                    {   
                      for(int k=0;k<annuityinfo.size();k++){
                        linearray2= new String[annuityinfo.size()+1]; 
                        linearray2[k]=annuityinfo.get(k);   
                        NextRecords2  += annuityinfo.get(k);
                    }
                }
            if(lineofbusiness.size()==0){
                 Toast.makeText(ClaimRegisterPage.this, "No Rider information.", Toast.LENGTH_LONG).show();
            }
            else{
                 intent = new Intent(ClaimRegisterPage.this,ClaimInfoActivity.class);
                 intent.putExtra("raiderData", NextRecords);
                 intent.putExtra("addndeduct", NextRecords1);

                if(clmtype.equals("ANNCLM"))
                {
                 intent.putExtra("annuity", NextRecords2);
                }
                 intent.putExtra("getclmType", clmType);
                 startActivity(intent);

            }
          }
        }
}
}

Next Activity

package com.clip.android;

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

import org.apache.http.protocol.HTTP;

import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;
/**
 * 
 * @author abhishek
 *
 */
public class ClaimInfoActivity extends HomeButtonActivity
{
    String product;
    String clmtype;
    EditText claimId;
    EditText policyId;
    TextView paydisplay;
    LinearLayout submitbutton;
    TextView header;

    static String[] linearray;
    static List<String> lineofbusiness = new ArrayList<String>();
    static String policydetails;
    int k;
    static List<String> list = new ArrayList<String>();
    ProgressDialog  prDialog;

    String getpolicyId;
    String Record = "";
    String Amount = "";
    String Annuity ="";
    String Type = "";
    Intent intent; 
    String subg ="" ,subjectMatterlist="";
    String subg1="",subjectMatterlist1="";
    String subg2="";
    String subg3="";
    String subg4="",subjectMatterlist2="";
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_claim_info);
        setHeader("Claim Information", true, true);
        IntilizeContents();

        intent = getIntent();
        if (null != intent) 
        {   
            Record = intent.getStringExtra("raiderData");
            Amount = intent.getStringExtra("addndeduct");
            if(clmtype.equals("ANNCLM"))
            {
                Annuity = intent.getStringExtra("annuity");
            }
            clmtype = intent.getStringExtra("getclmType");
        }   

        // for rider Info//
        subjectMatterlist = Record;                              
        String[] subjectmatter = subjectMatterlist.split("\\?");


        for(int j = 0; j< subjectmatter.length; j = j + 4) {
            subg+= "<TR> <td>"+subjectmatter[j]+"</td> &nbsp;";
            if(j+1!=subjectmatter.length){

                subg+="<td>"+subjectmatter[j+1]+"&nbsp;</td>";
            }
            if(j+2!=subjectmatter.length){

                subg+="<td>"+subjectmatter[j+2]+"&nbsp;</td>";
            }
            if(j+3!=subjectmatter.length){

                subg+="<td>"+subjectmatter[j+3]+"&nbsp;</td>";
            }

        }
        //------------------------------------------------------//
        // for add and deduct//
        subjectMatterlist1 = Amount;                               
        String[] subjectmatter1 = subjectMatterlist1.split("\\?");
        Log.d("lol", "subjectmatter1.length"+ subjectmatter1.length);
        for(int j = 0; j<((1)); j = j + 1) {
            subg1+= "<TR><td width = '5%'>"+subjectmatter1[j]+"</td> &nbsp;";
            if(j+1!=subjectmatter1.length){

                subg1+="<td style='max-width:5%'>"+subjectmatter1[j+1]+"&nbsp;</td>";
            }
            if(j+2!=subjectmatter1.length){

                subg1+="<td width='10%'>"+subjectmatter1[j+2]+"&nbsp;</td>";
            }
            if(j+3!=subjectmatter1.length){

                subg1+="<td width='10%'>"+subjectmatter1[j+3]+"&nbsp;</td>";
            }
            if(j+4!=subjectmatter1.length){

                subg1+="<td width='10%'>"+subjectmatter1[j+4]+"&nbsp;</td>";
            }
            if(j+5!=subjectmatter1.length){

                subg1+="<td width='10%'>"+subjectmatter1[j+5]+"&nbsp;</td>";
            }
            if(j+6!=subjectmatter1.length){

                subg1+="<td width='10%'>"+subjectmatter1[j+6]+"&nbsp;</td>";
            }
            subg2+= "<TR><td width = '5%'>"+subjectmatter1[j+7]+"</td> &nbsp;";
            if(j+8!=subjectmatter1.length){

                subg2+="<td style='max-width:5%'>"+subjectmatter1[j+8]+"&nbsp;</td>";
            }
            if(j+9!=subjectmatter1.length){

                subg2+="<td width='10%'>"+subjectmatter1[j+9]+"&nbsp;</td>";
            }
            if(j+10!=subjectmatter1.length){

                subg2+="<td width='10%'>"+subjectmatter1[j+10]+"&nbsp;</td>";
            }
            if(j+11!=subjectmatter1.length){

                subg2+="<td width='10%'>"+subjectmatter1[j+11]+"&nbsp;</td>";
            }
            if(j+12!=subjectmatter1.length){

                subg2+="<td width='10%'>"+subjectmatter1[j+12]+"&nbsp;</td>";
            }
            if(j+13!=subjectmatter1.length){

                subg2+="<td width='10%'>"+subjectmatter1[j+13]+"&nbsp;</td>";
            }
            if(14==j+14){
                  subg3+="<td>"   +subjectmatter1[j+14]+"&nbsp;</td>";
                }   
            }
        //-------------------------------------------------------//
        // for annuity Info//
          if(clmtype.equals("ANNCLM"))
            {
                subjectMatterlist2 = Annuity;                              
                String[] subjectmatter2 = subjectMatterlist2.split("\\?");


                for(int j = 0; j<1; j = j + 1) {
                    subg4+= "<TR> <td>"+subjectmatter2[j]+"</td> &nbsp;";
                    if(j+1!=subjectmatter2.length){

                        subg4+="<td>"+subjectmatter2[j+1]+"&nbsp;</td>";
                    }
                    if(j+2!=subjectmatter2.length){

                        subg4+="<td>"+subjectmatter2[j+2]+"&nbsp;</td>";
                    }
                    if(j+3!=subjectmatter2.length){

                        subg4+="<td>"+subjectmatter2[j+3]+"&nbsp;</td>";
                    }

                    if(j+4!=subjectmatter2.length){

                        subg4+="<td>"+subjectmatter2[j+4]+"&nbsp;</td>";
                    }

                }
            }
                //------------------------------------------------------//

        WebView m_WebView = (WebView) findViewById(R.id.webView1);
        m_WebView.getSettings().setJavaScriptEnabled(true);

        prDialog = ProgressDialog.show(this, "Loading", "Please wait for a moment...");
         // add a WebViewClient for WebView, which actually handles loading data from web
        m_WebView.setWebViewClient(new WebViewClient() {
                // load url
                public boolean shouldOverrideUrlLoading(WebView view, String url) {
                    view.loadUrl(url);
                    return true;
                } 
                // when finish loading page
                public void onPageFinished(WebView view, String url) {
                    if(prDialog.isShowing()) {
                        prDialog.dismiss();
                    }
                }
            });

        m_WebView.loadDataWithBaseURL("file:///android_asset/","<%@ taglib uri='http://java.sun.com/jsp/jstl/core' prefix='c'%>",
            "<!DOCTYPE html>"+
            "<html>"+
            "<head>"+
            "<meta name='viewport' content='width=device-width, initial-scale=1'>"+
            "<link rel='stylesheet' href='js/jquery.mobile-1.4.5.min.css'>"+
            "<script src='js/jquery-1.11.2.min.js'></script>"+
            "<script src='js/jquery.mobile-1.4.5.min.js'></script>"+
            "<style>"+
            "h3 {background-color:#39A4CB}"+
            "</style>"+
            "<style>"+
            ".boldtable, .boldtable TD, .boldtable TH"+
            "{"+
            "font-family:sans-serif;"+
            "font-size:9pt;"+
            "text-align: left;"+
            "border: 1px solid;"+ 
            "}"+
            "</style>"+
            "</head>"+
            "<body>"+ 
                "<div data-role='collapsible' data-collapsed='true'>"+  
                "<h3>Rider Information</h3><center>"+
                "<TABLE BORDER CLASS='boldtable' width='100%'>"+
                "<TR><TH>Rider Id</TH><TH>Rider Name</TH><TH>RiderSA</TH><TH>Rider term</TH></TR>"+
                 subg+
                "</TABLE></center>"+
                "</div>"+
                //---------------------------------------------------------------------//
                //"ANNUITY BLOCK"
                //---------------------------------------------------------------------//
                "<c:if test='${clmtype ='ANNCLM'}'>"+
                "<div data-role='collapsible' data-collapsed='true'>"+  
                "<h3>Annuity Information</h3><center>"+
                "<TABLE BORDER CLASS='boldtable' width='100%'>"+
                "<TR><TH>Calc Option</TH><TH>Premium Purchase</TH><TH>Annuity Amount</TH><TH>Vesting Age</TH><TH>Deferment Period</TH></TR>"+
                 subg4+
                "</TABLE></center>"+
                "</div>"+
                "</c:if>"+
                //---------------------------------------------------------------------//
                //"DEATH BLOCK"
                //---------------------------------------------------------------------//
                "<c:if test='${clmtype ='DTHCLM'}'>"+
                "<div data-role='collapsible' data-collapsed='true'>"+  
                "<h3>Death Information</h3><center>"+
                "<TABLE BORDER CLASS='boldtable' width='100%'>"+
                "<TR><TH>Rider Id</TH><TH>Rider Name</TH><TH>RiderSA</TH><TH>Rider term</TH></TR>"+
                 subg+
                "</TABLE></center>"+
                "</div>"+
                "</c:if>"+
                //---------------------------------------------------------------------//
                //ADD and DEDUCT
                //---------------------------------------------------------------------//
                "<div data-role='collapsible' data-collapsed='true'>"+
                "<h3>Additions And Deductions</h3><center>"+
                "<div style= 'overflow:auto;'>"+  
                "<h3 width ='100%'>Additions</h3><center>"+
                "<TABLE BORDER CLASS='boldtable' width='100%'>"+
                "<tbody>"+
                "<TR><TH width='6%'>Sum Assured</TH>" +
                "<TH width='10%'>Vested Bonus Allotted</TH>" +
                "<TH width='10%'>Inter In Bonus</TH >" +
                "<TH width='10%'>Additional Bonus</TH >" +
                "<TH>Difference In Premium</TH>" +
                "<TH width='10%'>Refund of Deposit</TH>" +
                "<TH width='10%'>Gross Claim Amount</TH></TR>"+
                 subg1+
                 "</tbody>"+
                "</TABLE></center>"+ 
                "<h3 width ='100%'>Deductions</h3><center>"+
                "<TABLE BORDER CLASS='boldtable' width='100%'>"+
                "<tbody>"+
                "<TR><TH width='6%'>UnPaid Installments</TH>"+
                "<TH width='10%'>Interest on Unpaid Premium</TH>"+
                "<TH width='10%'>Loan</TH >"+
                "<TH width='10%'>Interest on Loan</TH>"+
                "<TH width='10%'>Recovery Under Statement Age</TH >" +
                "<TH width='10%'>Other Deductions(Specify)</TH>" +
                "<TH width='10%'>Difference In Premium</TH></TR>"+
                 subg2+
                 "</tbody>"+
                "</TABLE></center>"+
                 "<td>NetAmount   </td></TR>"+
                    subg3+
                "</div>"+
                "</div>"+
                //---------------------------------------------------------------------//

            "</body>"+
            "</html>","text/html" ,HTTP.UTF_8);

            paydisplay.setText("Register"); 
            submitbutton.setOnClickListener(new Button.OnClickListener() {
            public void onClick(View v) {
                ClaimInfoActivity.this.finish();
                overridePendingTransition(R.anim.pull_in_left, R.anim.push_out_right);
                finish();
                return;
         }
    });

    }

    private void IntilizeContents() {
        header = (TextView) findViewById(R.id.headertitle);
        paydisplay = (TextView) findViewById(R.id.payfunction);
        submitbutton = (LinearLayout) findViewById(R.id.searchButtonListner);
    }

    @Override
    public void onBackPressed() {
     super.onBackPressed();
     overridePendingTransition(R.anim.pull_in_left, R.anim.push_out_right);
     finish();
   }
}

ERROR

04-23 03:59:49.370: W/EGL_emulation(1986): eglSurfaceAttrib not implemented 04-23 03:59:49.370: W/OpenGLRenderer(1986): Failed to set EGL_SWAP_BEHAVIOR on surface 0x7f7eefd4ad00, error=EGL_SUCCESS 04-23 03:59:50.990: W/EGL_emulation(1986): eglSurfaceAttrib not implemented 04-23 03:59:50.990: W/OpenGLRenderer(1986): Failed to set EGL_SWAP_BEHAVIOR on surface 0x7f7eefafe600, error=EGL_SUCCESS 04-23 03:59:52.010: W/EGL_emulation(1986): eglSurfaceAttrib not implemented 04-23 03:59:52.010: W/OpenGLRenderer(1986): Failed to set EGL_SWAP_BEHAVIOR on surface 0x7f7eefb39f40, error=EGL_SUCCESS 04-23 03:59:52.030: D/doBack(1986): 0000 04-23 03:59:52.190: W/art(1986): Suspending all threads took: 30ms

OnClick of button of ClaimRegisterPageActivity All threads are suspended showing this error in LogCat Console.. and Stay in same activity itself instead going to next activity Please help me to resolve this error..

Abhishek
  • 79
  • 2
  • 15
  • Extended discussion in http://stackoverflow.com/questions/28966496/android-studio-emulator-eglsurfaceattrib-not-implemented – Walter K Jun 14 '16 at 06:35

0 Answers0