android - Change the return type in Asynctask -
i want write async task homecoming custom object.
@override protected string doinbackground(string... stations) { path pt= dosearch(source.gettext().tostring(),destination.gettext().tostring()); homecoming pt; } @override protected void onpostexecute(string result) { }
is possible homecoming object of class path
doinbackground()
function , utilize object in onpostexecute()
method?
just alter type of result
asynctask
sample:
private class viewasyntask extends asynctask<string, void, path> { @override protected path doinbackground(string... stations) { path pt= dosearch(source.gettext().tostring(),destination.gettext().tostring()); homecoming pt; } @override protected void onpostexecute(path result) { } }
as see asynctask<void, void, path>
, path means result
value of doinbackground
as documentation of it:
1. params, type of parameters sent task upon execution. 2. progress, type of progress units published during background computation. 3. result, type of result of background computation.
android android-asynctask
No comments:
Post a Comment