zoukankan      html  css  js  c++  java
  • 安卓常用功能——已封装好

    //弹出框
        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);
    
        }
  • 相关阅读:
    设计模式之装饰者模式
    每天一点点
    生财有道
    地图的移动和缩放
    钱分割
    位运算
    ref和out
    使用startCoroutine制定倒计时
    静态类和单例类
    Awake和Start
  • 原文地址:https://www.cnblogs.com/xiongwei89/p/3425618.html
Copyright © 2011-2022 走看看