草庐IT

doInbackground

全部标签

android - 如何在执行 doInBackground() 时在 android 中显示进度微调器

这是我的Activity类,我在其中使用AsyncTask从服务器获取数据:publicclassUserProfileActivityextendsActivity{privateImageViewuserImage;privateTextViewuserName;privateTextViewuserLocation;privateTextVieweditInfo;privateTextViewchnageImage;privateTextViewuserScore;privateListViewfriendsList;publicArrayAdapteradapter;publi

java - 无法为从 doInBackground 到主类的变量赋值

我有一个android类,我在其中初始化我的变量:publicclassmyClassextendsActivity{StringitemIdString;...}然后我在我的onCreate方法中调用AssyncTaskprotectedvoidonCreate(BundlesavedInstanceState){super.onCreate(savedInstanceState);setContentView(R.layout.next_item_caller);Log.d("Before"+itemName);newgetItemNumber().execute();Log.d(

java - 变量没有在 AsyncTask 的 doInBackground 方法中更新

我正在尝试使用以下代码获取result值,但它似乎永远不会更新。我正在检查名为startPosting()的类中的结果:publicclassPostDataThreadextendsAsyncTask{String[]data;Contextcontext;intresult=0;publicintstartPosting(inttype,Stringdata[],Contextc){this.data=data;this.context=c;this.execute();returnresult;}@OverrideprotectedVoiddoInBackground(Void.

android - 致命异常 AsyncTask #1 和 Android doInBackground()

早上好StackOverFlow专业人士,我需要一点帮助。我正在运行一个Android应用程序,它通过php脚本调用MySql数据库,当我运行该应用程序时,我收到由空指针异常引起的AsyncTask#1的致命异常错误。它说它是在执行doInBackground时发生的。这是我从MyBringBack关注的教程。我真的需要全神贯注于此,因为几天来我一直在努力解决这个问题。如果我删除/评论大部分Log.d语句,它会运行正常,但我看不到JSON响应中正在发生的事情的标签,下面列出了代码,任何人都可以帮我解决这个问题或告诉我什么代码有问题。这是logcat的错误日志10-2509:27:47.

android - java.lang.RuntimeException : An error occured while executing doInBackground() 错误

我正在使用下面的代码。它在AndroidStudio中出错。你能帮忙吗?根据我的理解,args[0]没有填充某些值。这是为什么?如果args[0]没有为此选择任何其他实现的任何值。importandroid.app.Activity;importandroid.content.Intent;importandroid.os.AsyncTask;importandroid.os.Bundle;importandroid.provider.DocumentsContract;importandroid.renderscript.Element;importandroid.util.Log;

android - 如何解决致命异常java.lang.RuntimeException : An error occured while executing doInBackground()

我正在开发与聊天相关的类似应用程序我正在使用后台同步类有时会出现强制关闭我正在使用.netwebservices后台我正在接收更新到ui的消息和图像后台下载过程错误是:05-1705:24:17.925:ERROR/AndroidRuntime(1618):FATALEXCEPTION:AsyncTask#105-1705:24:17.925:ERROR/AndroidRuntime(1618):java.lang.RuntimeException:AnerroroccuredwhileexecutingdoInBackground()05-1705:24:17.925:ERROR/A

java - Android:你可以在DoInBackground中访问AsyncTask类成员吗?

在DoInBackground中运行AsyncTask类成员的方法是否安全?还是您需要使用处理程序?privateclassMyAsyncTaskextendsAsyncTask{ObjectmObjA=null:privateMyAsyncTask(ObjectobjA){mObjA=objA}protectedvoiddoInBackground(Void...params){mObjA.aMethod()}}如果mObjA没有作为参数传递,在doInBackground中运行mObjA.aMethod()是否安全?是否存在多线程问题?您应该在doInBackground中只访问故

android - doinbackground 期间内存不足

我有以下代码:-publicclassByStateextendsFragment{@Nullable@OverridepublicViewonCreateView(LayoutInflaterinflater,ViewGroupcontainer,BundlesavedInstanceState){ViewrootView=inflater.inflate(R.layout.by_state,container,false);newGetAllStates().execute("dummy");returnrootView;}}classGetAllStatesextendsAsyn

android - ASynctask 的doInBackground() 中return 语句的作用是什么?

如果我将return语句设置为0或1,我的登录系统的这个方面工作得很好,但如果我使用null则失败。这全部改编自http://256design.com/blog/android-login-asynctask/这个特定的返回看起来像我自己的代码下面列出的那样。publicLoginTask(Pollingactivity,ProgressDialogprogressDialog){this.activity=activity;this.progressDialog=progressDialog;}protectedIntegerdoInBackground(String...arg0

Android:无法为 AsyncTask:doInBackground 指定 List<String> 返回类型

我有以下基于异步任务的代码块。我试图通过returnLoadFeed()返回一个List变量doInBackground的返回类型为String。如果我将doInBackground的返回类型从String更改为List然后我得到一个错误"ThereturntypeisincompatiblewithAsyncTask.doInBackground(String[])"如何修复此错误?请帮忙谢谢,privateclassDispDataextendsAsyncTask{privatefinalProgressDialogdialog=newProgressDialog(MessageL