i am developing reminder application for taking tablet. I just store list of tablets to be taken on everyday in database with date and time
. Everyday, my application should check, is there any tablet to be taken on this particular date
( 开发者_如何学Gotoday) if so, it has to fetch the time to show that tablet details. when a particular time comes, it has to show dialog box which contains list of tablets from db.
To do this i am using Remote service which will get system current date and check with database. i have to show dialog box( shows list of tablet details from db).
in remote service i have thread which runs every 10 sec to check for current date and match with db date. now i am unable to show AlertBox
to show the task with description.
how to show the AlertBox in Remote Service. i tried in this way.... when i create alertbox, i need to pass Context as param, it shows
android.view.WindowManager$BadTokenException:....
Is it correct way? or from remote service, shall I call activity which shows dialogbox?
How to solve my problem.
A service doesn't have any UI elements, so can't show a dialog box. You can either call an activity that does have a UI (your suggestion) or it might be better to create a notification which is the preferred option for Android alerts.
精彩评论