登录
首页 » Unix_Linux » sinamicro1

sinamicro1

于 2012-09-26 发布 文件大小:677KB
0 209
下载积分: 1 下载次数: 20

代码说明:

  新浪微博的安卓客户端,这个客户端是我自己做的,很有特点~(The Sina microblogging Andrews clients, this client is my own doing, is very characteristic to)

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • android-obtain-screen-into
    本文介绍在android上面如何获取屏幕信息。(This article describes the screen android above how to obtain information.)
    2013-01-30 16:22:00下载
    积分:1
  • ANE
    Adobe Air是利用Adobe公司的Flash技术开发的媒体播放平台。而Native Extension就是让AIR可以调用各个平台上的本地代码(native code, 如ios上的object-c,android上的java,desktop上的c++,ca#等),从而完成对AIR中Actionscript API的自定义扩展。即可以让开发者通过编写基于平台的本地代码扩展ActionScript。从而完成一些原有Actionscript无法完成的功能。(Adobe Air is developed by using Adobe s Flash technology media platform. While the Native Extension is to make AIR calls on every platform native code (native code, such as IOS Object-C, Android Java, desktop c++, c#), thus completing the extensions to the AIR Actionscript API custom. That allows developers to write native code through the platform based on ActionScript. In order to complete some of the original Actionscript cannot perform the function. )
    2013-09-25 11:19:28下载
    积分: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
  • MediaPlayer_Service
    MP3音乐播放器代码,主要实现从sd卡中读取MP3文件,界面有播放暂停,上一首,下一首四个按钮(MP3 music player code, the main implementation MP3 files, read the sd card interface are suspended, a song, a four button)
    2020-09-29 09:37:43下载
    积分:1
  • Android 签到系统源码
    Android 签到系统源码
    2016-02-29下载
    积分:1
  • com.baidu.mapapi.overlay
    绘制百度地图的自我规划路线图,为百度地图演示(Self-planning road map for drawing Baidu map, demo for Baidu map)
    2019-03-14 12:18:58下载
    积分:1
  • clock
    说明:  android下实例clock源码,需要在eclipse环境下运行(android source code under the instance of the clock, you need to run under eclipse)
    2011-03-21 10:51:59下载
    积分:1
  • IPC
    安卓系统中进程通信的例程,利用IPC机制进行服务端与客户端的进程通信(Andrews in the process of communication routines, the use of the IPC mechanism to carry out the process of communication services and the clients)
    2012-07-12 15:45:36下载
    积分:1
  • android 九宫格滑动解锁实例源码下载
    android 九宫格滑动解锁实例源码下载
    2014-09-02下载
    积分:1
  • FrameLayoutTest
    android学习工程,主要用framelayout帧布局来实现霓虹灯效果,类似于流水灯一样。(android study engineering, layout of framelayout frame to achieve the neon effect, similar to the light water.)
    2013-04-23 23:20:25下载
    积分:1
  • 696516资源总数
  • 106914会员总数
  • 0今日下载