摘要: 网络上查阅,ListView长按菜单有两种方式可以实现 第一种方式,需要三步 一、先定义ListView的长按菜单 ListView listView = (ListView) findViewById(R.id.main_listview); registerForContextMenu(listView); 二、为菜单添加详细的项目标题图标。 public ... 阅读全文
posted @ 2015-06-25 18:52 QQ28902581 阅读(717) 评论(0) 推荐(0) 编辑
摘要: 磕磕绊绊的写了第一个程序,电脑报价单。工作需要,经常做些报价单,所有就有了这个小程序。虽然能运行了,但其中的一些代码不甚了解,在这里做个学习总结。 基本界面。 用到SQLite数据库 package com.example.diyquote; import android.content.Context; import android.database.sqlit... 阅读全文
posted @ 2015-06-25 18:38 QQ28902581 阅读(185) 评论(0) 推荐(0) 编辑
摘要: SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date curDate = new Date(System.currentTimeMillis()); String date = formatter.format(curDate); 三个步骤,获取系统的日期和时间。 "yy... 阅读全文
posted @ 2015-06-15 14:45 QQ28902581 阅读(279) 评论(0) 推荐(0) 编辑
摘要: class Testa { public static void main(String[] args) { String aa="aaa"; String bb="bbb"+aa; aa="cccc"; System.out.println(bb); } } 输出的是 “bbbaaa ... 阅读全文
posted @ 2015-06-14 11:10 QQ28902581 阅读(154) 评论(0) 推荐(0) 编辑
摘要: 1、SimpleAdapter是ArrayList和ListView的桥梁,这个ArrayList礼拜的每一项都是一个Map类型。ArrayList当中的每一项Map对象都和ListView里边的每一项进行数据绑定一一对应。2、SimpleAdapter的构造函数:SimpleAdapter(Con... 阅读全文
posted @ 2015-06-07 10:28 QQ28902581 阅读(141) 评论(0) 推荐(0) 编辑
摘要: http://developer.android.com/reference/android/Manifest.permission.html 阅读全文
posted @ 2015-06-07 10:28 QQ28902581 阅读(140) 评论(0) 推荐(0) 编辑
摘要: public void onItemClick(AdapterView arg0, View view, int position, long arg3) 如上代码所述,请告诉我arg0到arg3分别代表什么,它们的作用是什么,请尽量让我明白. 举个例子:X, Y两个listview,X里有1,2,3,4这4个item,Y里有a,b,c,d这4个item。 如果你点了b这个item。如... 阅读全文
posted @ 2015-05-24 14:08 QQ28902581 阅读(165) 评论(0) 推荐(0) 编辑
摘要: onSaveInstanceState(Bundle outState)这个方法或携带一个Bundle类型的参数,Bundle提过了一系列的方法用于保存数据,比如可以使用putString()方法保存字符串,使用pubInt()方法保存证书类型的数据,以此类推。每个保存的方法需要传入两个参数,第一个... 阅读全文
posted @ 2015-05-17 18:43 QQ28902581 阅读(138) 评论(0) 推荐(0) 编辑
摘要: 通过intent传递上下文数据,需要用的函数startActivityForResult(Intent intent, int requestCode)intent Intent型,可以带数据传递个下一个Activity;requestCode int型 请求码:请求码的值是根据业务需要由自已设定,... 阅读全文
posted @ 2015-05-17 17:46 QQ28902581 阅读(87) 评论(0) 推荐(0) 编辑
摘要: 1、主Activity里有两个Button,点击每个Button都调用第二个NewActivity。2、从NewActivity里返回后,判断是从两个Button中的哪一个启动的NewActivity,并显示在TextView或者Toast上。MainActivitypackage com.exam... 阅读全文
posted @ 2015-05-17 17:33 QQ28902581 阅读(140) 评论(0) 推荐(0) 编辑