下面给出的是(onCreate)代码,用于在我的Android应用程序的屏幕上显示一些信息。此活动将加载到另一个活动中触发的事件中。问题是加载此屏幕时。它首先加载空白屏幕,然后延迟呈现相关文本。最终用户可以注意到这种延迟,这让他们觉得屏幕加载了两次。对此有什么解决方案吗?
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_end);
CommonUtils.changeActionBarColor(getSupportActionBar());
//get the respective child object which has to be displayed in the GUI
String childObjectKey = getIntent().getStringExtra(CHILD_OBJECT_KEY);
// Single method pop(), for both pushWeak() and pushStrong()
endObject = (IPEnd) ASFObjectStore.getDefault().pop(childObjectKey);
this.setTitle(endObject.getPathwayName());
//endWebView
WebView endWebView=(WebView)findViewById(R.id.endWebView);
String tempEndString = HTMLConverter.changeFontSize(endObject.getEndText(), UtilConstants.GLOBAL_FONT_SIZE);
tempEndString = HTMLConverter.changeFontFamily(tempEndString,UtilConstants.GLOBAL_FONT_FAMILY);
endWebView.loadData(tempEndString,"text/html;charset=utf-8","UTF-8");
//overall image button
ImageButton overviewButton = (ImageButton) findViewById(R.id.endOverviewImageButton);
overviewButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//showOverviewImage("Bleeding (First Trimester).jpg");
LayoutInflater layoutInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = layoutInflater.inflate(R.layout.image_popup, (ViewGroup) findViewById(R.id.popup_element));
Button btnClosePopup = (Button) view.findViewById(R.id.cancel_button);
String imageFileName = endObject.getPathwayName()+ UtilConstants.IMAGE_FILE_EXTENSION;
CommonUtils utils = new CommonUtils();
utils.showOverviewImage(imageFileName, getWindowManager(), getApplicationContext(), layoutInflater, view,End.this);
}
});
}