android-asynctask

How to call web service to achieve login system in Android?

夙愿已清 提交于 2020-01-03 05:09:08
问题 i have a xml project. this is the Login sample code http://10.99.99.99:8087/item/services/ItemService <soapenv:Header/> <soapenv:Body> <ser:userLogin> <!--Optional:--> <arg0>admin</arg0> <!--Optional:--> <arg1>admin</arg1> </ser:userLogin> </soapenv:Body> </soapenv:Envelope> If Succeed <soap:Body> <ns2:userLoginResponse xmlns:ns2="http://services.ws.item/"> <return> <result>1</result> <msg>Login Succeed</msg> </return> </ns2:userLoginResponse> </soap:Body> </soap:Envelope> If Not Succeed

Returning from Asynch Task to MainActivity

蓝咒 提交于 2020-01-03 04:30:10
问题 I read a lot about it and tried many things, without having succes. But it doesn't seem hard at all, so I guess I am missing a little thing. I got 2 classes, a MainActivity and an asynch task class. the doInBackground task is working perfectly. But when it is done, I want to program to continue at a certain point in my MainActivity protected Integer doInBackground(Void... params) { try { Log.d("control", "ZipHelper.unzip() - File: " + _archive); ZipFile zipfile = new ZipFile(_archive); for

How to make Asynctask postExecute send variable back to main class

戏子无情 提交于 2020-01-03 03:43:04
问题 I have my class called Main.java which runs the UI. I have another class called VerifyCreds.java which extends AsyncTask. VerifyCreds whole purpose is to run calls to my server on another thread so as to not lockup my UI. I don't have it sublcassed in Main.java because I will have a number of other classes that will be making calls to the server and I would like to have them all use the VerifyCreds class to do it. What I need to be able to do is pass data back to Main.java from VerifyCreds

use canvas.drawBitmap in AsyncTask onPostExecute

喜你入骨 提交于 2020-01-03 03:36:25
问题 i use async task to draw bitmap on view,but it's draw nothing! this is the asynctask code class BitmapWorker extends AsyncTask<String, Void, Void> { private Canvas canvas; private Rect rcText; private Paint paint; private Options options; private Options opt; public BitmapWorker(Canvas canvas,Rect rcText,Paint paint) { this.canvas = canvas; this.rcText = rcText;//the bitmap must draw on it's rect this.paint = paint; } @Override protected Void doInBackground(String... params) { options = new

How can I put a timer in an AsyncTask without creating another thread?

僤鯓⒐⒋嵵緔 提交于 2020-01-03 03:32:26
问题 I have an asynchronous task that I use to connect to a website (Twitter). In certain situations (eg. when Twitter post update fails) I want to wait 10 seconds before trying again. As I am already in an async task I dont want to start another thread for the timer. Any suggestions would be great :). Code below... class SendTwitAsyncTask extends AsyncTask<String, Void, Void> { @Override protected Void doInBackground(String... params) { String tokenTwit = params[0]; String tokenSecretTwit =

Migrating from SQLite to Android Room Persistence Library

荒凉一梦 提交于 2020-01-03 03:27:05
问题 I have an app which is using SQLite database and I am trying to replace Android SQLite with Android Room API. I have created DAO class, Entity class, and DB but while executing database query in Async task I am getting following error: Caused by: java.lang.IllegalStateException: A migration from 3 to 1 is necessary. Please provide a Migration in the builder or call fallbackToDestructiveMigration in the builder in which case Room will re-create all of the tables. at android.arch.persistence

Update Listview after post new data from dialogfragment

Deadly 提交于 2020-01-03 00:00:38
问题 I am trying to update my listview directly after I submit new data from DialogFragment . But when I call notifyDataSetChanged() it give me an NullPointerException and my app is close. So this is the scenario what I want And this is my code This activity that I use to get data from the server public class LayoutActivity extends Fragment { private ListView listview; private ListItemAdapter theAdapter; String URL = "http://localhost/api/question/get_newest_except/0/0/15"; ProgressDialog pDialog;

Android: Download images from web and show them on gridview

有些话、适合烂在心里 提交于 2020-01-02 20:10:49
问题 I want to create a program that gets some images from a webpage, and shows them on a gridview. I dont know how many of them exactly. It could be from 20 to 30. Ill do it with asynctask, which i have allready used before and more or less know how it works. But i don't know which way use it this time. For now, what i would like to get is a progressbar (circle clicking) while image is downloading. And once its downloaded, it would disappear and image will load. I will use an array of objects

Strange behaviour in Android listview when loading images with asynctask

泪湿孤枕 提交于 2020-01-02 16:23:51
问题 I hope anyone can help me with the ListView problem I got.I have been slamming my head against a iron wall yesterday because i could not figure out what the problem was. It's not originally my project which makes it even harder. I got a listview where I wanna load rows of contacts in. On the left side of each row I wanna (Down)load an Image async. For this i am using the following ArrayAdapter and ListItem layout, please ignore the deprecated functions. Here is a video http://www.youtube.com

android app crashes when exceeded Thread pool 9 and queued tasks 128

那年仲夏 提交于 2020-01-02 16:15:13
问题 The application conduction api calls in every 10seconds with the gps location from the network provider. And also there are several api calls can be do by the user. application is crashing with law internet or less internet connection(device data access) is there a proper way to prevent app crashing and hold the api request till the internet network available. here im posting my crash reprort stacktrace java.util.concurrent.RejectedExecutionException: Task android.os.AsyncTask$3@4206a5b0