在android中执行插入语句时显示进度条的问题
在android中执行插入语句时显示进度条的问题。尽管 调用此 try 会阻止其显示空白屏幕。执行此语句时甚至没有调用 xml。
try {
while ((str = in.readLine()) != null) {
try {
db.execSQL(str);
} catch (Exception e) {
}
}
谢谢, 尤瓦拉吉
Problem in showing progress bar while executing insert statement in android. While
calling this try block its showing blank screen. Not even xml is called while executing this statement.
try {
while ((str = in.readLine()) != null) {
try {
db.execSQL(str);
} catch (Exception e) {
}
}
Thanks,
Yuvaraj
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
看起来您的代码正在 UI 线程中运行 - 因此只有在此代码运行后才会发生 UI 操作。将插入放入后台(例如通过
AsyncTask
)。It looks like your code is running in the UI thread - so a UI action will only happen after this code has run. Put the insert into background (e.g. via
AsyncTask
).将 AsyncTask 与 ProgressDialog 绑定使用,就像此处所做的那样。
Use AsyncTask with ProgressDialog bounded, like it is done here.
请使用Handler或AsyncTask来处理后台操作
请通过以下链接
http://saeedsiam.blogspot.com/2009/02/first-look-into-android-thread.html
Kindly use Handler or AsyncTask to handle operations in background
Go through the following link
http://saeedsiam.blogspot.com/2009/02/first-look-into-android-thread.html