public SimpleDateFormat(String pattern,Locale locale) Constructs a SimpleDateFormat usingthe given pattern andthe default dateformat symbols forthe given locale. Note: This constructor may not support all locales. For full coverage, use the factory methods inthe DateFormat class. Parameters:pattern - the pattern describing thedateandtime formatlocale - the locale whose dateformat symbols should be used Throws:NullPointerException - ifthe given pattern or locale is nullIllegalArgumentException - ifthe given pattern is invalid
public SimpleDateFormat(String pattern) Constructs a SimpleDateFormat usingthe given pattern andthe default dateformat symbols forthe default locale. Note: This constructor may not support all locales. For full coverage, use the factory methods inthe DateFormat class. Parameters:pattern - the pattern describing thedateandtimeformat Throws:NullPointerException - ifthe given pattern is nullIllegalArgumentException - ifthe given pattern is invalid
publicvoidbatteryLevel(){ BroadcastReceiver batteryLevelReceiver = new BroadcastReceiver() { int scale = -1; int level = -1; int voltage = -1; int temperature = -1; @Override publicvoidonReceive(Context context, Intent intent){ level = intent.getIntExtra(BatteryManager.EXTRA_LEVEL, -1); scale = intent.getIntExtra(BatteryManager.EXTRA_SCALE, -1); temperature = intent.getIntExtra(BatteryManager.EXTRA_TEMPERATURE, -1); voltage = intent.getIntExtra(BatteryManager.EXTRA_VOLTAGE, -1); Log.i("BatteryManager", "level is "+level+"/"+scale+", temp is "+ temperature +", voltage is "+voltage); } }; IntentFilter filter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED); MyApplication.getContext().registerReceiver(batteryLevelReceiver, filter); }
# Site title: More Than Words subtitle:Perfection'snot attainable, but if we chase it we can catch excellence.. description:学习总结 思考感悟 知识管理 author: Siyu Jin language:zh-CN timezone:
# URL ## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/' url: http://njuptjsy.github.io/ root: / permalink: :year/:month/:day/:title/ permalink_defaults:
# Writing new_post_name: :title.md # File name of new posts default_layout: post titlecase: false # Transform title into titlecase external_link: true # Open external links in new tab filename_case: 0 render_drafts: false post_asset_folder: false relative_link: false future: true highlight: enable: true line_number: true tab_replace:
# Category & Tag default_category: uncategorized category_map: tag_map:
# Date / Time format ## Hexo uses Moment.js to parse and display date ## You can customize the date format as defined in ## http://momentjs.com/docs/#/displaying/format/ date_format: YYYY-MM-DD time_format: HH:mm:ss
# Pagination ## Set per_page to 0 to disable pagination per_page: 10 pagination_dir: page