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中,我想将其设置为字符串lpreview,而不是对其进行硬编码。
2013-03-30
nmiltner
+0
我看错上面的代码中的唯一的事情是,你需要充分利用额外的字符串之后调用setImageUrl。什么不使用它? –
+0
你已经从上一个活动中获得了这个权利吗?它根本没有硬编码。只需要将'imgPreview.setImageUrl(lpreview);'移动到这行代码的下面:String lpreview = i.getStringExtra(“preview”);'。 –
+0
感谢您的答案,我现在就试试。我尝试了早些时候的重组,并没有奏效。我会再尝试。那么,工作!感谢大家!不知道我以前出错的地方。哦,谢谢你帮助新手! –