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






、Happiness↘.

 
 

Powered by 博客园
博客园 | 首页 | 新随笔 | 联系 | 订阅 订阅 | 管理

04 2014 档案

 
+网络图片浏览
摘要:1、权限2、代码//这次的HttpURLConnection仅针对Http连接,效率胜于URLConnection。 String uriPic =et.getText().toString(); URL imageUrl = null; Bitma... 阅读全文
posted @ 2014-04-20 17:23 、Happiness↘. 阅读(141) 评论(0) 推荐(0)
用webview自定义网址
摘要:代码wv=(WebView)this.findViewById(R.id.wv); wv.loadData( ""+""+"www.baidu.com"+""+"", "text/html", "utf-8"); 阅读全文
posted @ 2014-04-20 17:05 、Happiness↘. 阅读(165) 评论(0) 推荐(0)
使用Uri和WebView打开网页
摘要:1、权限2、代码(1)String url = et.getText().toString();//获取网址 wv.loadUrl(url);//在WebView中加载网页(2)String url = et.getText().toString();//获取网址 Uri ur... 阅读全文
posted @ 2014-04-20 17:03 、Happiness↘. 阅读(440) 评论(0) 推荐(0)
手机储存卡容量查询
摘要:if(Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {//判断存储卡是否插入 File path=Environment.getExternalStorageDirectory();... 阅读全文
posted @ 2014-04-16 09:41 、Happiness↘. 阅读(195) 评论(0) 推荐(0)
查看手机电量
摘要:1、创建BroadcastReceiver对象,重写onReceive()方法首先获取Action事件,当判断该事件为Intent.ACTION_BATTERY_CHANGED时,获取手机当前电量和总电量BroadcastReceiver br=new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { // TODO Auto-generated method stub String s=intent.getAction(); if(Intent.A... 阅读全文
posted @ 2014-04-10 17:28 、Happiness↘. 阅读(200) 评论(0) 推荐(0)
提醒用户收到短信
摘要:1、权限和创建广播 2、代码public class MyReceiver extends BroadcastReceiver{ @SuppressWarnings("deprecation") public void onReceive(Context context,Intent intent){ if(intent.getAction().equals("android.provider.Telephony.SMS_RECEIVED")){ StringBuilder sb=new StringBuilder(); Bundle bundle... 阅读全文
posted @ 2014-04-10 17:04 、Happiness↘. 阅读(119) 评论(0) 推荐(0)
手机屏幕更改
摘要:1、权限 2、final Display defaultDisplay=getWindow().getWindowManager().getDefaultDisplay();//获取手机的分辨率setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); screenHeight=defaultDisplay.getHeight();//获取手机分辨率高度 screenWidth=defaultDisplay.getWidth();//获取手机分辨率宽度 tv.setText(sc... 阅读全文
posted @ 2014-04-09 09:53 、Happiness↘. 阅读(225) 评论(0) 推荐(0)
查看手机信息和SIM卡信息
摘要:1、取得权限2、获得信息 if(tm.getLine1Number()!=null){ list.add(tm.getLine1Number()); }else{list.add("无法获取您的电话号码");} if(!tm.getNetworkCountryIso().equals("")){ list.add(tm.getNetworkCountryIso()); }else{list.add("无法获取您的电信网络国别");} if(!tm.getNetworkOperator().equals(""... 阅读全文
posted @ 2014-04-08 08:59 、Happiness↘. 阅读(686) 评论(0) 推荐(0)
还原和设置手机桌面背景
摘要:1、申请权限 2、调用clearWallpaper还原为默认桌面 MainActivity.this.clearWallpaper();3、设置桌面InputStream is;Resources resource=getBaseContext().getResources(); is=resource.openRawResource(R.drawable.wall);MainActivity.this.setWallpaper(is);4、取得当前桌面getWallpaper() 阅读全文
posted @ 2014-04-05 22:17 、Happiness↘. 阅读(231) 评论(0) 推荐(0)
wifi的开与关
摘要:1、在manifest申请权限 2、相关操作WifiManager mWifi=(WifiManager)this.getSystemService(Context.WIFI_SERVICE);//创建对象if(mWifi.isWifiEnabled())//若WIFI状态为已打开if(mWifi.setWifiEnabled(false))//关闭WIFIswitch(mWifi.getWifiState()) { case WifiManager.WIFI_STATE_ENABLING://WIFI在启动过程中,将无法关闭 bre... 阅读全文
posted @ 2014-04-05 17:40 、Happiness↘. 阅读(253) 评论(0) 推荐(0)
带图片的Toast
摘要:Toast toast=Toast.makeText(MainActivity.this, "手机在振动", Toast.LENGTH_SHORT);View textView=toast.getView(); LinearLayout ll=new LinearLayout(MainActivity.this);ImageView iv=new ImageView(MainActivity.this);ll.setOrientation(LinearLayout.HORIZONTAL);iv.setImageResource(R.drawable.ic_launcher) 阅读全文
posted @ 2014-04-03 20:19 、Happiness↘. 阅读(170) 评论(0) 推荐(0)
关于手机振动
摘要:首先要在manifest中申请权限,,然后定义 Vibrator vb,vb.vibrate(new long[]{100,10,100,10000},-1);//设置手机振动,四个参数,前三个为设定振动的大小,将数值改成一大一小就可以感觉到振动的差异,最后一个值repeat为振动的时间,repeat=-1表示只震动一轮,repeat=0会一直振动下去 阅读全文
posted @ 2014-04-03 19:39 、Happiness↘. 阅读(142) 评论(0) 推荐(0)