【发布时间】:2014-02-15 22:01:31
【问题描述】:
我想从资源中设置一个位图,但图像的名称是一个字符串。 我该如何设置它。我现在的代码是这样的。
String Nombre= results.getString(0);
RelativeLayout oneLayout = (RelativeLayout)findViewById(R.id.relative1);
ImageView imageView = new ImageView(getApplicationContext());
Bitmap bMap = BitmapFactory.decodeFile("res/drawable/"+Nombre);
Bitmap bMap = BitmapFactory.decodeResource(getResources(), R.drawable.Nombre);
imageView.setImageBitmap(bMap);
oneLayout.addView(imageView);
我知道这条线不工作:
Bitmap bMap = BitmapFactory.decodeResource(getResources(), R.drawable.Nombre);
我需要一个表格来做,欢迎任何帮助
【问题讨论】:
标签: android string bitmap imageview