Is it possible to give a name to an AsyncTask's background thread, as for normal Threads in Java:
Thread(Runnable target, String name)
I have seen the code of AsyncTask and the default constructor is just give a name by default
private static final ThreadFactory sThreadFactory = new ThreadFactory() {
private final AtomicInteger mCount = new AtomicInteger(1);
public Thread newThread(Runnable r) {
return new Thread(r, "AsyncTask #" + mCount.getAndIncrement());
}
};
I want to do that, as when I debug I want to know which Asynctask is accessing a method in a helper class.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…