随笔分类 -  Android

摘要:APP设计理念 阅读全文
posted @ 2013-01-31 10:02 晓晓軍 阅读(128) 评论(0) 推荐(0)
摘要:1、Toast 收到某一事件时 将信息在屏幕上显示一段时间后消失Toast.makeText(this, getResources().getString(R.string.hello),Toast.LENGTH_LONG).show();2、Intent 意图的跳转Intent intent1 = new Intent(this, AccountAddActivity.class);3、获取上下文菜单public void onCreateContextMenu(ContextMenu menu, View v,ContextMenuInfo menuInfo) {// MenuInfalt 阅读全文
posted @ 2012-10-31 19:50 晓晓軍 阅读(274) 评论(0) 推荐(0)
摘要:android 连接服务器 get请求在Activity中调用 JsonUtil工具类 只需要 调用findAll方法即可如:JsonUtil.findAll(strUrl); // strUrl: 连接地址若需要传值如s:strUrl = http:127.0.0.1:8080/xxxx?id=1&name=shsjhs;public class JsonUtil {public static String json;public static String findAll(String strUrl) throws Exception { // 创建请求HttpClient客户端 阅读全文
posted @ 2012-10-31 19:47 晓晓軍 阅读(204) 评论(0) 推荐(0)
摘要:JSONObject jsonObject = new JSONObject(jsonutil.json); // jsonutil.json 接收到服务端传递的数据 JSONArray jsonArray = jsonObject.getJSONArray("list_allFoods"); //服务端的List数组名 for (int y = 0; y < jsonArray.length(); y++) { //数组接收方法 JSONObject json = (JSONObject) jsonArray.get(y); //y 为数组下标 0,... 阅读全文
posted @ 2012-10-31 19:46 晓晓軍 阅读(192) 评论(0) 推荐(0)
摘要:1、// 获取屏的宽度和高度WindowManager windowManager = getWindowManager();Display display = windowManager.getDefaultDisplay();screenWidth = display.getWidth();screenHeight = display.getHeight();2、// 获取到这个图片的原始宽度和高度int picWidth = opt.outWidth;int picHeight = opt.outHeight;3、缩放图片 防止内存溢出BitmapFactory.Options opt 阅读全文
posted @ 2012-10-31 19:42 晓晓軍 阅读(256) 评论(0) 推荐(0)
摘要:android 读取xml文件2012-07-16 13:27:37|分类: 默认分类 |标签:android |字号大中小订阅导读:andorid读取xml文件内容方法有三种 sax dom pull,其中 pull是android自带的 ,这里主要介绍SAX,这种方法读取的效率稍微高些 项目中经常会用到一些原始的xml文件,那么我们可以定义一些xml供程序使用,xml文件放置在res\xml目录下, 通过Resources.getXML()方法访问。 项目结构如下 xml文件的内容如下: 读取XML文件的代码如下:- <resource> <County id=" 阅读全文
posted @ 2012-10-31 19:39 晓晓軍 阅读(731) 评论(0) 推荐(0)