毕加索主要错误

时间:2015-02-19 21:41:08

标签: android picasso

我正在尝试使用Picasso Android库,但我无法使其正常运行。

首先,我正在尝试最简单的事情:

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_basic_view);

    mImageView = (ImageView) findViewById(R.id.imageView);
    Picasso.with(this).setIndicatorsEnabled(true);
    Picasso.with(this).setLoggingEnabled(true);
    Picasso.with(this).load("http://i.imgur.com/DvpvklR.png").into(mImageView);
}

活动布局是:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<ImageView
    android:id="@+id/imageView"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#FF0000"/>
</RelativeLayout>

视图仍为红色。 如果我通过setImageResource在视图中设置资源,它会正确显示。

出现问题的唯一相关线索就是一条消息:

毕加索:主要错误

但我无法理解为什么。

我很乐意粘贴更多的logcat输出,但它会破坏代码块并变得不可读。

这是一个pastebin:main errored log

我相信我做错了一件微不足道的事。

1 个答案:

答案 0 :(得分:5)

要从互联网下载图像,您需要在清单中使用INTERNET权限。

<uses-permission android:name="android.permission.INTERNET" />