Created
August 27, 2014 10:35
-
-
Save anonymous/1867c0528d3f08ddcbe3 to your computer and use it in GitHub Desktop.
数据库操作的执行时间
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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