I'm writing an app which loads a picture from a URL and display in an imageview.
here is the code...
public class MainActivity extends Activity {
private Picasso picasso;
private OkHttpClient okHttpClient;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ImageView imageview = (ImageView) findViewById(R.id.imageView);
String image_url ="http://www.empireonline.com/images/uploaded/wreck-it-ralph-box-office.jpg";
okHttpClient = new OkHttpClient();
picasso = new Picasso.Builder(this)
.downloader(new OkHttpDownloader(okHttpClient))
.build();
Context con = getApplicationContext();
picasso.with(con)
.load(image_url)
.placeholder(R.drawable.ic_launcher)
.resize(60,60)
.into(imageview);
}
The app doesn't crash but it does not show the picture either! in the LogCat i've got these 2 errors:
09-15 13:17:17.419 2358-2358/**************** E/OpenGLRenderer﹕ Getting MAX_TEXTURE_SIZE from GradienCache
09-15 13:17:17.439 2358-2358/**************** E/OpenGLRenderer﹕ Getting MAX_TEXTURE_SIZE from Caches::initConstraints()
I'm using Genymotion 2.0.1 . Can u plz help me???
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…