我现在做的是日历,将设定的日程存储在数据库,我这样处理的,开机监听数据库,将获取的时间和当前时间比较,相等就提示信息
我想用对话框的形式显示信息,现在的效果是,对话框和Activity绑定在了一起,
我想实现的效果是将弹出的对话框悬浮在当前界面(随便哪个界面)上而独立存在希望大家多提点意见!
我想用对话框的形式显示信息,现在的效果是,对话框和Activity绑定在了一起,
我想实现的效果是将弹出的对话框悬浮在当前界面(随便哪个界面)上而独立存在希望大家多提点意见!
解决方案 »
- mediaplayer 播放本地mp3文件报错
- 如何动态设置listview的行高 ??
- 本地语音识别怎么弄?
- Sourceinsight显示问题求救
- 项目中assets文件夹中有个data.xml文件!
- 如何将WIFI扫描到的信息自动添加到sqlite
- 通过USB 传输数据,请大侠赐教!谢谢!
- 请问关于运行程序,提示activity没有找到的问题
- Vitamio视频播放报错Couldn't load vinit from loader dalvik.system.PathClassLoader[DexPa
- gradle project sync failed.basic functionality will not work properly
- android 3个线程只会执行其中固定的两个,另外一个不会执行
- 求助,從服務器下載圖片到本地的問題
“ Unable to start receiver com.date.BootReceiver: android.database.sqlite.SQLiteException: unable to open database file”
但有时候又可以,不知道怎样才能解决这个问题
// Restore preferences
//MODE_WORLD_READABLE
//MODE_WORLD_WIRTEABLE
SharedPreferences settings = getSharedPreferences(SETTING_INFOS,MODE_WORLD_READABLE);
只加了操作外部存储的权限
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
忘了加开机启动的权限:
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
Context mContext = DateAlert.this;
LayoutInflater mLayoutInflater = (LayoutInflater) mContext.getSystemService(LAYOUT_INFLATER_SERVICE);
View music_popunwindwow = mLayoutInflater.inflate(R.layout.dialog, null);
PopupWindow mPopupWindow = new PopupWindow(music_popunwindwow,
LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
mPopupWindow.showAtLocation(findViewById(R.id.main), Gravity.CENTER, 0, 0); showAtLocation()的第一个参数通过findById绑定了一个界面我做的是在BroadcastReceiver里面用定时器控制:
核心代码如下:
private Handler handler = new Handler();
private Runnable task = new Runnable(){
public void run() {
handler.postDelayed(task,1000);
list(); //从数据库中获取信息
getCurrentTime(); //得到当前时间
//格式化当前日期、时间
String currentTime = Y + "-" + format(M) + "-" + format(D) + " " + format(h) + ":" + format(m);
for(int i = 0;i < list.size();i ++){
if(currentTime.equals(remind_date + " " + remind_time)){
//在这里进行处理,弹出一个信息显示的界面 }
}
}
};效果就和Android手机关机界面一样,不管当前处于哪个界面,只要长按关机键,就会在当前界面上显示一个悬浮的信息窗口!
Context mContext = DateAlert.this;
LayoutInflater mLayoutInflater = (LayoutInflater) mContext.getSystemService(LAYOUT_INFLATER_SERVICE);
View music_popunwindwow = mLayoutInflater.inflate(R.layout.dialog, null);
PopupWindow mPopupWindow = new PopupWindow(music_popunwindwow,
LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
mPopupWindow.showAtLocation(findViewById(R.id.main), Gravity.CENTER, 0, 0); showAtLocation()的第一个参数通过findById绑定了一个界面我做的是在BroadcastReceiver里面用定时器控制:
核心代码如下:
private Handler handler = new Handler();
private Runnable task = new Runnable(){
public void run() {
handler.postDelayed(task,1000);
list(); //从数据库中获取信息
getCurrentTime(); //得到当前时间
//格式化当前日期、时间
String currentTime = Y + "-" + format(M) + "-" + format(D) + " " + format(h) + ":" + format(m);
for(int i = 0;i < list.size();i ++){
if(currentTime.equals(remind_date + " " + remind_time)){
//在这里进行处理,弹出一个信息显示的界面 }
}
}
};效果就和Android手机关机界面一样,不管当前处于哪个界面,只要长按关机键,就会在当前界面上显示一个悬浮的信息窗口!