如何编写省电的android应用

上传人:kms****20 文档编号:46592413 上传时间:2018-06-27 格式:PDF 页数:34 大小:816.36KB
返回 下载 相关 举报
如何编写省电的android应用_第1页
第1页 / 共34页
如何编写省电的android应用_第2页
第2页 / 共34页
如何编写省电的android应用_第3页
第3页 / 共34页
如何编写省电的android应用_第4页
第4页 / 共34页
如何编写省电的android应用_第5页
第5页 / 共34页
点击查看更多>>
资源描述

《如何编写省电的android应用》由会员分享,可在线阅读,更多相关《如何编写省电的android应用(34页珍藏版)》请在金锄头文库上搜索。

1、?Android? ? ? ? ? ? ? 1.5GHz ? 1.5GHz ? Moto XT928? 1300? ?1. ? 2. ? 3. ? 4. ? 5. ? 6. ? ?1. ? 2. ? 3. ? 4. ? 5. ? 6. ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? URL httpUrl = new URL(url); HttpURLConnection connection = (HttpURLConnection)httpUrl.openConnection(); connection.setConnectTimeout(?)? U

2、RL httpUrl = new URL(url); HttpURLConnection connection = (HttpURLConnection)httpUrl.openConnection(); ?connection.setConnectTimeout(?)? import java.util.zip.GZIPInputStream; HttpGet request = new ? ?HttpGet(“http:/ HttpResponse resp = new ?DefaultHttpClient().execute(request); HttpEntity entity = r

3、esponse.getEntity(); InputStream compressed = entity.getContent(); InputStream rawData = new ?GZIPInputStream(compressed); ? HttpClient httpclient = new DefaultHttpClient(); httpclient.getParams().setParameter( CoreConnectionPNames.SO_TIMEOUT, 5000); HttpGet httpget = new ?HttpGet(“http:/ pictures“)

4、; HttpResponse response = httpclient.execute(httpget); Header header = response.getHeaders(“ETag“); ? ? ? ? ? ? String provider = Settings.Secure.getString( context.getContentResolver(),Settings.Secure.LOCATION_PROVIDE RS_ALLOWED); if (provider != null ? LocationManager lManager = (LocationManager)

5、context.getSystemService(Context.LOCATION_SERVICE); lManager .isProviderEnabled(LocationManager.GPS_PROVIDER); ?Override protected void onResume() ? mSensorManager.registerListener(this,mSensorManager.getDefaultS ensor(Sensor.TYPE_ACCELEROMETER),SensorManager.SENSOR _DELAY_NORMAL); ? ? ? ? ?mSensorM

6、anager.unregisterListener(this); ? ? ? ?Override protected void onStart() ? mSensorManager.registerListener(this,mSensorManager.getDefaultS ensor(Sensor.TYPE_ACCELEROMETER),SensorManager.SENSOR _DELAY_NORMAL); ? ? ? ? ?mSensorManager.unregisterListener(this); ? ? ? ? ? ? ? XmlPullParserFactory and B

7、itmapFactory Matcher.reset(newString) for regex StringBuilder.setLength(0) ? ApplicationInfo ai; PackageManager mPm? ai = mPm.getApplicationInfo(app.pkgName, 0); app.icon = new SoftReference(ai.loadIcon(mPm); holder.iconView.setImageDrawable(app.icon.get(); ? ai = mPm.getApplicationInfo(app.pkgName,

8、 0); Drawable ?= ai.loadIcon(mPm)? holder.iconView.setImageDrawable(?); ? ComponentName receiver = new ComponentName(context, myReceiver.class); PackageManager pm = context.getPackageManager(); pm.setComponentEnabledSetting(receiver, PackageManager.COMPONENT_ENABLED_STATE_EN ABLED, PackageManager.DO

9、NT_KILL_APP) ?SQLiteDatabase db = mHelper.getWritableDatabase(); db.beginTransaction(); ? ? for (int i = 0; i usageHisList.size(); i+) db.insert(?,null, values); ? ?db.setTransactionSuccessful(); ? ? db.endTransaction(); ? ? ? ?.startAnimation(mChargingAnim);? ? ? ? ?.clearAnimation(); ? ? ? ? ? ?.startAnimation(mChargingAnim);? ? ? ? ?.clearAnimation(); ? ?application context ?android?context? application context?activity context? public class ?ctivity extends A

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 生活休闲 > 科普知识

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号