I am new to Java, but I need to write something like this code in C # (this is a prototype printed by hand to illustrate what I need)
private void ParentFunc() { var worker = new WorkerClass() worker.DoWork(e => console.Write("Progress" + e)); } public class WorkerClass() { public method DoWork(Action<int> callback) { for (int i=1; i<1000; i++) callback.Invoke(i); } }
A little explanation. I use AsyncTask
in android and calling an external class, classified, but would like them to return a signal so that I can publishProgress
. I prefer not to install the interface on top of AsyncTask
katit source share