简体   繁体   English

如何传输数据新意图

[英]How can I transfer data new intent

my Onbindview holder我的 Onbindview 支架

    Glide.with(holder.t1.getContext())
            .load("http://example/example/images/" +data.get(position).getImage()).into(holder.img);
}

And my interface还有我的界面

itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (iOtobusSaatleriInterface != null){
                    int position = getAdapterPosition();
                    if (position != RecyclerView.NO_POSITION);
                    iOtobusSaatleriInterface.onItemClick(position);
                    Intent intent = new Intent(context,deneme.class);
                    intent.putExtra("name",data.get(position).getName());
                    intent.putExtra("resim", String.valueOf(Glide.with(itemView)
                            .load("http://example/example/images/")));
                    
                    context.startActivity(intent);
                }
            }
        });

my new activity我的新活动

Intent intent = getIntent();
    String name = intent.getStringExtra("name");
    int goruntu = intent.getIntExtra("resim",0);
    imageView.setImageResource(goruntu);
    textView.setText(name);

finally my photo is not coming.最后我的照片不来了。 I just can't get the image data in the new activity.我只是无法在新活动中获取图像数据。 This data is registered in mysql and I am pulling from the directory with retrofit.此数据已在 mysql 中注册,我正在从目录中提取并进行改造。

New display新显示器

my imageview display我的图像视图显示

And my xml还有我的xml

您可以将图像作为字符串从屏幕 A 传递到屏幕 B。

Without knowing more about why you are trying to send a raster image over IPC between activities, I think the best advice I can give you is to not try to do that.在不了解您为何尝试在活动之间通过 IPC 发送光栅图像的更多信息的情况下,我认为我能给您的最佳建议是不要尝试这样做。

Instead, simply send the URL in the intent and have Activity 2 use glide to load and display the image.相反,只需发送意图中的 URL 并让 Activity 2 使用 glide 加载和显示图像。

The batter way is to pass full URL in intent as String and receive it on another Activity.击球手的方法是将意图中的完整 URL 作为字符串传递并在另一个 Activity 上接收它。

Intent intent = new Intent(context,deneme.class);
                    intent.putExtra("name",data.get(position).getName());
                    intent.putExtra("resim","YOUR_FULL_URL");

At Another Activity在另一个活动中

    Intent intent = getIntent();
        String name = intent.getStringExtra("name");
        String goruntu = intent.getStringExtra("resim");
    
String.valueOf(Glide.with(imageView)
                            .load(goruntu)
        textView.setText(name);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何转移图像新意图 - How can I transfer image new intent 我如何为某些意图传输不同的 .putextras? - How can I transfer different .putextras for some intent? 如何在 Intent intent = new Intent(mContext, c_Report_Activity.class); 处传递 putExtra; - How can I pass putExtra at Intent intent = new Intent(mContext, c_Report_Activity.class); 如何使用Intent.putParcelableArrayListExtra()方法和Parcelable接口,我只想在两个活动之间传输数据 - How to use Intent.putParcelableArrayListExtra() method and the Parcelable interface, I just want to transfer data in between two activity 意图对象如何在android中的两个Activity之间保持/传输数据? - How intent object keep/transfer data between two Activity in android? 如何使用Android注释通过Intent获得额外的数据? - How can I get extra data by Intent using Android annotation? 如何接收具有隐式意图的发送和接收多个数据? - How can I receive send and recieve multiple data with an implicit intent? 如何使用REST API生成数据时传输数据? - How can I transfer data while generating it using REST API? 如何在Liferay中的actionURL中传输搜索容器数据 - How can I transfer search container data in actionURL in Liferay 如何在一个 jframe 和另一个 jframe 之间传输数据? - How can I transfer data between one jframe to another jframe?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM