android


How can I resuse the same Asynctask class for returning different data types?


Is there a generic type of signature when extending the Asynctask class ; smthg like ; Asynctask<String,Void,<generictypehere>> so as to enable to cast the return the result value from the thread and be able to cast the returned value to any daa I wish? For instance I want to be able to use the same asynctask class which creates HttpUrlConnections to different urls ,passed as parameters to the class, and sometimes I want to download html code which is String type and sometimes Bitmap, depending on the url.
Is it possible? if so how?
Thanks
It is possible. Use a generic class.
E.g.
class MyAsyncTask<ReturnType> extends AsyncTask<String,Void,ReturnType> {

Related Links

Android: ArrayList Move Item to Position 0
How can I verify image URI is valid in Android?
Android emulator-arm.exe failed to launch a virtual device
android vertical gallery..?
Android market publish problem
changeing image file resoultion in android
Facebook wall post from multiple Activities
still didnt get #android:id/list vs #+id/listView1
will Activity class scope field variables be accessible in AsyncTask if parent Activity finish()
Best way to get a location in an android list view
Activity state android
Android: What to do if performance of ListView is still not enough?
getResourceId finds no ID in custom control
Can a MapView be placed inside a ViewFlipper somehow?
how to change background image for a selected text in a gallery in android?
android how to optimize application code through Progaurd

Categories

HOME
url-redirection
nvd3.js
wakanda
pda
object
datastore
mjml
hessian
grafana
rds
data-visualization
32bit-64bit
vimdiff
android-securityexception
ipmitool
spring-social
frequency-distribution
symmetricds
symbol
http-post
linear-algebra
alpacajs
dynamic-sql
standards
asp.net-mvc-viewmodel
google-container-registry
user-experience
kendo-mobile
spring-async
systemtime
inno-download-plugin
epsilon
definitelytyped
bulletphysics
pylons
fragment-backstack
has-and-belongs-to-many
apktool
linked-data
openmdao
corenlp-server
aws-codecommit
hibernate-validator
rselenium
fiware-cygnus
engine.io
protege4
python-pptx
android-augmented-reality
protein-database
filesystemwatcher
xv6
glm-math
avcapturedevice
show-hide
configurationmanager
geotiff
custom-font
android-testing
arules
pdf-conversion
gpg-signature
structuremap4
renaming
donations
mapxtreme
stax
custom-lists
builtins
redbeard-ios
xcode-server
i386
expectations
directdraw
microsoft-reporting
poppler
finalbuilder
nsurlsessiondatatask
osc
grouping-sets
apache-spark-1.3
pseudo-class
formview
machine-instruction
wcm
lambda-architecture
multiautocompletetextview
drupal-nodes
windows-embedded-standard
cocoalibspotify-2.0
time.h
pclzip
composite-component
intersect
veracity
webdev.webserver
lr
entitydatasource
uipagecontrol
strsep
ie-compatibility-mode
addchild
cuda.net
java1.4

Resources

Encrypt Message