我正在尝试使用以下代码通过 URl 访问图像:
public class SingleListItem extends Activity{
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.setContentView(R.layout.details_list);
TextView txtProduct = (TextView) findViewById(R.id.name);
TextView txtLdesc = (TextView) findViewById(R.id.longdesc);
SmartImageView imgPreview = (SmartImageView) findViewById(R.id.preview);
imgPreview.setImageUrl(lpreview);
Intent i = getIntent();
// getting attached intent data
String product = i.getStringExtra("title");
String ldesc = i.getStringExtra("longdesc");
String lpreview = i.getStringExtra("preview");
// displaying selected product name
txtProduct.setText(product);
txtLdesc.setText(ldesc);
我正在传递另一个活动的“预览”值。这包含我要从中获取图像的 URL,但它与上一个活动中的用户选择不同。在imgPreview.setImageUrl
中,我想将其设置为 string lpreview
,而不是对其进行硬编码。