<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    Feeling

        三人行,必有我?guī)熝?/p>

       ::  :: 新隨筆 :: 聯(lián)系 ::  :: 管理 ::
      185 隨筆 :: 0 文章 :: 392 評(píng)論 :: 0 Trackbacks
    獲取屏幕Display: Activity.getWindowManager().getDefaultDisplay();
    獲取擴(kuò)展存儲(chǔ)目錄:Environment.getExternalStorageDirectory()
    通過(guò)文件獲取Uri:Uri.fromFile(File)
    根據(jù)文件路徑獲取圖片:BitmapFactory.decodeFile(imageFilePath, bmpFactoryOptions)
    獲取相機(jī)Intent:new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
    獲取相機(jī)拍照后的圖片:
    Bundle extras = intent.getExtras();
    Bitmap bmp = (Bitmap) extras.get("data");
    觸摸事件:onTouchEvent(MotionEvent ev)
    媒體播放器:android.media.MediaPlayer
    媒體控制器:android.widget.MediaController(和播放器不在同一個(gè)package下)
    SurfaceView是視圖(View)的繼承類,這個(gè)視圖里內(nèi)嵌了一個(gè)專門用于繪制的Surface,類似于Canvas,但感覺(jué)比Canvas更高級(jí)。
    android.provider.MediaStore里包含了相關(guān)的Image,Video,Audio信息,可通過(guò)managedQuery方法來(lái)查詢和遍歷。
    Android中的AdapterView使用Adapter來(lái)獲取數(shù)據(jù),和JFace中的ContentProvider對(duì)應(yīng)。
    根據(jù)字符串路徑獲取Uri:
    Uri.parse((String)Path)
    封裝好的視頻View:android.widget.VideoView
    視頻錄制:android.media.MediaRecorder
    相機(jī)高畫(huà)質(zhì):CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH);


    設(shè)置透明度(這是窗體本身的透明度,非背景)

    WindowManager.LayoutParams lp=getWindow().getAttributes();
                    lp.alpha=0.3f;
                  getWindow().setAttributes(lp);
                    
    alpha在0.0f到1.0f之間。1.0完全不透明,0.0f完全透明


    設(shè)置黑暗度

                    WindowManager.LayoutParams lp=getWindow().getAttributes();
                    lp.dimAmount=0.5f;
                    getWindow().setAttributes(lp);
                    getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);

    dimAmount在0.0f和1.0f之間,0.0f完全不暗,1.0f全暗


    設(shè)置背景模糊

    getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,     
               WindowManager.LayoutParams.FLAG_BLUR_BEHIND);



    //調(diào)用瀏覽器 
    Uri uri = Uri.parse(""); 
    Intent it = new Intent(Intent.ACTION_VIEW,uri); 
    startActivity(it); 

    //顯示某個(gè)坐標(biāo)在地圖上 
    Uri uri = Uri.parse("geo:38.899533,-77.036476"); 
    Intent it = new Intent(Intent.Action_VIEW,uri); 
    startActivity(it); 

    //顯示路徑 
    Uri uri = Uri.parse("http://maps.google.com/maps?f=d&saddr=startLat%20startLng&daddr=endLat%20endLng&hl=en"); 
    Intent it = new Intent(Intent.ACTION_VIEW,URI); 
    startActivity(it); 

    //撥打電話 
    Uri uri = Uri.parse("tel:10086"); 
    Intent it = new Intent(Intent.ACTION_DIAL, uri); 
    startActivity(it); 

    Uri uri = Uri.parse("tel.10086"); 
    Intent it =new Intent(Intent.ACTION_CALL,uri); 
    //需要添加 <uses-permission id="android.permission.CALL_PHONE" /> 這個(gè)權(quán)限到androidmanifest.xml 

    //發(fā)送短信或彩信 
    Intent it = new Intent(Intent.ACTION_VIEW); 
    it.putExtra("sms_body", "The SMS text"); 
    it.setType("vnd.android-dir/mms-sms"); 
    startActivity(it); 

    //發(fā)送短信 
    Uri uri = Uri.parse("smsto:10086"); 
    Intent it = new Intent(Intent.ACTION_SENDTO, uri); 
    it.putExtra("sms_body", "cwj"); 
    startActivity(it); 

    //發(fā)送彩信 
    Uri uri = Uri.parse("content://media/external/images/media/23"); 
    Intent it = new Intent(Intent.ACTION_SEND); 
    it.putExtra("sms_body", "some text"); 
    it.putExtra(Intent.EXTRA_STREAM, uri); 
    it.setType("image/png"); 
    startActivity(it); 

    //發(fā)送郵件 
    Uri uri = Uri.parse("mailto:android123@163.com"); 
    Intent it = new Intent(Intent.ACTION_SENDTO, uri); 
    startActivity(it); 

    Intent it = new Intent(Intent.ACTION_SEND); 
    it.putExtra(Intent.EXTRA_EMAIL, android123@163.com); 
    it.putExtra(Intent.EXTRA_TEXT, "The email body text"); 
    it.setType("text/plain"); 
    startActivity(Intent.createChooser(it, "Choose Email Client")); 

    Intent it=new Intent(Intent.ACTION_SEND); 
    String[] tos={"me@abc.com"}; 
    String[] ccs={"you@abc.com"}; 
    it.putExtra(Intent.EXTRA_EMAIL, tos); 
    it.putExtra(Intent.EXTRA_CC, ccs); 
    it.putExtra(Intent.EXTRA_TEXT, "The email body text"); 
    it.putExtra(Intent.EXTRA_SUBJECT, "The email subject text"); 
    it.setType("message/rfc822"); 
    startActivity(Intent.createChooser(it, "Choose Email Client")); 

    //播放媒體文件 
    Intent it = new Intent(Intent.ACTION_VIEW); 
    Uri uri = Uri.parse("file:///sdcard/cwj.mp3"); 
    it.setDataAndType(uri, "audio/mp3"); 
    startActivity(it); 

    Uri uri = Uri.withAppendedPath(MediaStore.Audio.Media.INTERNAL_CONTENT_URI, "1"); 
    Intent it = new Intent(Intent.ACTION_VIEW, uri); 
    startActivity(it); 

    //卸載APK 
    Uri uri = Uri.fromParts("package", strPackageName, null); 
    Intent it = new Intent(Intent.ACTION_DELETE, uri); 
    startActivity(it); 

    //卸載apk 2 
    Uri uninstallUri = Uri.fromParts("package", "xxx", null); 
    returnIt = new Intent(Intent.ACTION_DELETE, uninstallUri); 

    //安裝APK 
    Uri installUri = Uri.fromParts("package", "xxx", null); 
    returnIt = new Intent(Intent.ACTION_PACKAGE_ADDED, installUri); 

    //播放音樂(lè) 
    Uri playUri = Uri.parse("file:///sdcard/download/sth.mp3"); 
    returnIt = new Intent(Intent.ACTION_VIEW, playUri); 

    //發(fā)送附近 
    Intent it = new Intent(Intent.ACTION_SEND); 
    it.putExtra(Intent.EXTRA_SUBJECT, "The email subject text"); 
    it.putExtra(Intent.EXTRA_STREAM, "file:///sdcard/cwj.mp3"); 
    sendIntent.setType("audio/mp3"); 
    startActivity(Intent.createChooser(it, "Choose Email Client")); 

    //market上某個(gè)應(yīng)用信,pkg_name就是應(yīng)用的packageName 
    Uri uri = Uri.parse("market://search?q=pname:pkg_name"); 
    Intent it = new Intent(Intent.ACTION_VIEW, uri); 
    startActivity(it); 

    //market上某個(gè)應(yīng)用信息,app_id可以通過(guò)www網(wǎng)站看下 
    Uri uri = Uri.parse("market://details?id=app_id"); 
    Intent it = new Intent(Intent.ACTION_VIEW, uri); 
    startActivity(it); 

    //調(diào)用搜索 
    Intent intent = new Intent(); 
    intent.setAction(Intent.ACTION_WEB_SEARCH); 
    intent.putExtra(SearchManager.QUERY,"android123") 
    startActivity(intent); 

    //調(diào)用分享菜單 
    Intent intent=new Intent(Intent.ACTION_SEND); 
    intent.setType("text/plain"); //分享的數(shù)據(jù)類型 
    intent.putExtra(Intent.EXTRA_SUBJECT, "subject"); //主題 
    intent.putExtra(Intent.EXTRA_TEXT, "content"); //內(nèi)容 
    startActivity(Intent.createChooser(intent, "title")); //目標(biāo)應(yīng)用選擇對(duì)話框的標(biāo)題


    獲取Location:
    Criteria criteria = new Criteria();
    criteria.setAccuracy(Criteria.ACCURACY_COARSE);
    criteria.setPowerRequirement(Criteria.POWER_LOW);
    LocationManager locManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
    if(locManager.getBestProvider(criteria, true) != null)
    myLocation = locManager.getLastKnownLocation(locManager.getBestProvider(criteria, true));
    else {
    myLocation = new Location("gps");
    myLocation.setLatitude(47.100301);
    myLocation.setLongitude(-119.982465);
    }

    只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


    網(wǎng)站導(dǎo)航:
     
    GitHub |  開(kāi)源中國(guó)社區(qū) |  maven倉(cāng)庫(kù) |  文件格式轉(zhuǎn)換 
    主站蜘蛛池模板: 久久久久亚洲AV无码专区桃色| 中文字幕专区在线亚洲| 亚洲国产第一站精品蜜芽| 亚洲国产精品专区| 深夜A级毛片视频免费| 国产成人免费视频| 好男人视频在线观看免费看片| 亚洲国产精品尤物yw在线| 亚洲精品在线播放| 一级做α爱过程免费视频| 成人午夜视频免费| 亚洲系列中文字幕| 美女视频黄免费亚洲| 亚洲女同成av人片在线观看| 亚洲人成欧美中文字幕| 暖暖免费日本在线中文| 亚洲美女aⅴ久久久91| 精品无码一级毛片免费视频观看 | 亚洲成aⅴ人在线观看| 国产vA免费精品高清在线观看| 国产v精品成人免费视频400条| 亚洲中文字幕无码一区二区三区| 亚洲av成人无码网站…| 丁香花免费高清视频完整版| 中文字幕亚洲情99在线| av无码国产在线看免费网站| 久久亚洲成a人片| 国产va免费精品| 亚洲美女免费视频| 国产三级电影免费观看| 中文字幕乱码亚洲精品一区| 亚洲JIZZJIZZ中国少妇中文| 你好老叔电影观看免费| 亚洲熟妇无码乱子AV电影| 最近免费mv在线电影| 亚洲福利视频一区二区三区| 国产男女猛烈无遮挡免费视频| 亚洲av无码成人影院一区 | 无码欧精品亚洲日韩一区| 黄瓜视频高清在线看免费下载 | 亚洲中文字幕久久无码|