- 博客(22)
- 收藏
- 关注
原创 vm 中 centOS 7 固定ip设置
亲测可行。虚拟机中,centOS通过NAT连接,设置固定IP上网。本地主机 VMware Network Adapter VMnet8 状态信息:描述: VMware Virtual Ethernet Adapter for VMnet8IPv4 地址: 192.168.100.1IPv4 子网掩码: 255.255.255.0IPv4 默认网关: I
2016-12-29 15:08:01
711
原创 android 获取天气信息,解决了乱码的问题
android 获取天气信息,解决了乱码的问题private static String getWeatherInfo3() { try { URL url = new URL("http://www.weather.com.cn/data/cityinfo/101060101.html"); HttpURLConnection conn
2015-10-13 09:10:34
568
原创 android Internal storage 和External storage
android Internal storage 和External storage:android 删除文件保存到Internal Storage --->保密性文件的位置
2015-07-29 14:54:20
2011
原创 android 在listView中如果需要使用复选框功能,强烈建议使用图片作为背景代替checkBox。亲测好用
android 在listView中如果需要使用复选框功能,强烈建议使用图片作为背景代替checkBox。亲测好用。1,可以将该复选框的显示状态记录在一个字段中,if (this.list.get(position).isChecked()) { viewHolder.checkBox.setImageResource(R.drawable.checkbox_selected);}else { viewHolder.checkBox.setImageResource(R.drawab
2015-07-21 17:00:20
828
原创 android 通过UncaughtExceptionHandler 捕获RuntimeException,并将捕获到的信息上传到友盟
通过UncaughtExceptionHandler 捕获RuntimeException,并将捕获到的信息上传到友盟,便于开发者了解应用存在的问题。注意:需要集成友盟。工具类:import android.content.Context;import android.content.pm.PackageInfo;import android.content
2015-07-21 12:06:47
1175
原创 android 保存bitmap到指定文件
//保存bitmap到指定文件。 public static void saveBitmap(Bitmap bmp, String targetPath) { File file = new File(targetPath); if (!file.exists()) { try { file.
2015-07-20 22:27:31
657
原创 android 清空指定文件夹
//清空文件夹 public static void clearTemp(String dirPath){ File dir = new File(dirPath);//清空文件夹 File[] files = dir.listFiles(new ImageFileter()); if(null != files){
2015-07-20 22:20:17
2875
原创 android 工具类: 将汉字转换
// 将汉字转换。public class CharacterParser { private static int[] pyvalue=new int[] {-20319, -20317, -20304, -20295, -20292, -20283, -20265, -20257, -20242, -20230, -20051, -20036, -20032,
2015-07-20 18:15:13
1148
原创 android 打开pdf文件 从inputStream读取数据并保存为文件
/** * 打开pdf 文件,Get PDF file Intent。 * @param path 文件路径 * @return */public static Intent getPdfFileIntent(String path) { Intent i = new Intent(Intent.ACTION_VIEW); i.addCategory(Intent.CAT
2015-07-20 18:11:45
2163
原创 android 使用imageloader 获取图片时,如果需要带cookie
//universal imageloader获取图片时,若需要cookie,需在application中进行配置添加此类。importandroid.content.Context;import com.nostra13.universalimageloader.core.download.BaseImageDownloader;import java.io.IOException;i
2015-07-20 18:08:41
2674
1
原创 android 工具类:用来判断一个文件是不是图片,通过文件名
//工具类:用来判断一个文件是不是图片,通过文件名。 importjava.io.File;import java.io.FilenameFilter;/** * 工具类:用来判断一个文件是不是图片,通过文件名。 */public class ImageFileter implements FilenameFilter { public boolean isGif(St
2015-07-20 18:06:40
2095
原创 android 获取设备唯一标识:imei 通过TelephonyManager
// 获取设备唯一标识:imei 通过TelephonyManagerpublic static String getImei(Context context, String imei) { try { TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Con
2015-07-20 18:04:50
4493
原创 android 判断网络是否连接 通过NetworkInfo
1,// 判断网络是否连接 通过NetworkInfopublic static boolean isConnected(Context context) { ConnectivityManager conn = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); Netw
2015-07-20 18:01:10
1040
原创 android 通过ApplicationInfo 从androidmanifest 中的application中读取信息。
1,// 取得AppKey 通过ApplicationInfo 从androidmanifest 中的application中读取信息。public static String getAppKey(Context context) { Bundle metaData = null; String appKey = null; try { Appl
2015-07-20 17:54:30
1133
原创 通过正则表达式 判断给定的字符串是不是符合要求
通过正则表达式 判断给定的字符串是不是符合要求常用一:// 校验Tag Alias 只能是数字,英文字母和中文public static boolean isValidTagAndAlias(String s) { Pattern p = Pattern.compile("^[\u4E00-\u9FA50-9a-zA-Z_-]{0,}$"); Matcher m
2015-07-20 16:56:59
2920
原创 Android 获取手机中的图片信息的两种方法
1, Android 使用ContentProvider扫描手机中的图片2, 通过遍历找到所有的图片格式的文件。强烈推荐使用第二种方法,准确。
2015-07-10 17:16:41
7918
原创 android应用实现自动升级从本地服务器,通过一个工具类
android应用实现自动从自己的服务器升级,一个工具类搞定,非常方便好用。亲测可用private UpdateFromServerUtil updateFromServerUtil;@Overridepublic void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
2015-07-03 16:44:37
577
1
原创 android开发中使用Gson进行对象和Json之间的转换很方便
android开发中使用Gson进行对象和Json之间的转换很方便。 Gson gson = new Gson();String jsons = gson.toJson(eventLogList); Result result = gson.fromJson(response, Result.class);附言:需要add 相关libraryd
2015-07-03 09:37:36
770
原创 android 应用通过友盟进行自动升级简介
1, android端集成友盟自动更新基本功能简介:2, 如何在友盟官网上传apk到现有项目:3, 关于友盟自动更新的相关测试结果:
2015-07-03 09:13:38
1513
原创 使用maven 一行命令自动生成签名后的apk
使用maven 一行命令自动生成签名后的apk,在项目所在目录打开命令行界面,输入maven clean package,即可在配置的目标apk生成位置找到签名成功的apk。
2015-07-03 08:54:48
1426
原创 android 自定义VideoView全屏显示 不会出现黑条
亲测可行,只需要将XML文件中的VideoView换成自定义的MyVideoView即可。
2015-06-25 12:49:15
1611
原创 Android 代码中使用Color工具类 parseColor
arg1.setBackgroundColor(Color.parseColor("#87CEFA"));
2015-06-18 09:08:14
29036
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人