标签: picasso

毕加索大图下载

我读过有关Picasso图像下载lib但有一个问题我无法解决它.这是大图像下载.当我有大图像,即2000 x 1920时,它被压碎(内存不足).

我怎么能解决这个问题?

Picasso.with(上下文).load(myUrl).into(ImageView的);

android bitmap imagedownload picasso android-bitmap

2
推荐指数
1
解决办法
3248
查看次数

使用毕加索获取用户的Facebook个人资料照片

我正在使用Parse作为后端,我试图获取用户个人资料图片并显示它.我不想使用ProfilePictureView,因为我使用gridview也显示其他imageViews.如你所见,我也在使用gravater api.

所以问题是:它不会显示个人资料图片,只显示占位符图片(gravatar工作正常并显示),我做错了什么?

   ParseUser user = mUsers.get(position);
            String email;
            if (user.getEmail() == null) { // this is how i check if its a facebook
                                            // user

                ParseUser currentUser = user;
                if (currentUser.get(ParseConstants.KEY_FACEBOOK_DETAILS) != null) {
                    JSONObject userProfile = currentUser
                            .getJSONObject(ParseConstants.KEY_FACEBOOK_DETAILS);
                    try {
                        if (userProfile.getString("facebookId") != null) {
                            String facebookId = userProfile.get("facebookId")
                                    .toString();
                            String facebookName = userProfile.getString("name");
                            holder.nameLabel.setText(facebookName);
                            // holder.userImageView.setProfileId(facebookId);
                            String facebookProfilePicUrl = "http://graph.facebook.com/"
                                    + facebookId + "/picture";

                            Picasso.with(mContext).load(facebookProfilePicUrl)
                                    .placeholder(R.drawable.avatar_empty)
                                    .into(holder.userImageView);
                        }
                    } catch (JSONException e) {
                        // TODO Auto-generated catch …
Run Code Online (Sandbox Code Playgroud)

android gravatar facebook-graph-api picasso

2
推荐指数
1
解决办法
2431
查看次数

为什么Picasso在后台线程中运行阻止onActivityResult?

我们正在为应用中的照片创建共享模式,其中一个共享选项是在线加载图像的叠加层.如果用户在叠加完成加载之前共享照片,我们将使用未修改的图像发送意图以使用startActivityForResult与其他应用共享,然后在onActivityResult中,我们将用户从共享视图返回到普通照片视图.

我们遇到的问题是,当用户从共享照片返回时,在加载覆盖的后台线程完成之前,不会调用onActivityResult.是否有原因导致后台线程突然开始阻止UI线程?

以下是我们在overlay视图类中使用的代码,它扩展了ImageView来管理它:

private void asyncLoadImage() {
    new Thread(new Runnable() {
        @Override
        public void run() {
            loadImage();
        }
    }).start();
}

private void loadImage() {
    try {
        overlayBitmap = Picasso.with(getContext()).load(url).get();
        if (overlayBitmap != null) {
            displayBitmap();
        } else {
            displayError();
        }

    } catch (IOException ignored) {
        displayError();
    }
}
Run Code Online (Sandbox Code Playgroud)

我们已经尝试过使用Picasso目标,而不是创建我们自己的线程,我们遇到了完全相同的问题,到目前为止唯一的解决方案是异步使用Ion(但是,在我们之前使用Ion同步或尝试取消Ion请求期货调用startActivityForResult导致相同的UI线程阻塞问题).这感觉就像一个巨大的黑客,因为我们在应用程序中的其他地方使用毕加索.

这些后台任务在返回活动时是否会阻止UI线程?

multithreading android picasso

2
推荐指数
1
解决办法
3154
查看次数

在 Picasso 库中,当我的图像被加载时,我现在如何触发哪个事件侦听器?

大家好,我在 android 项目中使用毕加索,现在我的问题是我需要在毕加索正在加载的图像上显示一些内容,这就是为什么我想知道我如何知道毕加索何时加载了图像,因为只有这样我才能在该图像上添加文本。此外,如果 picasso 不提供此功能,那么在 android 中使用 picassso 是否还有其他方法可以做到这一点

Picasso.with(context).load("http://192.168.0.15:1337/offers/" + image_url.get(position)).resize(350, 100).centerCrop().into(holder.imageView);
Run Code Online (Sandbox Code Playgroud)

现在在哪里设置图像上的文本。

android picasso

2
推荐指数
1
解决办法
1085
查看次数

毕加索只缓存原始下载图像的大小吗?

我读了一些关于这个问题的内容,但我也不明白:

1:如果我.resize(x,y)的代码中有图像,那么Picasso只会缓存原始大小或调整大小的大小吗?

2:内存和磁盘缓存是否存储不同的缓存密钥?

android picasso

2
推荐指数
1
解决办法
1213
查看次数

找不到com.squareup.picasso:picasso:2.5.3-SNAPSHOT

我想编译com.squareup.picasso:picasso:2.5.3-SNAPSHOT.但我得到了这个错误:

Error:Could not find com.squareup.picasso:picasso:2.5.3-SNAPSHOT.
Required by:
    familywall-android:app:unspecified
<a href="searchInBuildFiles">Search in build.gradle files</a>
Run Code Online (Sandbox Code Playgroud)

有人经历过类似的事吗?

android picasso

2
推荐指数
1
解决办法
2501
查看次数

毕加索图片没有加载自定义infoWindow为什么?

我正在尝试以编程方式布局自定义infoWindow.我想使用Picasso加载一个streetView预览图像,但图像没有显示出来,任何想法为什么?

private View prepareInfoView(Marker marker){
    //prepare InfoView programmatically
    LinearLayout infoView = new LinearLayout(EarthquakeActivity.this);
    LinearLayout.LayoutParams infoViewParams = new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
    infoView.setOrientation(LinearLayout.VERTICAL);
    // attach the above layout to the infoView
    infoView.setLayoutParams(infoViewParams);

    //create street view preview @ top
    ImageView streetViewPreviewIV = new ImageView(EarthquakeActivity.this);
    // this scales the image to match parents WIDTH?, but retain image's height??
    LinearLayout.LayoutParams streetViewImageViewParams = new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
    streetViewPreviewIV.setLayoutParams(streetViewImageViewParams);

    String imageURL = "https://maps.googleapis.com/maps/api/streetview?size=200x200&location=";
    String markerLongitude = Double.toString(marker.getPosition().longitude);
    String markerLatitude = Double.toString(marker.getPosition().latitude);
    imageURL += markerLatitude + "," + …
Run Code Online (Sandbox Code Playgroud)

android google-maps infowindow picasso

2
推荐指数
2
解决办法
1859
查看次数

滚动后,RecyclerView和Picasso图像消失

我没有找到答案在这里,这里这里.

我有一个活动显示帖子列表(有或没有图像).当我向下滚动并向上滚动或刷新列表时,SwipeRefreshLayout某些图像可能会消失.我RecyclerView用来显示帖子列表和Picasso加载图像.这是我的适配器绑定:

@Override
public void onBindViewHolder(ItemViewHolder holder, int position) {
    // <...>
    if (item.getPhoto() != null) {
        Picasso.with(context)
                .load(item.getPhoto())
                .into(holder.mPostPhoto);
    } else {
        holder.mPostPhoto.setImageDrawable(null);
        holder.mPostPhoto.setVisibility(View.GONE);
    }
}
Run Code Online (Sandbox Code Playgroud)

我发送HTTP请求以获取帖子,当我有新数据时,我调用PostsAdapter:

public void addAll(List<PostResponse> items) {
    this.items.clear();
    this.items.addAll(items);

    notifyDataSetChanged();
}
Run Code Online (Sandbox Code Playgroud)

在MainActivity中:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    // <...>
    mPostAdapter = new PostAdapter();
    mPosts.setLayoutManager(new LinearLayoutManager(MainActivity.this));
    mPosts.setAdapter(mPostAdapter);

    mPostsSwipeRefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            updatePosts();
        }
    }); …
Run Code Online (Sandbox Code Playgroud)

android imageview android-imageview picasso android-recyclerview

2
推荐指数
2
解决办法
3195
查看次数

当我使用fit()时Android Picasso没有加载图片

没有fit()它工作正常.
.Picasso.with(getApplicationContext())的负载(url.concat(featureImage))代入(ImageView的).

ImageView imageView = (ImageView)findViewById(R.id.featureImage);
TextView textTitle = (TextView)findViewById(R.id.title);
TextView textDetail = (TextView)findViewById(R.id.detail); 
 Picasso.with(getApplicationContext()).load(url.concat(featureImage)).fit().into(imageView);
textTitle.setText(title);
textDetail.setText(detail);
Run Code Online (Sandbox Code Playgroud)

android android-imageview picasso

2
推荐指数
1
解决办法
1464
查看次数

毕加索-如何加载矢量可绘制?

我正在尝试使用Picasso库加载矢量可绘制

    Picasso.get().load(R.drawable.project).into(image3a, new Callback() {
        @Override
        public void onSuccess() {

        }

        @Override
        public void onError(Exception e) {

        }
    });
Run Code Online (Sandbox Code Playgroud)

在onError方法中,获取此异常:

java.lang.NullPointerException:位图== null

当我使用Glide加载图像时,它显示图像:

 Glide.with(this).load(R.drawable.project).into(image3b);
Run Code Online (Sandbox Code Playgroud)

我的问题:如何使用Picasso加载矢量可绘制对象?

android picasso

2
推荐指数
1
解决办法
1375
查看次数