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

Detecting beacons more efficiency
Android - Google analytics INSTALL_REFERRER not firing
A simple way to distinguish between a fast and a slow android device [closed]
Android and windows application communication
Phonegap app playing mp3 using Media plugin does not work
Pre fetching Images using Glide in android
Alpha testing in Google play and Authentication problems
Universal Image Loader: Get Original height and width onClick
Toolbar and DialogFragment in android
Ionic CLI error while adding plugin
Make EditBoxes not related to each other
How to get the current frame (as a Bitmap) for android facedetector in a Tracker event?
LayoutManager.smoothScrollToPosition works only after ui scroll
Can not access com.codename1.impl.android.AndroidNativeUtil From nativeInterface
How do we set color to an underline for text in textView programatically
Vector Drawables vs Bitmap in terms of RAM (Android)

Categories

HOME
design-patterns
checkstyle
spark-streaming
developer-tools
string
webdriver
numbers
apache-spark-mllib
jwplayer
seo
carousel
soa
switch-statement
google-apps
rds
visual-studio-emulator
gluon-mobile
opengl-3
lanczos
flume
teechart
pega
datastage
docx
video-editing
sse
connector
react-toolbox
pchart
highstock
beta
draft-js-plugins
amazon-quicksight
ms-access-2003
fractions
linked-data
firebase-analytics
userdefaults
dotspatial
livelink
dst
deltaspike
rselenium
yowsup
apiary.io
swagger-php
playframework-2.1
signals-slots
xv6
levenshtein-distance
android-ibeacon
dbnull
plr
oracle-service-bus
xmldocument
photos
textsum
bluez
jqchart
er-diagram
reshape
cd-burning
baidu
django-1.10
rmongo
pytables
signalr.client
sklearn-pandas
nio2
kendo-upload
exim4
jparsec
blitline
jnlua
grgit
morton-number
fuelcms
zscript
pyobjc
alloy-ui
google-refine
uvc
dot.js
adehabitathr
punycode
linkedin-jsapi
mdichild
reflector
dot42
buffering
vsx
authlogic
file-not-found
twitter-bootstrap-rails
breakout
mongohq
resource-management
fragmenttransaction
web-farm
failing-tests
workflow-services
clrstoredprocedure
timertask
facebook-iframe
folding
linfu-dynamicproxy
dsoframer

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