当前位置: 编程技术>移动开发
本页文章导读:
▪通讯录平添新纪录 通讯录添加新纪录
RROR/AndroidRuntime(4522): Caused by: java.lang.NullPointerExceptionERROR/AndroidRuntime(4522): at android.content.ContextWrapper.getContentResolver(ContextWrapper.java:90) 这表示,要在activity里面直接调.........
▪ 页面跳转采取滑动效果 页面跳转采用滑动效果
<?xml version="1.0" encoding="utf-8"?>
<!-- android:duration="@android:integer/config_shortAnimTime" -->
<set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/.........
▪ adroid virtual 不能下网解决方案 adroid virtual 不能上网
这个一般是对于android中的admod引用时,根据网上的正确代码却得出结果,主要原因就是不能上网具体方法是启动 android virtual打开系统的cmd ,输入adb shell 进入linux模.........
[1]通讯录平添新纪录
来源: 互联网 发布时间: 2014-02-18
通讯录添加新纪录
RROR/AndroidRuntime(4522): Caused by: java.lang.NullPointerException
ERROR/AndroidRuntime(4522): at android.content.ContextWrapper.getContentResolver(ContextWrapper.java:90)
这表示,要在activity里面直接调用
如果还不行,那就查看权限,我测试代码如下,android2.3.3
RROR/AndroidRuntime(4522): Caused by: java.lang.NullPointerException
ERROR/AndroidRuntime(4522): at android.content.ContextWrapper.getContentResolver(ContextWrapper.java:90)
这表示,要在activity里面直接调用
如果还不行,那就查看权限,我测试代码如下,android2.3.3
ContentValues values = new ContentValues(); Uri rawContactUri = getContentResolver().insert(RawContacts.CONTENT_URI, values); long rawContactId = ContentUris.parseId(rawContactUri); values.clear(); values.put(Data.RAW_CONTACT_ID, rawContactId); values.put(Data.MIMETYPE, StructuredName.CONTENT_ITEM_TYPE); values.put(StructuredName.GIVEN_NAME, "Sullivan"); values.put(StructuredName.FAMILY_NAME, "Mike"); getContentResolver().insert(Data.CONTENT_URI, values); values.clear(); values.put(Data.RAW_CONTACT_ID, rawContactId); values.put(Data.MIMETYPE, Phone.CONTENT_ITEM_TYPE); values.put(Phone.NUMBER, "13989297343"); values.put(Phone.TYPE, Phone.TYPE_HOME); values.put(Email.DATA, "ligang.02@163.com"); values.put(Email.TYPE, Email.TYPE_WORK); getContentResolver().insert(Data.CONTENT_URI, values);
[2] 页面跳转采取滑动效果
来源: 互联网 发布时间: 2014-02-18
页面跳转采用滑动效果
<?xml version="1.0" encoding="utf-8"?> <!-- android:duration="@android:integer/config_shortAnimTime" --> <set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/accelerate_interpolator"> <translate android:fromXDelta="-100%" android:toXDelta="0" android:duration="500" /> </set>
in_from_left.xml 放在res/anim下
in_from_right.xml
<set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/accelerate_interpolator"> <translate android:fromXDelta="100%p" android:toXDelta="0%p" android:duration="500" /> </set>
out_to_left.xml
<set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/accelerate_interpolator"> <translate android:fromXDelta="0%p" android:toXDelta="-100%p" android:duration="500" /> </set>
public class LeftRightSlideActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Button button = (Button)findViewById(R.id.button1); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(); intent.setClass(LeftRightSlideActivity.this, SlideSecondActivity.class); startActivity(intent); //设置切换动画,从右边进入,左边退出 overridePendingTransition(R.anim.in_from_right, R.anim.out_to_left); } }); } }
[3] adroid virtual 不能下网解决方案
来源: 互联网 发布时间: 2014-02-18
adroid virtual 不能上网
这个一般是对于android中的admod引用时,根据网上的正确代码却得出结果,主要原因就是不能上网
具体方法是
启动 android virtual
打开系统的cmd ,输入adb shell 进入linux模拟下
在打开一个cmd,输入ipconfig /all ,看到输入结果中,自己上网的那个ip的dns ***.***.***.***
再在linux下面的那个,输入setprop net.dns1 ***.***.***.***,
setprop net.dns1 202.106.46.151
# getprop
getprop
[ro.secure]: [0]
[ro.allow.mock.location]: [1]
[ro.debuggable]: [1]
[persist.service.adb.enable]: [1]
[ro.kernel.qemu.gles]: [0]
[ro.kernel.qemu]: [1]
[ro.kernel.console]: [ttyS0]
[ro.kernel.android.qemud]: [ttyS1]
[ro.kernel.android.checkjni]: [1]
[ro.kernel.ndns]: [3]
[ro.factorytest]: [0]
[ro.serialno]: []
[ro.bootmode]: [unknown]
[ro.baseband]: [unknown]
[ro.carrier]: [unknown]
[ro.bootloader]: [unknown]
[ro.hardware]: [goldfish]
[ro.revision]: [0]
[ro.build.id]: [FRF91]
[ro.build.display.id]: [sdk-eng 2.
[ro.build.version.incremental]: [4
[ro.build.version.sdk]: [8]
[ro.build.version.codename]: [REL]
[ro.build.version.release]: [2.2]
[ro.build.date]: [Wed Jun 30 13:58
[ro.build.date.utc]: [1277931480]
[ro.build.type]: [eng]
[ro.build.user]: [android-build]
[ro.build.host]: [android-test-25.
[ro.build.tags]: [test-keys]
[ro.product.model]: [sdk]
[ro.product.brand]: [generic]
[ro.product.name]: [sdk]
[ro.product.device]: [generic]
[ro.product.board]: []
[ro.product.cpu.abi]: [armeabi]
[ro.product.manufacturer]: [unknow
[ro.product.locale.language]: [ldp
[ro.product.locale.region]: []
[ro.wifi.channels]: []
[ro.board.platform]: []
[ro.build.product]: [generic]
[ro.build.description]: [sdk-eng 2
[ro.build.fingerprint]: [generic/s
[rild.libpath]: [/system/lib/libre
[rild.libargs]: [-d /dev/ttyS0]
[ro.config.notification_sound]: [O
[ro.config.alarm_alert]: [Alarm_Cl
[media.stagefright.enable-player]:
[media.stagefright.enable-meta]: [
[media.stagefright.enable-scan]: [
[media.stagefright.enable-http]: [
[ro.setupwizard.mode]: [OPTIONAL]
[xmpp.auto-presence]: [true]
[ro.config.nocheckin]: [yes]
[net.bt.name]: [Android]
[net.change]: [net.dns1]
[dalvik.vm.stack-trace-file]: [/da
[persist.sys.timezone]: [GMT]
[persist.sys.language]: [zh]
[persist.sys.country]: [CN]
[persist.sys.localevar]: []
[ro.FOREGROUND_APP_ADJ]: [0]
[ro.VISIBLE_APP_ADJ]: [1]
[ro.SECONDARY_SERVER_ADJ]: [2]
[ro.BACKUP_APP_ADJ]: [2]
[ro.HOME_APP_ADJ]: [4]
[ro.HIDDEN_APP_MIN_ADJ]: [7]
[ro.CONTENT_PROVIDER_ADJ]: [14]
[ro.EMPTY_APP_ADJ]: [15]
[ro.FOREGROUND_APP_MEM]: [1536]
[ro.VISIBLE_APP_MEM]: [2048]
[ro.SECONDARY_SERVER_MEM]: [4096]
[ro.BACKUP_APP_MEM]: [4096]
[ro.HOME_APP_MEM]: [4096]
[ro.HIDDEN_APP_MEM]: [5120]
[ro.CONTENT_PROVIDER_MEM]: [5632]
[ro.EMPTY_APP_MEM]: [6144]
[net.tcp.buffersize.default]: [409
[net.tcp.buffersize.wifi]: [4095,8
[net.tcp.buffersize.umts]: [4094,8
[net.tcp.buffersize.edge]: [4093,2
[net.tcp.buffersize.gprs]: [4092,8
[init.svc.console]: [running]
[init.svc.servicemanager]: [runnin
[init.svc.vold]: [running]
[init.svc.netd]: [running]
[init.svc.debuggerd]: [running]
[init.svc.ril-daemon]: [running]
[init.svc.zygote]: [running]
[init.svc.media]: [running]
[init.svc.installd]: [running]
[init.svc.keystore]: [running]
[init.svc.goldfish-setup]: [runnin
[init.svc.qemud]: [running]
[init.svc.goldfish-logcat]: [stopp
[ARGH]: [ARGH]
[net.eth0.dns1]: [10.0.2.3]
[net.gprs.local-ip]: [10.0.2.15]
[ro.radio.use-ppp]: [no]
[status.battery.state]: [Slow]
[status.battery.level]: [5]
[status.battery.level_raw]: [50]
[status.battery.level_scale]: [9]
[ro.com.google.locationfeatures]:
[init.svc.adbd]: [running]
[dalvik.vm.heapsize]: [24m]
[qemu.sf.lcd_density]: [240]
[qemu.hw.mainkeys]: [1]
[qemu.sf.fake_camera]: [back]
[adb.connected]: [1]
[init.svc.bootanim]: [stopped]
[hw.keyboards.65536.devname]: [qwe
[net.hostname]: [android_9774d56d6
[dev.bootcomplete]: [1]
[gsm.version.ril-impl]: [android r
[gsm.sim.operator.numeric]: [31026
[gsm.sim.operator.alpha]: [Android
[gsm.sim.operator.iso-country]: [u
[gsm.sim.state]: [READY]
[gsm.current.phone-type]: [1]
[gsm.nitz.time]: [1328358741577]
[gsm.network.type]: [UMTS]
[gsm.operator.alpha]: [Android]
[gsm.operator.numeric]: [310260]
[gsm.operator.iso-country]: [us]
[gsm.operator.isroaming]: [false]
[sys.settings_secure_version]: [2]
[net.gprs.http-proxy]: []
[gsm.defaultpdpcontext.active]: [t
[ro.runtime.firstboot]: [132835875
[net.dns1]: [202.106.46.151]
[net.dnschange]: [1]
回车执行后,再输入getprop 查看里面的dns是否改过来,
然后就可以上网了
因为本人看别人说明上面有的是好几个dns,而我的只有一个,所以上面仅针对一个dns所设置的
这个一般是对于android中的admod引用时,根据网上的正确代码却得出结果,主要原因就是不能上网
具体方法是
启动 android virtual
打开系统的cmd ,输入adb shell 进入linux模拟下
在打开一个cmd,输入ipconfig /all ,看到输入结果中,自己上网的那个ip的dns ***.***.***.***
再在linux下面的那个,输入setprop net.dns1 ***.***.***.***,
setprop net.dns1 202.106.46.151
# getprop
getprop
[ro.secure]: [0]
[ro.allow.mock.location]: [1]
[ro.debuggable]: [1]
[persist.service.adb.enable]: [1]
[ro.kernel.qemu.gles]: [0]
[ro.kernel.qemu]: [1]
[ro.kernel.console]: [ttyS0]
[ro.kernel.android.qemud]: [ttyS1]
[ro.kernel.android.checkjni]: [1]
[ro.kernel.ndns]: [3]
[ro.factorytest]: [0]
[ro.serialno]: []
[ro.bootmode]: [unknown]
[ro.baseband]: [unknown]
[ro.carrier]: [unknown]
[ro.bootloader]: [unknown]
[ro.hardware]: [goldfish]
[ro.revision]: [0]
[ro.build.id]: [FRF91]
[ro.build.display.id]: [sdk-eng 2.
[ro.build.version.incremental]: [4
[ro.build.version.sdk]: [8]
[ro.build.version.codename]: [REL]
[ro.build.version.release]: [2.2]
[ro.build.date]: [Wed Jun 30 13:58
[ro.build.date.utc]: [1277931480]
[ro.build.type]: [eng]
[ro.build.user]: [android-build]
[ro.build.host]: [android-test-25.
[ro.build.tags]: [test-keys]
[ro.product.model]: [sdk]
[ro.product.brand]: [generic]
[ro.product.name]: [sdk]
[ro.product.device]: [generic]
[ro.product.board]: []
[ro.product.cpu.abi]: [armeabi]
[ro.product.manufacturer]: [unknow
[ro.product.locale.language]: [ldp
[ro.product.locale.region]: []
[ro.wifi.channels]: []
[ro.board.platform]: []
[ro.build.product]: [generic]
[ro.build.description]: [sdk-eng 2
[ro.build.fingerprint]: [generic/s
[rild.libpath]: [/system/lib/libre
[rild.libargs]: [-d /dev/ttyS0]
[ro.config.notification_sound]: [O
[ro.config.alarm_alert]: [Alarm_Cl
[media.stagefright.enable-player]:
[media.stagefright.enable-meta]: [
[media.stagefright.enable-scan]: [
[media.stagefright.enable-http]: [
[ro.setupwizard.mode]: [OPTIONAL]
[xmpp.auto-presence]: [true]
[ro.config.nocheckin]: [yes]
[net.bt.name]: [Android]
[net.change]: [net.dns1]
[dalvik.vm.stack-trace-file]: [/da
[persist.sys.timezone]: [GMT]
[persist.sys.language]: [zh]
[persist.sys.country]: [CN]
[persist.sys.localevar]: []
[ro.FOREGROUND_APP_ADJ]: [0]
[ro.VISIBLE_APP_ADJ]: [1]
[ro.SECONDARY_SERVER_ADJ]: [2]
[ro.BACKUP_APP_ADJ]: [2]
[ro.HOME_APP_ADJ]: [4]
[ro.HIDDEN_APP_MIN_ADJ]: [7]
[ro.CONTENT_PROVIDER_ADJ]: [14]
[ro.EMPTY_APP_ADJ]: [15]
[ro.FOREGROUND_APP_MEM]: [1536]
[ro.VISIBLE_APP_MEM]: [2048]
[ro.SECONDARY_SERVER_MEM]: [4096]
[ro.BACKUP_APP_MEM]: [4096]
[ro.HOME_APP_MEM]: [4096]
[ro.HIDDEN_APP_MEM]: [5120]
[ro.CONTENT_PROVIDER_MEM]: [5632]
[ro.EMPTY_APP_MEM]: [6144]
[net.tcp.buffersize.default]: [409
[net.tcp.buffersize.wifi]: [4095,8
[net.tcp.buffersize.umts]: [4094,8
[net.tcp.buffersize.edge]: [4093,2
[net.tcp.buffersize.gprs]: [4092,8
[init.svc.console]: [running]
[init.svc.servicemanager]: [runnin
[init.svc.vold]: [running]
[init.svc.netd]: [running]
[init.svc.debuggerd]: [running]
[init.svc.ril-daemon]: [running]
[init.svc.zygote]: [running]
[init.svc.media]: [running]
[init.svc.installd]: [running]
[init.svc.keystore]: [running]
[init.svc.goldfish-setup]: [runnin
[init.svc.qemud]: [running]
[init.svc.goldfish-logcat]: [stopp
[ARGH]: [ARGH]
[net.eth0.dns1]: [10.0.2.3]
[net.gprs.local-ip]: [10.0.2.15]
[ro.radio.use-ppp]: [no]
[status.battery.state]: [Slow]
[status.battery.level]: [5]
[status.battery.level_raw]: [50]
[status.battery.level_scale]: [9]
[ro.com.google.locationfeatures]:
[init.svc.adbd]: [running]
[dalvik.vm.heapsize]: [24m]
[qemu.sf.lcd_density]: [240]
[qemu.hw.mainkeys]: [1]
[qemu.sf.fake_camera]: [back]
[adb.connected]: [1]
[init.svc.bootanim]: [stopped]
[hw.keyboards.65536.devname]: [qwe
[net.hostname]: [android_9774d56d6
[dev.bootcomplete]: [1]
[gsm.version.ril-impl]: [android r
[gsm.sim.operator.numeric]: [31026
[gsm.sim.operator.alpha]: [Android
[gsm.sim.operator.iso-country]: [u
[gsm.sim.state]: [READY]
[gsm.current.phone-type]: [1]
[gsm.nitz.time]: [1328358741577]
[gsm.network.type]: [UMTS]
[gsm.operator.alpha]: [Android]
[gsm.operator.numeric]: [310260]
[gsm.operator.iso-country]: [us]
[gsm.operator.isroaming]: [false]
[sys.settings_secure_version]: [2]
[net.gprs.http-proxy]: []
[gsm.defaultpdpcontext.active]: [t
[ro.runtime.firstboot]: [132835875
[net.dns1]: [202.106.46.151]
[net.dnschange]: [1]
回车执行后,再输入getprop 查看里面的dns是否改过来,
然后就可以上网了
因为本人看别人说明上面有的是好几个dns,而我的只有一个,所以上面仅针对一个dns所设置的
最新技术文章: