哪些网站做品牌折扣的建站公司技术服务费

news/2025/9/22 18:30:55/文章来源:
哪些网站做品牌折扣的,建站公司技术服务费,萍缘网站建设工作,企业所得税怎么征收几个点在开发工程中线程可以帮助我们提高运行速度#xff0c;Android开发中我知道的线程有四个一个是老生长谈的Thread#xff0c;第二个是asyncTask,第三个#xff1a;TimetTask,第四个是Looper,四个多线程各有个的有点#xff0c;Thread的运行速度是最快的#xff0c;AsyncTas…在开发工程中线程可以帮助我们提高运行速度Android开发中我知道的线程有四个一个是老生长谈的Thread第二个是asyncTask,第三个TimetTask,第四个是Looper,四个多线程各有个的有点Thread的运行速度是最快的AsyncTask的规范性是最棒的其它两个也有自己的优点下面先贴上三个列子1.Thread与Handler组合比较常见Handler主要是帮助我们来时时更新UI线程这里在后天加载100张图片然后没加载完成一个用handler 返回给UI线程一张图片并显示最后加载完成返回一个List给UI线程 Handler就是一个后台线程与UI线程中间的桥梁package com.android.wei.thread;import java.io.InputStream;import java.util.ArrayList;import java.util.List;import android.app.Activity;import android.content.Context;import android.graphics.Bitmap;import android.graphics.BitmapFactory;import android.os.Bundle;import android.os.Handler;import android.os.Message;import android.view.View;import android.view.View.OnClickListener;import android.widget.Button;import android.widget.ImageView;import android.widget.TextView;public class Activity01 extends Activity {/** Called when the activity is first created. *//**读取进度**/public final static int LOAD_PROGRESS 0;/**标志读取进度结束**/public final static int LOAD_COMPLETE 1;/**开始加载100张图片按钮**/Button mButton null;/**显示内容**/TextView mTextView null;/**加载图片前的时间**/Long mLoadStart 0L;/**加载图片完成的时间**/Long mLoadEndt 0L;Context mContext null;/**图片列表**/private List list;/**图片容器**/private ImageView mImageView;//接受传过来得消息Handler handler new Handler(){public void handleMessage(Message msg){switch(msg.what){case LOAD_PROGRESS:Bitmap bitmap (Bitmap)msg.obj;mTextView.setText(当前读取到第msg.arg1张图片);mImageView.setImageBitmap(bitmap);break;case LOAD_COMPLETE:list (List) msg.obj;mTextView.setText(读取结束一共加载list.size()图片);break;}super.handleMessage(msg);}};public void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);mContext this;setContentView(R.layout.main);mButton (Button) findViewById(R.id.button1);mTextView(TextView) findViewById(R.id.textView1);mImageView (ImageView) this.findViewById(R.id.imageview);mTextView.setText(点击按钮加载图片);mButton.setOnClickListener(new OnClickListener(){public void onClick(View v){//调用方法LoadImage();}});}public void LoadImage(){new Thread(){public void run(){mLoadStart System.currentTimeMillis();List list new ArrayList();for(int i 0;i100;i){Bitmap bitmapReadBitmap(mContext,R.drawable.icon);Message msg new Message();msg.what LOAD_PROGRESS;msg.arg1 i1;list.add(bitmap);msg.obj bitmap;handler.sendMessage(msg);}mLoadEndt System.currentTimeMillis();Message msg new Message();msg.what LOAD_COMPLETE;msg.objlist;msg.arg1 (int) (mLoadEndt - mLoadStart);handler.sendMessage(msg);}}.start();}public Bitmap ReadBitmap(Context context,int resId){BitmapFactory.Options opt new BitmapFactory.Options();opt.inPreferredConfig Bitmap.Config.RGB_565;opt.inPurgeable true;opt.inInputShareable true;InputStream is context.getResources().openRawResource(resId);return BitmapFactory.decodeStream(is, null, opt);}}2AsyncTask异步多线程AsyncTask的规范型很强能够时时反映更新的情况它一般有这么几个方法* onPreExecute(), 该方法将在执行实际的后台操作前被UI 线程调用。可以在该方法中做一些准备工作如在界面上显示一个进度条或者一些控件的实例化这个方法可以不用实现。* doInBackground(Params...), 将在onPreExecute 方法执行后马上执行该方法运行在后台线程中。这里将主要负责执行那些很耗时的后台处理工作。可以调用 publishProgress方法来更新实时的任务进度。该方法是抽象方法子类必须实现。* onProgressUpdate(Progress...),在publishProgress方法被调用后UI 线程将调用这个方法从而在界面上展示任务的进展情况例如通过一个进度条进行展示。* onPostExecute(Result), 在doInBackground 执行完成后onPostExecute 方法将被UI 线程调用后台的计算结果将通过该方法传递到UI 线程并且在界面上展示给用户.* onCancelled(),在用户取消线程操作的时候调用。在主线程中调用onCancelled()的时候调用。为了正确的使用AsyncTask类以下是几条必须遵守的准则1) Task的实例必须在UI 线程中创建2) execute方法必须在UI 线程中调用3) 不要手动的调用onPreExecute(), onPostExecute(Result)doInBackground(Params...), onProgressUpdate(Progress...)这几个方法需要在UI线程中实例化这个task来调用。4) 该task只能被执行一次否则多次调用时将会出现异常package com.android.wei.thread;import java.io.ByteArrayOutputStream;import java.io.InputStream;import java.util.ArrayList;import java.util.List;import java.util.Timer;import java.util.TimerTask;import android.app.Activity;import android.content.Context;import android.graphics.Bitmap;import android.graphics.BitmapFactory;import android.os.AsyncTask;import android.os.Bundle;import android.view.View;import android.view.View.OnClickListener;import android.widget.Button;import android.widget.ImageView;import android.widget.TextView;public class Activity02 extends Activity{/**开始StartAsync按钮**/Button mButton null;Context mContext null;//内容显示出来TextView mTextView null;//Timer 对象Timer mTimer null;/** timerTask 对象**/TimerTask mTimerTask null;/**记录TimerId**/int mTimerId 0;/**图片列表**/private List list;/**图片容器**/private ImageView mImageView;public void onCreate(Bundle s){super.onCreate(s);setContentView(R.layout.main);mContext this;mButton (Button) this.findViewById(R.id.button1);mImageView (ImageView)this.findViewById(R.id.imageview);mTextView (TextView) this.findViewById(R.id.textView1);mButton.setOnClickListener(new OnClickListener(){public void onClick(View v){StartAsync();}});}public void StartAsync(){new AsyncTask(){protected void onPreExecute(){//首先执行这个方法它在UI线程中可以执行一些异步操作mTextView.setText(开始加载进度);super.onPreExecute();}Overrideprotected Object doInBackground(Object... params) {// TODO Auto-generated method stub//异步后台执行执行完毕可以返回出去一个结果 Object 对象//得到开始加载得时间list new ArrayList();for(int i 0;i100;i){Bitmap bitmap ReadBitmap(mContext,R.drawable.icon);final ByteArrayOutputStream os new ByteArrayOutputStream();bitmap.compress(Bitmap.CompressFormat.PNG, 100, os);byte[] image os.toByteArray();Bundle bundle new Bundle();bundle.putInt(index, i);bundle.putByteArray(image, image);publishProgress(bundle);list.add(bitmap);}return list;}protected void onPostExecute(Object result){//doInBackground 执行之后在这里可以接受到返回结果的对象List list (List) result;mTextView.setText(一共加载了list.size()张图片);super.onPostExecute(result);}protected void onProgressUpdate(Object... values){//时时拿到当前的进度更新UIBundle bundle (Bundle)values[0];byte[] image bundle.getByteArray(image);Bitmap bitmap BitmapFactory.decodeByteArray(image, 0, image.length);int index bundle.getInt(index);mTextView.setText(当前加载进度index);mImageView.setImageBitmap(bitmap);super.onProgressUpdate(values);}}.execute();}public Bitmap ReadBitmap(Context context,int resId){BitmapFactory.Options opt new BitmapFactory.Options();opt.inPreferredConfig Bitmap.Config.RGB_565;opt.inPurgeable true;opt.inInputShareable true;InputStream is context.getResources().openRawResource(resId);return BitmapFactory.decodeStream(is, null, opt);}}3TimerTask可以根据我们的设置来间隔性的运行可以很好的实现监听功能一般也跟handler一起package com.android.wei.thread;import java.util.Timer;import java.util.TimerTask;import android.app.Activity;import android.content.Context;import android.os.Bundle;import android.os.Handler;import android.os.Message;import android.view.View;import android.view.View.OnClickListener;import android.widget.Button;import android.widget.TextView;public class TimerTaskActivity extends Activity{/**执行Timer进度**/public final static int LOAD_PROGRESS 0;/**关闭TImer进度**/public final static int CLOSE_PROGRESS 1;/**开始TIMERTASK按钮**/Button mButton0 null;/**关闭TIMERTASK按钮**/Button mButton1 null;/**显示内容**/TextView mTextView null;Context mContext null;/**timer对象**/Timer mTimer null;/**TimerTask对象**/TimerTask mTimerTask null;/**记录TimerID**/int mTimerID 0;Handler handler new Handler(){public void handleMessage(Message msg){switch(msg.what){case LOAD_PROGRESS:mTextView.setText(当前得TimerID为msg.arg1);break;case CLOSE_PROGRESS:mTextView.setText(当前Timer已经关闭请重新启动);break;}super.handleMessage(msg);}};protected void onCreate(Bundle s){setContentView(R.layout.timer);mContext this;mButton0 (Button) this.findViewById(R.id.button1);mButton1 (Button) this.findViewById(R.id.button2);mTextView (TextView) this.findViewById(R.id.textView1);mTextView.setText(点击按钮开始更新时间);mButton0.setOnClickListener(new OnClickListener(){public void onClick(View v){StartTimer();}});mButton1.setOnClickListener(new OnClickListener(){public void onClick(View v){CloseTimer();}});super.onCreate(s);}public void StartTimer(){if(mTimer null){mTimerTask new TimerTask(){Overridepublic void run() {mTimerID ;Message msg new Message();msg.what LOAD_PROGRESS;msg.arg1 (int) (mTimerID);handler.sendMessage(msg);}};mTimer new Timer();//第一个参数为执行的mTimerTask//第二个参数为延迟得事件这里写1000得意思是 mTimerTask将延迟1秒执行//第三个参数为多久执行一次这里写1000 表示没1秒执行一次mTimerTask的Run方法mTimer.schedule(mTimerTask, 1000,1000);}}public void CloseTimer(){if(mTimer !null){mTimer.cancel();mTimer null;}if(mTimerTask! null){mTimerTask null;}mTimerID 0;handler.sendEmptyMessage(CLOSE_PROGRESS);}}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/909976.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

什么企业做网站比较方便呢微信注册小程序步骤

1, 概述 1.1 课题背景 本系统由说书客面向广大民营药店、县区级医院、个体诊所等群体的药品和客户等信息的管理需求,采用SpringSpringMVCMybatisEasyui架构实现,为单体药店、批发企业、零售连锁企业,提供有针对性的信息数据管理…

邵东网站开发微信小程序h5开发

flex如何做响应式设计Responsive design is not just about the web that automatically adjusts to different screen resolutions and resizeable images, but designs that are crucial for web performance.自适应设计不仅涉及可自动适应不同屏幕分辨率和可调整大小图像的网…

郑州门户网站建设哪家好有了自己的域名怎么做网站

✌全网粉丝20W,csdn特邀作者、博客专家、CSDN新星计划导师、java领域优质创作者,博客之星、掘金/华为云/阿里云/InfoQ等平台优质作者、专注于Java技术领域和毕业项目实战✌ 🍅文末获取项目下载方式🍅 一、项目背景介绍: 随着互联网技术的不断…

广州建站模板诚信网站平台建设方案

在无限的整数序列 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ...中找到第 n 个数字。 注意: n 是正数且在32为整形范围内 ( n < 231)。 示例 1: 输入: 3 输出: 3 示例 2: 输入: 11 输出: 0 说明: 第11个数字在序列 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ... 里是0&#xff0c;它是…

伊犁州住房城乡建设局网站建站快车加盟

铁路订票管理系统按照权限的类型进行划分&#xff0c;分为用户和管理员两个模块。管理员模块主要针对整个系统的管理进行设计&#xff0c;提高了管理的效率和标准。主要功能包括个人中心、用户管理、火车类型管理、火车信息管理、车票预订管理、车票退票管理、系统管理等&#…

手机影视素材网站大全汽油价格92号最新调整时间

1. 指针和数组 C语言中只有一维数组&#xff0c;而且数组的大小必须在编译器就作为一个常数确定下来&#xff0c;然而在C语言中数组的元素可以是任何类型的对象&#xff0c;当然也可以是另外的一个数组&#xff0c;这样&#xff0c;要仿真出一个多维数组就不是难事。 对于一个…

app和网站哪个难做宁夏免费建个人网站

物品名称物品代码电池battery.small骨头碎片bone.fragments空的豆罐头can.beans.empty空的金枪鱼罐头can.tuna.empty摄像头cctv.camera木炭charcoal煤coal石油crude.oil炸药explosives动物脂肪fat.animal火药gunpowder高级金属矿hq.metal.ore金属碎片metal.fragments金属矿meta…

商家自己做的商品信息查询网站网站开发结论

本文实例讲述了PHP双向链表定义与用法。分享给大家供大家参考&#xff0c;具体如下&#xff1a;由于需要对一组数据多次进行移动操作&#xff0c;所以写个双向链表。但对php实在不熟悉&#xff0c;虽然测试各个方法没啥问题&#xff0c;就是不知道php语言深层的这些指针和unset…

漯河市万金镇网站建设建设个人网站用到的技术

matlab语言丰富的图形表现方法&#xff0c;使得数学计算结果可以方便地、多样性地实现了可视化&#xff0c;这是其它语言所不能比拟的。;第一节 符号函数绘图第二节 图形编辑第三节 2D数据图第四节 3D数据图第五节 MATLAB的视图功能第六节 图像、视频和声音;plot —— 最基本的…

嘉兴品牌网站初学者求教怎样做网站

序言 Sentinel 是阿里巴巴开源的一款流量防护与监控平台&#xff0c;它可以帮助开发者有效地管理微服务的流量&#xff0c;实现流量控制、熔断降级、系统负载保护等功能。本文将介绍如何在项目中部署和配置 Sentinel 控制台&#xff0c;实现微服务的流量防护和监控。 一、Sen…

深圳网站开发的公司网站建设与管理案例...

智能优化算法应用&#xff1a;基于适应度相关算法3D无线传感器网络(WSN)覆盖优化 - 附代码 文章目录 智能优化算法应用&#xff1a;基于适应度相关算法3D无线传感器网络(WSN)覆盖优化 - 附代码1.无线传感网络节点模型2.覆盖数学模型及分析3.适应度相关算法4.实验参数设定5.算法…

长春做网站公司企业名录搜索软件 2022

上一篇文章已经介绍了线程的基本概念以及线程相关的API&#xff0c;下面来看一下线程池 一、线程池框架 1、线程池的优点 重用线程池中的线程&#xff0c;避免因为线程的创建和销毁所带来的性能开销。 能有效控制线程池的最大并发数&#xff0c;避免大量线程之间因互相抢夺系…

可以登录国外网站吗宿州城乡建设局网站

转载自 JAVA面试常考系列三 题目一 什么是迭代器(Iterator)&#xff1f; 迭代器&#xff08;iterator&#xff09;是一种对象&#xff0c;它能够用来遍历标准模板库容器中的部分或全部元素&#xff0c;每个迭代器对象代表容器中确定的地址。迭代器提供了一种方法&#xff0c;可…

网站建设三个友好网络营销理论包括哪些

我不知道正确的方法&#xff0c;但是这种手动方法是我用于简单脚本的方法&#xff0c;似乎已经适当地执行了。我会假设我所在的任何目录&#xff0c;我的程序的Python文件都在相对的src /目录中&#xff0c;我要执行的文件(具有正确的shebang和执行权限)被命名为main.py。$ mkd…

火速收藏!2025 云栖大会 AI 中间件议程看点全公开(附免费报名通道)

AI 正在重塑世界,也在颠覆其应用的构建范式 AI 中间件正成为连接 AI 技术与产业应用的纽带 2025 云栖大会“云智一体 碳硅共生”的主题下 9月26日,云栖小镇D1-3馆「AI 中间件论坛」 将聚焦 AI 时代中间件的技术演进…

Flutter跨平台工程实践与原理透视:从渲染引擎到高质产物 - 指南

pre { white-space: pre !important; word-wrap: normal !important; overflow-x: auto !important; display: block !important; font-family: "Consolas", "Monaco", "Courier New", …

第二次软工作业——个人项目 - LXJ

github仓库:https://github.com/ApplePI-xu/3123004185这个作业属于哪个课程 https://edu.cnblogs.com/campus/gdgy/Class12Grade23ComputerScience这个作业要求在哪里 https://edu.cnblogs.com/campus/gdgy/Class12G…

WinForm引入项目资源文件

以Buttom按钮为例去引入 ,在Debug文件目录下 , 新建一个images文件夹 ,然后把要使用的资源(图片)拖进去 ​将资源加载到项目中去 ,点击 Properties下面的Resoures.resx , 然后把图片直接拖进去 效果如下: ​这个…

猪八戒做网站排名网页设计制作教程

消息队列在使用过程中会出现很多问题 首先就是消息的可靠性&#xff0c;也就是消息从发送到消费者接收&#xff0c;消息在这中间过程中可能会丢失 生产者到交换机的过程、交换机到队列的过程、消息队列中、消费者接收消息的过程中&#xff0c;这些过程中消息都可能会丢失。 …

境外社交网站上做推广手机排名

一、准备两台主机&#xff0c;区分主从 二、完全区域传送 1、主DNS服务器配置 #安装相关的包 [rootoula1 ~]# yum install bind -y#关闭防火墙 [rootoula1 ~]# systemctl stop firewalld [rootoula1 ~]# setenforce 0#修改配置主文件 [rootoula1 ~]# vim /etc/named.conf opt…