该代码如何无法启动汽车的doInBackground实现。我错过了什么吗?我不是在谈论异常或崩溃,它永远不会被执行。
这是我的代码段:
FourWheels.java
public abstract class FourWheels<Params, Progress, Result> extends AsyncTask<Params, Progress, Result> {
@Override
protected abstract Result doInBackground(Params... params);
}
Car.java
public class Car extends FourWheels<Void, Void, String> {
@Override
protected String doInBackground(Void... params)
{
String dummy = "dummy";
return dummy;
}
}
MainActivity.java
Car car = new Car();
FourWheels fourwheels = (FourWheels)car;
fourwheels.execute(); // This should call doInBackground from Car...