大家好,通过下面的方法,我可以毫无问题地发送任何自定义参数。现在我想将此方法更改为 AsyncTask 类,名称为 LongOperation
,但我不知道如何将 getRequestFromServer
方法参数发送到 AsyncTask
我的方法是:
public static void getRequestFromServer(final long lastID, final int count,
final ContentResolver cr){
我想要这样的:
private class LongOperation extends AsyncTask<final long lastID, final int count,
final ContentResolver cr> {
最佳答案
private class LongOperation extends AsyncTask<Void, Void, Void> {
long lastID;
int count;
ContentResolver cr;
public LongOperation(final long lastID, final int count,
final ContentResolver cr){
this.lastID = lastID;
this.count = count;
this.cr = cr;
}
使用它:
new LongOperation(LAST_ID,COUNT,CR).execute();
关于java - Android 在 AsyncTask 上发送自定义参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27718782/