随笔分类 - Android
摘要:/** * 数据绑定,分页显示 */ private void updataMenu(final EditText search) { if(listwz==null) { return; } pageID =0; listwz.setAdapter(null); FilterArray = new JSONArray(); FilterArray = usedatabase.WzArray(search.getText().toString(),...
阅读全文
摘要:ActionBar完美兼容Android4.x的机型,虽然现在Android2.x的系统越来越少,还有有一部分人使用的仍是2.x的系统,所以我们还得考虑着兼容性问题。对比图:Test例子与微信的对比,测试机型SONY XPERA Mt27i Android2.3.7在Android官网中我们可以看到有这样一个更新包,android-support-v7,这个包就是专门解决ActionBar的向下兼容性问题。第一步:在 \extras\android\support这个目录下面有v7这个包(当然你必须把自己的SDK更新到最新),打开找到appcompat这个项目,作为Android项目导入Ecl
阅读全文
摘要:金山词霸开发的免费API http://open.iciba.com/dsapi/数据格式为{"sid":"737","tts":"http:\/\/news.iciba.com\/admin\/tts\/2013-12-11.mp3","content":"I don't want us to be together because we have to,I want us to be together because we want to.","note
阅读全文
摘要:这些天业余时间比较多,闲来无事,想起了以前看过开发任意网站客户端的一篇文章,就是利用jsoup解析网站网页,通过标签获取想要的内容。好了废话不多说,用到的工具为 jsoup-1.7.2.jar包,具体jsoup的相关文档,请去这边看http://jsoup.org/,这里有全部Api可以查询。这里解析的网站是一个食谱网站,首先解析的是大类栏目标签。如果你使用过jquery那么 ,接下来的事情就小菜一碟了,我们按F12进入浏览器的开发者模式,去分析当前html页面的结构,如下图:每个标签里面的值就是我们需要的,接下来我们需要异步去获取网页信息,首先创建一个连接,生成一个Document对象,取得
阅读全文
摘要:public class Toolkit { /** * * Role:Telecom service providers获取手机服务商信息 * * 需要加入权限 * Date:2012-3-12 * * @author CODYY)allen */ public static String getProvidersName(Context context) { String ProvidersName = "nosim"; try { // 返回唯一的用户...
阅读全文
摘要:&ZhuoTai_Name=205&NoSongDanDish=0&OrderZhuoTai_ID=aca87b77797e4c859a53c228471a2636&ZZFlavorTypeGuid=&ZhuoTaiDishOrder=10&Order_Code=2013100900001&OrderFaPiaoMoney=0.00&YuanShiMoney=180.00&ChengBenMoney=0.00&QBmoney=180.00&ZKmoney=0.00&FJFmoney=0.00&
阅读全文
摘要:Service是Android的四大组件之一,这里就不再过多的去描述,下面主要实现启动应用时候利用service后台执行计划任务,退出应用后,关闭service,只存在整个应用的周期中。首先使用service需要在manifest中的Application 中注册 写一个WxService类,继承于Service,然后实现它的一些方法。public class WxService extends Service{ @Override public IBinder onBind(Intent intent) { // TODO Auto-genera...
阅读全文
摘要:@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if(keyCode==KeyEvent.KEYCODE_BACK) { return true; } return false; }
阅读全文
摘要:首先假设有这么一个JSONArrayJSONArray Array1;JSONArray ITEM = new JSONArray();name为你获取要删除的字段名称,IETM就是你删除后得到的新的JSONArray数组了 String name = null; try { name = orderDish.getString("name"); JSONObject odItems = null; ...
阅读全文
摘要:最近有个需求,在过滤的列表上一直弹出输入框,让用户选择下单,也就是说在下单按钮触发后,再次自动弹出输入框,Editext获取焦点。具体实现代码:Timer timer = new Timer(); timer.schedule(new TimerTask(){ @Override public void run() { InputMethodManager m = (InputMethodManager) txtSearchKey.getCon...
阅读全文
摘要:效果如图,具体功能是得到一个最大数量值5,然后构造一个这样的列表让用户选择。首先定义一个数量值:int num = 5; //指定数量值然后构造String数组 String[] nums = new String[(int) num]; for (int i = 0; i < nums.length; i++) { nums[i] = "" + (i + 1); } 弹出AlertDialogfinal Builder b = new Alert...
阅读全文
摘要:aa=aa.replaceAll("\"ccfsID\":\"[0-9]*\"", "\"ccfsID\":\""+id1+"\"");aa为json字符串,如:{"items":[{"dishprice":30,"ccfsID":"","order.item.id":1,"zuofaid":"","zuof
阅读全文
摘要:. 查询手机:http://www.yodao.com/smartresult-xml/search.s?type=mobile&q=手机号码2. 查询IP:http://www.yodao.com/smartresult-xml/search.s?type=ip&q=IP地址3. 查询身份证:http://www.yodao.com/smartresult-xml/search.s?type=id&q=身份证号码快递查询接口 http://webservice.36wu.com/ExpressService.asmxip查询接口 http://webservice.3
阅读全文
摘要:public static JSONArray TcDishitems (){ JSONObject item = null; JSONArray itemarry = new JSONArray() ; try{ item.put( "ID", Share. operatorId) .put( "number", "") .put( "name", tcdish. ScombXDish_Dish_Name) .put( "tzs", "") .put( "ad..
阅读全文
摘要:public void onAttachedToWindow () { System.out.println("---------------->onAttachedToWindow"); this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD); super.onAttachedToWindow(); }android:launchMode="singleTask" 配置在 Mainifest 中,它保证了栈中此Activity总是只有...
阅读全文
摘要:1、最近翻看以前的项目时候,想更改下布局文件,谁知道就改了个参数就提示如下的报错,百思不得其解,原来是这样解决的。小记一下。更改layout的xml之后报错incorrect line ending found carriage return without corresponding newlin...
阅读全文
摘要:SharedPreferences经常用来存储一些小的数据,比如把用户名密码记录在本地,当然,它的数据时存储在本机中的,如果应用程序的数据被清除,这里面的存储数据也就没有了。之前做过一个判断用户是否是安装后第一次进入软件,便用到了这个来进行数据存储,这段日子做的项目中又有这个需求,下边贴出一个用于SharedPreferences存储的工具类。public class Editer { Context ct; SharedPreferences preferences; public Editer(Context ct) { this.ct=ct; ...
阅读全文
摘要:最近做一个类似滑动菜单栏的title,绑定数据源用的是GrildView,想要实现横着滑动并且GrildView只显示一行。最终采用代码形式在Activity中动态的添加布局实现。 ViewGroup.LayoutParams params = dishtype.getLayoutParams(); // dishtype,welist为ArrayList int dishtypes = welist.size(); params.width = 115 * dishtypes; ...
阅读全文

浙公网安备 33010602011771号