装机吧 - 系统装机大师 最简单易用的系统重装工具,让我们一起装机吧!支持 Windows XP、7、8、 10 原版镜像安装。支持 U 盘 PE 制作、PE 联网等多种功能选择。
  • 立即下载
  • 已下载:1000000+
    版本:12.6.48.1900 | 大小:31MB
当前位置:首页 > 重装系统
您的位置:首页 > 重装系统
基于安卓系统的app开发和风天气预报(安卓天气app开发教程)
装机吧 2023年02月18日 17:50:28

基于android天气预报开发中的分享功能是怎么实现的

现在的分享基本上都是现成:

android  自带分享功能:虽然比较low,而且不同厂家显示的分享面板可能不一样,但是功能是可以用的,如果要开发写高级功能的那么需要使用到第三方的分享啦

/**

 * 分享功能

 *

 * @param context       上下文

 * @param activityTitle Activity的名字

 * @param msgTitle      消息标题

 * @param msgText       消息内容

 * @param imgPath       图片路径,不分享图片则传null

 */

public void shareMsg(String activityTitle, String msgTitle, String msgText,

                     String imgPath) {

    Intent intent = new Intent(Intent.ACTION_SEND);

    if (imgPath == null || imgPath.equals("")) {

        intent.setType("text/plain"); // 纯文本

    } else {

        File f = new File(imgPath);

        if (f != null  f.exists()  f.isFile()) {

            intent.setType("image/jpg");

            Uri u = Uri.fromFile(f);

            intent.putExtra(Intent.EXTRA_STREAM, u);

        }

    }

    intent.putExtra(Intent.EXTRA_SUBJECT, msgTitle);

    intent.putExtra(Intent.EXTRA_TEXT, msgText);

    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

    startActivity(Intent.createChooser(intent, activityTitle));

}3. 第三方分享:使用较多的分享-Umeng(友盟),链接:

4. 第三方分享:使用较多的分享-ShareSDK ,链接:

如何在android中开发个天气预报的应用

恩,调用谷歌天气预报的api,返回xml,解析一下显示在控件里就可以了!

基于android的天气预报系统?

用你手机自带的“应用商店”,搜索天气,出来的都是适配你手机系统的天气预报app。

当然,你的手机是安卓的,那就是适配安卓系统的了。

如何自己动手做一个android天气预报的app

一个Android天气预报要用到的代码文件,可显示操作菜单,显示未来四天天气、将全国城市列表写入数据库、初始化数据解析类,界面控件,消息接收器Handler、线程消息接收器、左侧菜单选择事件监听、后退按钮监听等,代码为:

227    

                    if(mycitys.size()==1){

 

228    

                    showToast("至少要保留一个城市");

 

229    

                    }else{   

230    

                    mycitys.remove(position);

 

231    

                    writeMyCitys();   

232    

                    sAdapter.notifyDataSetChanged();

 

233    

                    currCityId=mycitys.get(0).get("cityId");

 

234    

                    changeSearchState();   

235    

                    }   

236    

                    }   

237    

                });   

238    

                builder.setNegativeButton("取    消",

 

239    

                new DialogInterface.OnClickListener() {

 

240    

                    public void onClick(DialogInterface dialog, int which) {

 

241    

                        dialog.dismiss();   

242    

                    }   

243    

                });   

244    

        builder.show();   

245    

        return false;   

246    

    }

 

247    

    //

监听后退按钮   

248    

    @Override  

249    

    public boolean

onKeyDown(int

keyCode, KeyEvent event) {

 

250    

        if (keyCode ==

KeyEvent.KEYCODE_BACK) {   

251    

            // 如果当前menu没有显示   

252    

            if (!isBack) {

 

253    

                showToast("再按一次退出");

 

254    

                downTime = event.getDownTime();

 

255    

                isBack = true;   

256    

                return true;   

257    

            } else {   

258    

                if (event.getDownTime() -

downTime = 2000) {   

259    

                    AppManager.getAppManager().AppExit(Weather.this);

 

260    

                } else {   

261    

                    showToast("再按一次退出");

 

262    

                    downTime = event.getDownTime();

 

263    

                    return true;   

264    

                }   

265    

            }   

266    

        }

 

267    

        return super.onKeyDown(keyCode, event);

 

268    

    }

 

269    

    @Override  

270    

    protected void

onDestroy() {   

271    

        if(mVibrator!=null){

 

272    

        mVibrator.cancel();   

273    

        }

 

274    

        super.onDestroy();

 

275    

    }

 

276    

}  

喜欢22
热门搜索
相关视频
装机吧在线重装 Window 11 教程
装机吧在线重装 Window 10 教程
猜你喜欢
一体机电脑屏幕坏了修要多少钱(一体机..
2023/02/09
vivo电脑刷机教程(vivo电脑怎么刷机)..
2023/02/17
苹果11promax系统哪个版本好(苹果11pr..
2023/02/18
笔记本电脑系统怎么重装win10(联想笔..
2023/02/09
win7电脑装系统后必须做的(装win7系统..
2023/02/18
手机重装电脑系统软件(手机如何重装电..
2023/02/16

基于安卓系统的app开发和风天气预报(安卓天气app开发教程)

分类:重装系统    发布时间: 2023年02月18日 17:50:28
播放 2023年02月18日 17:50:28
安卓天气app开发教程

基于android天气预报开发中的分享功能是怎么实现的

现在的分享基本上都是现成:

android  自带分享功能:虽然比较low,而且不同厂家显示的分享面板可能不一样,但是功能是可以用的,如果要开发写高级功能的那么需要使用到第三方的分享啦

/**

 * 分享功能

 *

 * @param context       上下文

 * @param activityTitle Activity的名字

 * @param msgTitle      消息标题

 * @param msgText       消息内容

 * @param imgPath       图片路径,不分享图片则传null

 */

public void shareMsg(String activityTitle, String msgTitle, String msgText,

                     String imgPath) {

    Intent intent = new Intent(Intent.ACTION_SEND);

    if (imgPath == null || imgPath.equals("")) {

        intent.setType("text/plain"); // 纯文本

    } else {

        File f = new File(imgPath);

        if (f != null  f.exists()  f.isFile()) {

            intent.setType("image/jpg");

            Uri u = Uri.fromFile(f);

            intent.putExtra(Intent.EXTRA_STREAM, u);

        }

    }

    intent.putExtra(Intent.EXTRA_SUBJECT, msgTitle);

    intent.putExtra(Intent.EXTRA_TEXT, msgText);

    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

    startActivity(Intent.createChooser(intent, activityTitle));

}3. 第三方分享:使用较多的分享-Umeng(友盟),链接:

4. 第三方分享:使用较多的分享-ShareSDK ,链接:

如何在android中开发个天气预报的应用

恩,调用谷歌天气预报的api,返回xml,解析一下显示在控件里就可以了!

基于android的天气预报系统?

用你手机自带的“应用商店”,搜索天气,出来的都是适配你手机系统的天气预报app。

当然,你的手机是安卓的,那就是适配安卓系统的了。

如何自己动手做一个android天气预报的app

一个Android天气预报要用到的代码文件,可显示操作菜单,显示未来四天天气、将全国城市列表写入数据库、初始化数据解析类,界面控件,消息接收器Handler、线程消息接收器、左侧菜单选择事件监听、后退按钮监听等,代码为:

227    

                    if(mycitys.size()==1){

 

228    

                    showToast("至少要保留一个城市");

 

229    

                    }else{   

230    

                    mycitys.remove(position);

 

231    

                    writeMyCitys();   

232    

                    sAdapter.notifyDataSetChanged();

 

233    

                    currCityId=mycitys.get(0).get("cityId");

 

234    

                    changeSearchState();   

235    

                    }   

236    

                    }   

237    

                });   

238    

                builder.setNegativeButton("取    消",

 

239    

                new DialogInterface.OnClickListener() {

 

240    

                    public void onClick(DialogInterface dialog, int which) {

 

241    

                        dialog.dismiss();   

242    

                    }   

243    

                });   

244    

        builder.show();   

245    

        return false;   

246    

    }

 

247    

    //

监听后退按钮   

248    

    @Override  

249    

    public boolean

onKeyDown(int

keyCode, KeyEvent event) {

 

250    

        if (keyCode ==

KeyEvent.KEYCODE_BACK) {   

251    

            // 如果当前menu没有显示   

252    

            if (!isBack) {

 

253    

                showToast("再按一次退出");

 

254    

                downTime = event.getDownTime();

 

255    

                isBack = true;   

256    

                return true;   

257    

            } else {   

258    

                if (event.getDownTime() -

downTime = 2000) {   

259    

                    AppManager.getAppManager().AppExit(Weather.this);

 

260    

                } else {   

261    

                    showToast("再按一次退出");

 

262    

                    downTime = event.getDownTime();

 

263    

                    return true;   

264    

                }   

265    

            }   

266    

        }

 

267    

        return super.onKeyDown(keyCode, event);

 

268    

    }

 

269    

    @Override  

270    

    protected void

onDestroy() {   

271    

        if(mVibrator!=null){

 

272    

        mVibrator.cancel();   

273    

        }

 

274    

        super.onDestroy();

 

275    

    }

 

276    

}  

栏目:重装系统 阅读: 2019/03/19
栏目:重装系统 阅读: 2016/10/11
视频教程 更多>>
重装系统 更多>>
win10 更多>>
win7 更多>>
win8 更多>>
装机吧一键重装系统

版权所有 © 2012-2020 保留所有权利