• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
 






♂小旭

 
 

Powered by 博客园
博客园 | 首页 | 新随笔 | 联系 | 订阅 订阅 | 管理
上一页 1 ··· 4 5 6 7 8

2013年4月17日

Android中的SQLite数据库
摘要: //创建数据库,数据库名称为mydata.dbDatabaseHelper dbHelper = new DatabaseHelper(MyActivity.this, "mydata.db");SQLiteDatabase db = dbHelper.getReadableDatabase();p... 阅读全文
posted @ 2013-04-17 11:03 ♂小旭 阅读(6438) 评论(0) 推荐(0)
 
Android中的定时器
摘要: Timer mTimer = new Timer();mTimer.schedule(new TimerTask() { @Override public void run() { //要执行的操作 } }, 5*1000, 10*1000); //调用 schedule() 方法后,要等待5s才第一次执行 run() 方法,之后每隔10s执行一次 //停止定时器mTimer.cancel(); 本人发布的内容均为学习中用过的代码,上传主要为了方便以后的复习和为他人提供一些方便,一些代码没有上下文,新学的朋友有不... 阅读全文
posted @ 2013-04-17 10:39 ♂小旭 阅读(279) 评论(0) 推荐(0)
 
Android中弹出提示框
摘要: AlertDialog.Builder alertbBuilder=new AlertDialog.Builder(当前Activity.this);alertbBuilder.setTitle("提示").setMessage("确认退出?").setPositiveButton("确定", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { //确定后... 阅读全文
posted @ 2013-04-17 10:36 ♂小旭 阅读(4146) 评论(0) 推荐(0)
 
Android中使用GPS时若未打开则跳至GPS设置界面
摘要: LocationManager locationManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);//若GPS未打开,跳转到GPS设置页面if (!(locationManager.isProviderEnabled(android.location.LocationManager.GPS_PROVIDER))){ //下面括号内的字符串也可以改为“gps” startActivity(new Intent("android.settings.LOCATION_SOURCE_SETTINGS&q 阅读全文
posted @ 2013-04-17 10:22 ♂小旭 阅读(1443) 评论(0) 推荐(0)
 
Android中GPS定位获取当前坐标
摘要: LocationManager locationManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);//括号中的0,0分别表示每隔多长时间和每隔多长距离进行一次定位locationManager.requestL... 阅读全文
posted @ 2013-04-17 10:18 ♂小旭 阅读(882) 评论(0) 推荐(0)
 
Android中判断Service是否运行
摘要: if (isServiceStarted(MyCurrentActivity.this, "包名")){ txtStatus.setText("正在运行"); } else{ txtStatus.setText("未运行"); }public static boolean isServiceStarted(Context context,String PackageName){ boolean isStarted =false; try{ int intGetTastCounter = 1000; ActivityManager mA 阅读全文
posted @ 2013-04-17 10:07 ♂小旭 阅读(188) 评论(0) 推荐(0)
 
Android中Service的使用
摘要: //启动ServicestartService(new Intent(MyCurrentActivity.this, MyService.class));//停止ServicestopService(new Intent(MyCurrentActivity.this, MyService.class));@SuppressLint("SimpleDateFormat")public class MyGPSService extends Service { private String strLongitude; private String strLatitude; Tim 阅读全文
posted @ 2013-04-17 09:58 ♂小旭 阅读(312) 评论(0) 推荐(0)
 
Android中的日期时间显示
摘要: (一)SimpleDateFormat formatter = new SimpleDateFormat ("yyyy年MM月dd日 HH:mm:ss"); Date curDate = new Date(System.currentTimeMillis()); String time = formatter.format(curDate); (二)final Calendar c = Calendar.getInstance();String time = c.get(Calendar.YEAR)+"年"+c.get(Calendar.MONTH)+& 阅读全文
posted @ 2013-04-17 09:43 ♂小旭 阅读(443) 评论(0) 推荐(0)
 
上一页 1 ··· 4 5 6 7 8