-
演示Android自动同步机制的测试例子
演示Android自动同步机制的测试例子,换种说法也就是说自动同步就是几个线程自动的过一段时间执行一次看看服务器端有没有更新而已。也就是每过一段时间执行一次线程。
- 2022-02-04 13:33:54下载
- 积分:1
-
MusicPlayer音乐播放器
说明: 手机音乐播放器是一种在手机上用于播放各种音乐文件的多媒体播放软件。它涵盖了各种音乐格式的播放工具,比如:手机自带播放器、MP3播放器,WMA播放器,MP4播放器等,目前手机音乐播放器主要支持的格式有MP3、WMA、AAC、AAC+、MID、AMR、OGG、MP4、FLAC等,它们在手机中运行,不仅界面美观,而且操作简单,带你进入一个完美的音乐空间。(A mobile music player is a multimedia playing software for playing various music files on a mobile phone. It covers a variety of music format playback tools, such as: mobile phone player, MP3 player, WMA player, MP4 player, etc. Currently mobile phone music player mainly supports MP3, WMA, AAC, AAC+, MID, AMR, OGG, MP4, FLAC, etc., they run in the mobile phone, not only the interface is beautiful, but also easy to operate, bringing you into a perfect music space.)
- 2020-06-18 13:20:01下载
- 积分:1
-
微信公众平台开发模式(JAVA) SDK/微信app
【核心代码】package com.gson;import java.io.File;import java.io.FileInputStream;import java.io.FileNotFoundException;import java.io.IOException;import java.lang.reflect.Field;import java.lang.reflect.Method;import java.util.Date;import java.util.Properties;import javax.servlet.Filter;import javax.servlet.FilterChain;import javax.servlet.FilterConfig;import javax.servlet.ServletException;import javax.servlet.ServletInputStream;import javax.servlet.ServletRequest;import javax.servlet.ServletResponse;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import org.apache.log4j.Logger;import com.gson.bean.Articles;import com.gson.bean.InMessage;import com.gson.bean.OutMessage;import com.gson.bean.TextOutMessage;import com.gson.inf.MessageProcessingHandler;import com.gson.util.Tools;import com.gson.util.XStreamFactory;import com.thoughtworks.xstream.XStream;/** * 请求拦截 * * @author GodSon * */public class WeChatFilter implements Filter { private final Logger logger = Logger.getLogger(WeChatFilter.class); private String _token; private String conf = "classPath:wechat.properties"; private String defaultHandler = "com.gson.inf.DefaultMessageProcessingHandlerImpl"; private Properties p; @Override public void destroy() { logger.info("WeChatFilter已经销毁"); } @Override public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) req; HttpServletResponse response = (HttpServletResponse) res; Boolean isGet = request.getMethod().equals("GET"); String path = request.getServletPath(); String pathInfo = path.substring(path.lastIndexOf("/")); if (pathInfo == null) { response.getWriter().write("error"); } else { _token = pathInfo.substring(1); if (isGet) { doGet(request, response); } else { doPost(request, response); } } } private void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException { response.setCharacterEncoding("UTF-8"); response.setContentType("text/xml"); OutMessage oms = new OutMessage(); ServletInputStream in = request.getInputStream(); // 转换微信post过来的xml内容 XStream xs = XStreamFactory.init(false); xs.alias("xml", InMessage.class); String xmlMsg = Tools.inputStream2String(in); logger.debug("输入消息:[" xmlMsg "]"); InMessage msg = (InMessage) xs.fromXML(xmlMsg); // 获取自定消息处理器,如果自定义处理器则使用默认处理器。 String handler = p.getProperty("MessageProcessingHandlerImpl"); if (handler == null) handler = defaultHandler; try { // 加载处理器 Class clazz = Class.forName(handler); MessageProcessingHandler processingHandler = (MessageProcessingHandler) clazz.newInstance(); // 取得消息类型 String type = msg.getMsgType(); Method mt = clazz.getMethod(type "TypeMsg", InMessage.class); oms = (OutMessage) mt.invoke(processingHandler, msg); if (oms == null) { oms = new TextOutMessage(); ((TextOutMessage) oms).setContent("系统错误!"); } setMsgInfo(oms,msg); } catch (Exception e) { logger.error(e); oms = new TextOutMessage(); ((TextOutMessage) oms).setContent("系统错误!"); try { setMsgInfo(oms,msg); } catch (Exception e1) { logger.error(e); } } // 把发送发送对象转换为xml输出 xs = XStreamFactory.init(true); xs.alias("xml", oms.getClass()); xs.alias("item", Articles.class); String xml = xs.toXML(oms); logger.debug("输出消息:[" xml "]"); response.getWriter().write(xml); } private void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { String signature = request.getParameter("signature");// 微信加密签名 String timestamp = request.getParameter("timestamp");// 时间戳 String nonce = request.getParameter("nonce");// 随机数 String echostr = request.getParameter("echostr");// // 验证 if (Tools.checkSignature(_token, signature, timestamp, nonce)) { response.getWriter().write(echostr); } } private void setMsgInfo(OutMessage oms,InMessage msg) throws Exception { // 设置发送信息 Class outMsg = oms.getClass().getSuperclass(); Field CreateTime = outMsg.getDeclaredField("CreateTime"); Field ToUserName = outMsg.getDeclaredField("ToUserName"); Field FromUserName = outMsg.getDeclaredField("FromUserName"); ToUserName.setAccessible(true); CreateTime.setAccessible(true); FromUserName.setAccessible(true); CreateTime.set(oms, new Date().getTime()); ToUserName.set(oms, msg.getFromUserName()); FromUserName.set(oms, msg.getToUserName()); } /** * 启动的时候加载wechat.properties配置 可以在过滤器配置wechat.properties路径 */ @Override public void init(FilterConfig config) throws ServletException { String cf = config.getInitParameter("conf"); if (cf != null) { conf = cf; } String classPath = this.getClass().getResource("/").getPath().replaceAll("%20", " "); conf = conf.replace("classPath:", classPath); p = new Properties(); File pfile = new File(conf); if (pfile.exists()) { try { p.load(new FileInputStream(pfile)); } catch (FileNotFoundException e) { logger.error("未找到wechat.properties", e); } catch (IOException e) { logger.error("wechat.properties读取异常", e); } } logger.info("WeChatFilter已经启动!"); }}
- 2014-01-21下载
- 积分:1
-
某500强android学习资料
某500强android学习资料
- 2015-01-28下载
- 积分:1
-
android音乐播放器
android音乐播放器
- 2015-01-03下载
- 积分:1
-
finalassignment
android 移动应用系统设计
1、最后提交两部分内容
a. 对一个功能的实现+实验报告(该项作为平时作业成绩)
- 可以选择上课中所演示的任意功能,截图完成实验报告
- 需要提交程序 + 3-5页的实验报告
b. 从以下网址下载一个app源码,或者其它地方的源码,对代码进行详细解析(该项作为期末课程考核成绩)
- 推荐下载网址为:http://www.devstore.cn/code/list/pn1-or0.html
- 需要提交下载的源码,和对该源码实现的分析报告,不少于8页
2、将所有内容按下面两个目录进行存放,打包以“学号+姓名” 命名,上传到作业ftp
- 实验
- 课程综合(android mobile application system design 1, the final submission of two parts a test report achieve+ a function (such as the usual job performance)- You can any function demonstrated in class, theme complete test report- to be submitted program+ Experimental report b 3-5 pages downloaded the following URL an app source code, or elsewhere source, detailed analysis of the code (such as the end of course examination results)- Recommended download site at: http: //www.devstore .cn/code/list/pn1-or0.html- to submit to download the source code, and analysis of the source code to achieve, at least 8 2, all the content stored in the following two directories, packed to " learn No.+ name " name, upload to job ftp- Experiment- Integrated Course)
- 2015-11-17 10:36:12下载
- 积分:1
-
Spinner使用
基于android 控件Spinner的使用方法,主要讲解了如何使用Spinner做list,android中listview类的使用,android viewadapter的使用等等,适合初学者使用,版本要求 api 15以上即可,我的邮箱wll163333@163.com,欢迎有问题咨询。
- 2022-12-11 21:25:03下载
- 积分:1
-
fdx
开发安卓短信软件,短信收取,发送,等简单功能(Android SMS software development, SMS received, sent, and other simple functions)
- 2014-05-04 20:35:20下载
- 积分:1
-
andbook
This document was written for developers who have worked with Java™ before and want to start developing for the Android Platform. I tried to make this as much “hands on” as possible, placing example codes everywhere it fit. Also I tried to insert as many picture as possible, because they liven up the learning process and relax the reader’s eyes.
- 2011-12-01 15:09:27下载
- 积分:1
-
将PC电脑端的文件通过usb传到android手机中 示例源码下载(含android和pc端完整源码)
将PC电脑端的文件通过usb传到android手机中 示例源码下载(含android和pc端完整源码)
- 2014-06-23下载
- 积分:1