Skip to content

Instantly share code, notes, and snippets.

Created August 27, 2014 10:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/1867c0528d3f08ddcbe3 to your computer and use it in GitHub Desktop.
Save anonymous/1867c0528d3f08ddcbe3 to your computer and use it in GitHub Desktop.
数据库操作的执行时间
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.show_content_layout);
TextView tvTitle = (TextView) findViewById(R.id.title);
final TextView tvContent = (TextView) findViewById(R.id.content);
tvTitle.setText(R.string.databaseTitle);
progressDialog = CustomProgressDialog.createDialog(this);
progressDialog.setMessage(R.string.processDialog);
progressDialog.setCanceledOnTouchOutside(true);
progressDialog.show();
progressDialog.setOnCancelListener(new OnCancelListener() {
@Override
public void onCancel(DialogInterface arg0) {
progressDialog.dismiss();
}
});
new Thread(){
public void run(){
Test.testDatabase(DatabaseDemo.this);
DatabaseDemo.this.runOnUiThread(new Runnable(){
@Override
public void run() {
if (progressDialog != null && progressDialog.isShowing()) {
progressDialog.dismiss();
}
tvContent.setText(R.string.databaseContent);
}
});
};
}.start();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment