Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/222.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 在AsyncTAsk中获取setAdapter时出错?_Android_Android Asynctask - Fatal编程技术网

Android 在AsyncTAsk中获取setAdapter时出错?

Android 在AsyncTAsk中获取setAdapter时出错?,android,android-asynctask,Android,Android Asynctask,我全局添加了行游标适配器,并在服务ivr AsyncTask中添加onPostExecute()方法后进行了更改。这是更新的代码 class Service_ivr extends AsyncTask<String, Void, String> { @Override protected String doInBackground(String... param) { SoapObject req

我全局添加了行游标适配器,并在服务ivr AsyncTask中添加onPostExecute()方法后进行了更改。这是更新的代码

 class Service_ivr extends AsyncTask<String, Void, String>
     {

        @Override
        protected String doInBackground(String... param) 
        {
            SoapObject request = new SoapObject(NAMESPACE ,METHOD_NAME);
            request.addProperty("user_id",param[0]);
            SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
            envelope.bodyOut=request;
            envelope.dotNet =true;
            envelope.setOutputSoapObject(request);

            try
            {
                HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
                androidHttpTransport.call(SOAP_ACTION, envelope);
                SoapObject obj2 = (SoapObject)envelope.getResponse();
                int count = obj2.getPropertyCount();
                index = count/7;
                final lead_content_IVR [] total_ivr_data = new lead_content_IVR[index];
                for(int i=0; i<index ;i++)
                {
                    String call_duration;
                    String lead_id = obj2.getPropertyAsString(i*7+0);
                    String lead_call_from = obj2.getPropertyAsString(i*7+1);
                    String lead_call_to = obj2.getPropertyAsString(i*7+2);
                    String lead_date=obj2.getPropertyAsString(i*7+3);
                    String lead_audio=obj2.getPropertyAsString(i*7+4);
                    String assign_id = obj2.getPropertyAsString(i*7+5);
                    String time = obj2.getPropertyAsString(i*7+6);
                    if(lead_call_from.equals("Welcome Sound") || lead_call_from.equals("Call Missed") || lead_call_from.equals("User Disconnected")  || lead_call_from.equals("Customer Missed"))
                    {
                        call_duration= "5 sec";
                    }
                    else
                    {
                        call_duration = time.toString().concat(" sec");
                    }

                    total_ivr_data[i] = new lead_content_IVR(lead_id,lead_call_from,lead_call_to,lead_date,lead_audio,assign_id,call_duration);
                }

                adapter = new RowCursorAdapter_IVR(Activity_IVR_Lead.this, R.layout.listview_layout_ivr,total_ivr_data);





            }catch(Exception e)
            {
                e.printStackTrace();
            }
            return null;
        }

         @Override
         protected void onPostExecute(String s) {
             super.onPostExecute(s);
             listView.setAdapter(adapter);
         }
     }
类服务\u ivr扩展异步任务
{
@凌驾
受保护的字符串doInBackground(字符串…参数)
{
SoapObject请求=新的SoapObject(名称空间、方法名称);
request.addProperty(“user_id”,参数[0]);
SoapSerializationEnvelope=新的SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.bodyOut=请求;
envelope.dotNet=true;
envelope.setOutputSoapObject(请求);
尝试
{
HttpTransportSE androidHttpTransport=新的HttpTransportSE(URL);
调用(SOAP_操作,信封);
SoapObject obj2=(SoapObject)envelope.getResponse();
int count=obj2.getPropertyCount();
指数=计数/7;
最终铅含量[总铅含量]数据=新铅含量[指数];

对于(inti=0;i像这样改变你的方法

class service_ivr extends AsyncTask<String, Void, String>
{
    @Override
    protected lead_content_IVR[]  doInBackground(String... param) 
    {
        SoapObject request = new SoapObject(NAMESPACE ,METHOD_NAME);
        request.addProperty("user_id",param[0]);
        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.bodyOut=request;
        envelope.dotNet =true;
        envelope.setOutputSoapObject(request);
        lead_content_IVR [] total_ivr_data = null;
        try
        {
            HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
            androidHttpTransport.call(SOAP_ACTION, envelope);
            SoapObject obj2 = (SoapObject)envelope.getResponse();
            int count = obj2.getPropertyCount();
            index = count/7;
            total_ivr_data = new lead_content_IVR[index];
            for(int i=0; i<index ;i++)
            {
                String call_duration;
                String lead_id = obj2.getPropertyAsString(i*7+0);
                String lead_call_from = obj2.getPropertyAsString(i*7+1);
                String lead_call_to = obj2.getPropertyAsString(i*7+2);
                String lead_date=obj2.getPropertyAsString(i*7+3);
                String lead_audio=obj2.getPropertyAsString(i*7+4);
                String assign_id = obj2.getPropertyAsString(i*7+5);
                String time = obj2.getPropertyAsString(i*7+6);
                if(lead_call_from.equals("Welcome Sound") || lead_call_from.equals("Call Missed") || lead_call_from.equals("User Disconnected")  || lead_call_from.equals("Customer Missed"))
                {
                    call_duration= "5 sec";
                }
                else
                {
                    call_duration = time.toString().concat(" sec");
                }

                total_ivr_data[i] = new lead_content_IVR(lead_id,lead_call_from,lead_call_to,lead_date,lead_audio,assign_id,call_duration);
            }
        }catch(Exception e)
        {
            e.printStackTrace();
        }
        return total_ivr_data;
    }

    public void onPostExecute(lead_content_IVR [] total_ivr_data ) {
        RowCursorAdapter_IVR adapter = new RowCursorAdapter_IVR(Activity_IVR_Lead.this, R.layout.listview_layout_ivr,total_ivr_data);
        listView.setAdapter(adapter);
    }
}
类服务\u ivr扩展异步任务
{
@凌驾
受保护的铅含量[IVR[]背景(字符串…参数)
{
SoapObject请求=新的SoapObject(名称空间、方法名称);
request.addProperty(“user_id”,参数[0]);
SoapSerializationEnvelope=新的SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.bodyOut=请求;
envelope.dotNet=true;
envelope.setOutputSoapObject(请求);
lead_content_IVR[]total_IVR_data=null;
尝试
{
HttpTransportSE androidHttpTransport=新的HttpTransportSE(URL);
调用(SOAP_操作,信封);
SoapObject obj2=(SoapObject)envelope.getResponse();
int count=obj2.getPropertyCount();
指数=计数/7;
总ivr数据=新铅含量ivr[索引];

对于(inti=0;i像这样改变你的方法

class service_ivr extends AsyncTask<String, Void, String>
{
    @Override
    protected lead_content_IVR[]  doInBackground(String... param) 
    {
        SoapObject request = new SoapObject(NAMESPACE ,METHOD_NAME);
        request.addProperty("user_id",param[0]);
        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.bodyOut=request;
        envelope.dotNet =true;
        envelope.setOutputSoapObject(request);
        lead_content_IVR [] total_ivr_data = null;
        try
        {
            HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
            androidHttpTransport.call(SOAP_ACTION, envelope);
            SoapObject obj2 = (SoapObject)envelope.getResponse();
            int count = obj2.getPropertyCount();
            index = count/7;
            total_ivr_data = new lead_content_IVR[index];
            for(int i=0; i<index ;i++)
            {
                String call_duration;
                String lead_id = obj2.getPropertyAsString(i*7+0);
                String lead_call_from = obj2.getPropertyAsString(i*7+1);
                String lead_call_to = obj2.getPropertyAsString(i*7+2);
                String lead_date=obj2.getPropertyAsString(i*7+3);
                String lead_audio=obj2.getPropertyAsString(i*7+4);
                String assign_id = obj2.getPropertyAsString(i*7+5);
                String time = obj2.getPropertyAsString(i*7+6);
                if(lead_call_from.equals("Welcome Sound") || lead_call_from.equals("Call Missed") || lead_call_from.equals("User Disconnected")  || lead_call_from.equals("Customer Missed"))
                {
                    call_duration= "5 sec";
                }
                else
                {
                    call_duration = time.toString().concat(" sec");
                }

                total_ivr_data[i] = new lead_content_IVR(lead_id,lead_call_from,lead_call_to,lead_date,lead_audio,assign_id,call_duration);
            }
        }catch(Exception e)
        {
            e.printStackTrace();
        }
        return total_ivr_data;
    }

    public void onPostExecute(lead_content_IVR [] total_ivr_data ) {
        RowCursorAdapter_IVR adapter = new RowCursorAdapter_IVR(Activity_IVR_Lead.this, R.layout.listview_layout_ivr,total_ivr_data);
        listView.setAdapter(adapter);
    }
}
类服务\u ivr扩展异步任务
{
@凌驾
受保护的铅含量[IVR[]背景(字符串…参数)
{
SoapObject请求=新的SoapObject(名称空间、方法名称);
request.addProperty(“user_id”,参数[0]);
SoapSerializationEnvelope=新的SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.bodyOut=请求;
envelope.dotNet=true;
envelope.setOutputSoapObject(请求);
lead_content_IVR[]total_IVR_data=null;
尝试
{
HttpTransportSE androidHttpTransport=新的HttpTransportSE(URL);
调用(SOAP_操作,信封);
SoapObject obj2=(SoapObject)envelope.getResponse();
int count=obj2.getPropertyCount();
指数=计数/7;
总ivr数据=新铅含量ivr[索引];

对于(int i=0;iMove
listView.setAdapter(adapter);
onPostExecute方法内的行感谢快速响应…无法解析symbol@Override受保护的void onPostExecute(字符串s){super.onPostExecute(s);listView.setAdapter(适配器);}还全局声明
RowCursorAdapter\u IVR adapter
,并使用
adapter=new RowCursorAdapter\u IVR(Activity\u IVR\u Lead.this,R.layout.listview\u layout\u IVR,total\u IVR\u data);
Move
listview.setAdapter(adapter);
onPostExecute方法内的行感谢您的快速响应…无法解决symbol@Override受保护的void onPostExecute(字符串s){super.onPostExecute(s);listView.setAdapter(适配器);}还全局声明
RowCursorAdapter\u IVR adapter
,并使用
adapter=new RowCursorAdapter\u IVR(Activity\u IVR\u Lead.this,R.layout.listview\u layout\u IVR,total\u IVR\u data);