我在给布局膨胀之前遇到问题(即在布局中加载了实时摄像头)黑屏会出现。问题是布局需要加载实时摄像头。
我该如何管理这件事?
这是我的代码:
mydialog.dismiss();
try {
views.clear();
JSONObject jsonobject = new JSONObject(result);
Log.e("iserror is", "<><>" + jsonobject.getString("IsError"));
JSONArray jsonarray = jsonobject.getJSONArray("Cameras");
Log.e("array lenght is", "<><>" + jsonarray.length());
cameraslist.clear();
for (int i = 0; i < jsonarray.length(); i++) {
Cameras cameras = new Cameras();
cameras = gson.fromJson(jsonarray.getJSONObject(i)
.toString(), Cameras.class);
cameraslist.add(cameras);
}
if (jsonarray.length() == 0) {
rel_mainlayout.setVisibility(View.VISIBLE);
ll_homecameras.setVisibility(View.GONE);
} else{
rel_mainlayout.setVisibility(View.GONE);
ll_homecameras.setVisibility(View.VISIBLE);
inflateDynamicViewToLinearLayout(ll_homecameras,
cameraslist, position_onresume);
}
} catch (JSONException e) {
e.printStackTrace();
}
//mydialog.dismiss();
}
你能告诉我任何解决方案吗?还是建议?