安卓常用功能——已封装好

//弹出框
    public void totast(String text) {
        Toast.makeText(getApplicationContext(), text,
                 Toast.LENGTH_SHORT).show();

    }
    
    //浏览器打开网址
    private void open_url(String sUrl) {
        Intent intent = new Intent();
        intent.setData(Uri.parse(sUrl));
        intent.setAction(Intent.ACTION_VIEW);
         startActivity(intent);//打开浏览器

    }
    
    //拨打电话
    private void bohao(String number) {
        //直接拨打电话
        Intent intent = new Intent(Intent.ACTION_CALL,Uri.parse("tel:"+number));
        //跳转到拨号界面
        //Intent intent = new Intent(Intent.ACTION_DIAL,Uri.parse("tel:"+number));
        startActivity(intent);  

    }
    
    //调用默认地图应用
    private void ditu() {
        Uri uri = Uri.parse("geo:38.899533,-77.036476");
        Intent intent = new Intent(Intent.ACTION_VIEW, uri); 
        startActivity(intent); 
    }
    
    //路线规划
    private void luxian() {
        Uri uri = Uri.parse("http://maps.google.com/maps?f=d&saddr=startLat%20startLng&daddr=endLat%20endLng&hl=en");
        Intent intent = new Intent(Intent.ACTION_VIEW, uri);
        startActivity(intent);

    }

 

posted @ 2013-11-15 16:11  忆殇之痕  阅读(183)  评论(0编辑  收藏  举报