私はアンドロイドを学んでいて、次のような例に出くわしました
public static class A extends IntentService {
public A() {
super("AppWidget$A");
}
}
スーパークラス(IntentService)のコンストラクターを明示的に呼び出す必要がある理由を教えてください。パラメータ文字列は何を意味しますか?
私はアンドロイドを学んでいて、次のような例に出くわしました
public static class A extends IntentService {
public A() {
super("AppWidget$A");
}
}
スーパークラス(IntentService)のコンストラクターを明示的に呼び出す必要がある理由を教えてください。パラメータ文字列は何を意味しますか?
デバッグのみに使用されます。これを使用する IntentService ソース コードの一部を次に示します。
public abstract class IntentService extends Service {
...
private String mName;
...
/**
* Creates an IntentService. Invoked by your subclass's constructor.
*
* @param name Used to name the worker thread, important only for debugging.
*/
public IntentService(String name) {
super();
mName = name;
}
...
@Override
public void onCreate() {
super.onCreate();
HandlerThread thread = new HandlerThread("IntentService[" + mName + "]");
thread.start();
mServiceLooper = thread.getLooper();
mServiceHandler = new ServiceHandler(mServiceLooper);
}
...
}