草庐IT

apply_async

全部标签

android - 使用 android-async-loopj 下载文件

我正在使用这段代码:/*ThisisanasynchronusHTTPclient*/AsyncHttpClientclient=newAsyncHttpClient();client.get(url,params,newFileAsyncHttpResponseHandler(file){@OverridepublicvoidonSuccess(intstatusCode,Header[]headers,Fileresponse){//Dosomethingwiththefile`response`}});但我得到的文件是空的。文档说成功时它会将结果写入传递的文件,但这并没有发生。

async-await - Flutter 在 main 中读取共享首选项,然后决定哪个启动页面?

我想在main中判断启动哪个页面(其实是登录页面和首页)。所以我必须阅读首选项中的isLogin。如何在main中做到这一点?我绑定(bind)了这些代码:FuturecheckIsLogin()async{String_token="";//Iftokenexistalready,thenHomePageSharedPreferencesprefs=awaitSharedPreferences.getInstance();_token=prefs.getString("token");print('gettokenfromprefs:'+_token);if(_token!=""&&

async-await - Flutter 在 main 中读取共享首选项,然后决定哪个启动页面?

我想在main中判断启动哪个页面(其实是登录页面和首页)。所以我必须阅读首选项中的isLogin。如何在main中做到这一点?我绑定(bind)了这些代码:FuturecheckIsLogin()async{String_token="";//Iftokenexistalready,thenHomePageSharedPreferencesprefs=awaitSharedPreferences.getInstance();_token=prefs.getString("token");print('gettokenfromprefs:'+_token);if(_token!=""&&

android - 找不到参数的方法 apply()

我已经遵循了很多解决方案只是为了让它运行并在此处结束,但不知道还能做什么。如何配置该项目才能运行?build.gradle:applyplugin:'com.android.application'applyplugin:'com.neenbedankt.android-apt'android{compileSdkVersion23buildToolsVersion"23.0.3"//兼容Android6.0系统所需,如果这句话报错,可在dependencies标签下使用compile'cn.bmob.android:http-legacy:1.0'useLibrary'org.apa

php - android-async-http 上传图片到 php 服务器

我整天都在研究如何将图像从我的应用程序上传到服务器端。我已经完成了移动应用程序方面publicstaticvoidpostImage(StringImageLink){RequestParamsparams=newRequestParams();params.put("uploaded_file[name]","MyImageName");try{params.put("uploaded_file[image]",newFile(ImageLink));}catch(FileNotFoundExceptione){e.printStackTrace();}AsyncHttpClient

Android:如何使用 Async 下载 .png 文件并将其设置为 ImageView?

我有一张.png图像的URL,需要下载该图像并将其设置为ImageView的源。到目前为止我是初学者,所以有几件事我不明白:1)我在哪里存储文件?2)如何在java代码中将其设置为ImageView?3)如何正确覆盖AsyncTask方法?提前致谢,非常感谢任何形式的帮助。 最佳答案 我不确定您是否可以从下载中明确构建png。但是,这是我用来下载图像并将它们显示到Imageviews中的方法:首先,你下载图片:protectedstaticbyte[]imageByter(Contextctx,Stringstrurl){try{U

java - 安卓 : JSON Parser with async task (GET and POST methods)

只是想检查这个带有异步任务的JSONParser是否正确完成?当我将此代码放入我的Eclipse时,此(method.equals("POST")带有红色下划线。它声明无法解决“方法”。对此有任何建议或帮助吗?谢谢。publicclassJSONParser{staticInputStreamis=null;staticJSONObjectjObj=null;staticStringjson="";Stringurl=null;Listnvp=null;//constructorpublicJSONParser(){}//functiongetjsonfromurl//bymaking

dart - 如何在 Dart 中通过 async* 传输错误?

在Flutter中,我们使用StreamBuilder接收一个Streame给我们一个包含“数据”但也包含“错误”对象的Snapshot对象。我想用async*创建一个产生数据的函数,但由于某些条件,它也会产生一些错误。我怎样才能在Dart中实现这一点?StreamjustAFunction()async*{yield0;for(vari=1;i然后,在StreamBuilder中:StreamBuilder(stream:justAFunction(),builder:(BuildContextcontext,AsyncSnapshotsnapshot){returnCenter(c

dart - 如何在 Dart 中通过 async* 传输错误?

在Flutter中,我们使用StreamBuilder接收一个Streame给我们一个包含“数据”但也包含“错误”对象的Snapshot对象。我想用async*创建一个产生数据的函数,但由于某些条件,它也会产生一些错误。我怎样才能在Dart中实现这一点?StreamjustAFunction()async*{yield0;for(vari=1;i然后,在StreamBuilder中:StreamBuilder(stream:justAFunction(),builder:(BuildContextcontext,AsyncSnapshotsnapshot){returnCenter(c

android - FragmentActivity 切换错误... "Incompatible types"或 "FragmentTransaction cannot be applied"

我需要将我的界面从4.x降级到2.3.x。4.x界面是用Fragments设计的,并且可以正常工作。为了降级它,我将它们更改为FragmentActivties,将所有内容切换到所需的androidSupportv4版本。问题是,Fragment开关不起作用。导入是:importandroid.support.v4.app.FragmentTransaction;importandroid.support.v4.app.FragmentManager;importandroid.support.v4.app.Fragment;importandroid.support.v7.app.A