android


is there a way to load a default image in picasso


i cannot load an image in picasso from my drawable due to resons known only to picasso, so whever picasso fails to load i want to load a default image please help
#Override
public Object instantiateItem(ViewGroup container, final int position) {
final Context context =getApplicationContext();
final ImageView imageView = new ImageView(getApplicationContext());
int padding = context.getResources().getDimensionPixelSize(
R.dimen.padding_medium);
imageView.setPadding(padding, padding, padding, padding);
PicassoTools.clearCache(Picasso.with(context));
((ViewPager) container).addView(imageView, 0);
imageView.setTag("myview" + position);
Picasso.with(context).load(mImages[position]).resize(320,280).centerInside().placeholder(placeholderDrawable)
.into(imageView,new Callback() {
#Override
public void onError() {
// TODO Auto-generated method stub
imageView.setImageResource(R.drawable.c3);
}
#Override
public void onSuccess() {
// TODO Auto-generated method stub
}
});
iv included callback in the hope to do something but my brain is not working, any1 help
Picasso.with(context).load(www.google.com/image/1).placeholder(context.getResources().getDrawable(R.drawable.default_person_image)).error(context.getResources().getDrawable(R.drawable.default_person_image)).into(pictureView);
This is what i'm currently using (placeholder URL of course). It will try and load the image you provide in the "load()" part, will show the "placeholder()" part before it has downloaded the image, and if it fails it will show the "error()" part.
Personally i have both the placeholder() and error() part to show the same image, but you can load two different images.

Related Links

How to communicate via modbus RTU on android through micro USB port?
CWAC Camera shows a black blank screen and application crashes while taking picture
Create window manager pop only on call answer screen (not always on i.e when back to call answer screen it must be hide)
Change existing layout in Android programmatically
Material effect on button with background color
Reset alignment in holder in viewholder pattern
Android- Unfortunately App has stopped
only one gcm notification open when android app is close
How to fix missing jar files issue in android projects
why got a nullpointexception when one instance of message called many times sendtotarget
Error on a line on third iteration of cycling through fragments
How to set default custom ringtone to a specific contact
Cordova / Phonegap for Android doesn't display youtube iFrame API
Is it possible to start an Android Service from a BroadcastReceiver?
Restoring Saved ActionBar optiong chosen setting state when Accessing the Appl after exit
Locking the CPU on android for app performance testing

Categories

HOME
css3
toolbox
fftw
visual-studio-emulator
nested-if
polling
python-multithreading
mvc5
spin
heap
pega
android-securityexception
xcodebuild
openbugs
keytool
azure-iot-hub
red5
shortest-path
parcelable
pimcore
object-storage
zxing
game-theory
pylons
oculus
rpgle
quantlib
zend-debugger
erb
rselenium
wacom
graphhopper
cd
recurrent-neural-network
urlsession
spring-mvc-test
hackintosh
preloader
outputcache
apollostack
knime
berkeley-db-je
httr
ntvs
static-cast
jqchart
dt
seq
java-websocket
materialized-path-pattern
cudd
cubism.js
parfor
preprocessor
mongodb-php
hclust
dup
delta
cifilter
database-relations
highland.js
pypiserver
jdi
microsoft-reporting
flock
zen-cart
sha512
cwrsync
android-broadcast
code-documentation
codeplex
live555
malformedurlexception
ray
paste
clickbank
drupal-nodes
git-repo
artemis
script#
merb
mantle
stacky
asplinkbutton
tree-balancing
monotouch.dialog
paginator
ikimagebrowserview
rmdir
event-receiver
objective-j
vs-android
addchild
strtod
alsb

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App