【发布时间】:2018-05-14 22:35:55
【问题描述】:
我正在尝试在我的 Activity 上显示来自我的 DataObject 的数据。一切正常,不会在任何地方崩溃,但我的视图没有随信息更新。 我是android的初学者,我知道这个...... 请问有人可以帮我吗?谢谢
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_detail);
LayoutInflater inflater = LayoutInflater.from(DetailActivity.this);
vp = (RelativeLayout)inflater.inflate(R.layout.activity_detail, null);
String object_id = getIntent().getStringExtra("getIn"); // Get object_id from Intent
DataQuery query = DataQuery.get("Id");
query.getInBackground(object_id, new GetCallback<DataObject>() {
@Override
public void done(DataObject object, DataException e) {
if (e == null) {
TextView price = (TextView)vp.findViewById(R.id.priceD);
price.setText((String) object.get("price"));
TextView productD = (TextView)vp.findViewById(R.id.productD);
productD.setText((String) object.get("product"));
ImageView thumbnail= (ImageView)vp.findViewById(R.id.thumbnail2);
thumbnail.setImageBitmap((Bitmap) object.get("image"));
TextView descriptionD = (TextView)vp.findViewById(R.id.description );
descriptionD.setText((String) object.get("description"));
// }
} else {
// Error
}
}
});
【问题讨论】:
-
你确定,
e不为空并且调用了 done 方法吗?尝试使用 logcat 获取结果。 -
我确定,因为我调试应用程序,我看到每个变量的数据,但我看到,在方法集文本中,但活动不刷新...跨度>
标签: android android-activity background