当前位置: 编程技术>移动开发
本页文章导读:
▪ADT“emulator-arm.exe 该内存不能为read”的解决方法 ADT“emulator-arm.exe 该内存不能为read”的解决办法
在启动Android模拟器时若报如下错误:
emulator-arm.exe-应用程序错误:"0x00474a63"指令引用的"0x0000ffff"内存。该内存不能为"read"。
错误出在SDCard.........
▪ Notification状态栏通报 Notification状态栏通知
private NotificationManager myNotiManager;
private Button button1;
private Button button2;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.notification);.........
▪ 自动启动蓝牙跟wifi 自动启动蓝牙和wifi
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.cchen.connect"
android:versionCode="1"
android:versionName="1.0">
<.........
[1]ADT“emulator-arm.exe 该内存不能为read”的解决方法
来源: 互联网 发布时间: 2014-02-18
ADT“emulator-arm.exe 该内存不能为read”的解决办法
在启动Android模拟器时若报如下错误:
emulator-arm.exe-应用程序错误:"0x00474a63"指令引用的"0x0000ffff"内存。该内存不能为"read"。
错误出在SDCard的大小上,在这里大小要设为64MB(暂时没发现有其他值可以,有兴趣的可以测试下)。
有的博客中提到不指定Size值,我也测试了,可行,但是虚拟机就无内存卡可用了。所以还是建议设为64MB。
[2] Notification状态栏通报
来源: 互联网 发布时间: 2014-02-18
Notification状态栏通知
private NotificationManager myNotiManager; private Button button1; private Button button2; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.notification); myNotiManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); button1 = (Button) findViewById(R.id.button1); button2 = (Button) findViewById(R.id.button2); button1.setOnClickListener(new OnClickListener() { public void onClick(View v) { setNotiType(R.drawable.img1, "信息的内容"); } }); button2.setOnClickListener(new OnClickListener() { public void onClick(View v) { myNotiManager.cancelAll(); } }); } public void setNotiType(int iconId, String text) { /* * 建立新的Intent,作为点选Notification留言条时, 会执行的Activity */ Intent notifyIntent = new Intent(this, MyNotification.class);//单击Notification转跳至MyNotification.class notifyIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); /* 建立PendingIntent作为设定递延执行的Activity */ PendingIntent appIntent = PendingIntent.getActivity( MyNotification.this, 0, notifyIntent, 0); /* 建立Notication,并设定相关参数 */ Notification myNoti = new Notification(); /* 设定statusbar显示的icon */ myNoti.icon = iconId; /* 设定statusbar显示的文字讯息 */ myNoti.tickerText = text; /* 设定notification发生时同时发出预设声音 */ myNoti.defaults = Notification.DEFAULT_SOUND; //屏幕亮myNoti.defaults = Notification.DEFAULT_LIGHTS; //震动myNoti.defaults = Notification.DEFAULT_VIBRATE; //包括铃声、屏幕亮和震动myNoti.defaults = Notification.DEFAULT_ALL; /* 设定Notification留言条的参数 */ myNoti.setLatestEventInfo(MyNotification.this, "信息的标题", text, appIntent); /* 送出Notification */ myNotiManager.notify(0, myNoti); }
[3] 自动启动蓝牙跟wifi
来源: 互联网 发布时间: 2014-02-18
自动启动蓝牙和wifi
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.cchen.connect" android:versionCode="1" android:versionName="1.0"> <uses-sdk android:minSdkVersion="8" /> <uses-permission android:name="android.permission.BLUETOOTH" /> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> <application android:icon="@drawable/icon" android:label="@string/app_name"> <receiver android:name=".ActionReceiver"> <intent-filter> <action android:name="android.intent.action.USER_PRESENT"/> </intent-filter> <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED"/> </intent-filter> </receiver> </application> </manifest>
package com.cchen.connect; import android.bluetooth.BluetoothAdapter; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.net.wifi.WifiManager; import android.util.Log; public class ActionReceiver extends BroadcastReceiver{ static final String LOG_TAG = "ActionReceiver"; private BluetoothAdapter blueAdapter; @Override public void onReceive(Context context, Intent intentIn) { Log.d(LOG_TAG, "ACTION = " + intentIn.getAction()); String action = intentIn.getAction(); if (Intent.ACTION_USER_PRESENT.equals(action) || Intent.ACTION_BOOT_COMPLETED.equals(action) ) { blueAdapter = BluetoothAdapter.getDefaultAdapter(); if(!blueAdapter.isEnabled()){ blueAdapter.enable(); } WifiManager wifiMgr = (WifiManager)context.getSystemService(Context.WIFI_SERVICE); int wifiState = wifiMgr.getWifiState(); if(wifiState == WifiManager.WIFI_STATE_DISABLED) { wifiMgr.setWifiEnabled(true); } Log.d(LOG_TAG, "========== UNLOCKINTENT " + blueAdapter.isEnabled() + wifiMgr.getWifiState()); } } }
最新技术文章: