`
文章列表

json的解析

解析json:   一个{}是一个JSONObject。 使用JSONObject的optString (String key)  就可以获得 String的字符串。 一个[]是一个JSONArray 数组,使用JSONArray 数组的getString (int index)  就可以获得String 的字符串。   JSONArray  jsonArray  ;     JSONArray中如果是多个JSONObject。可以使用jsonArray.getJSONObject
AlarmManager   手动设定手机的显示时间,只要大于或者等于AlarmManager 定的下次扫描时间就会触发闹钟   重复启动activity;   Intent intent = new Intent(context, TestActivity.class); intent.putExtra("type", type); PendingIntent pi = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); AlarmManager ...

4.0 技术 文档

http://developer.android.com/design/patterns/app-structure.html

dp 和 dip

关于 dip 和  dp :   经过测试在400*800的屏幕上100dip=139px   1px=0.72dip  

监听 home 键

监听HOME键的文章:http://dev.10086.cn/cmdn/bbs/thread-61702-1-1.html     http://blog.csdn.net/tjd0227/article/details/5601941     http://blog.csdn.net/JavaTiger427/article/details/6149501   http://www.chinese-it.com/plus/view-3611-1.html http://blog.163.com/whatwhyhow@126/blog/static/13342238920113 ...
1、快捷方式权限:      <uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />   2、创建步骤:      Intent addIntent=new Intent("com.android.launcher.action.INSTALL_SHORTCUT"); Parcelable icon = Intent.ShortcutIconResource.fromContext(ShortC ...

notification

notification 参考:   http://www.learningandroid.net/blog/others/tutorial-android-notification-sample/   http://www.cnblogs.com/newcj/archive/2011/03/14/1983782.html
   允许输入数字 、 英文:     /*** * 判断字符串是否由26个英文字母和数字组成 * @param password * @return */ public static boolean isRightPassword(String password){ String string = "^[A-Za-z0-9@#$%&*]+$"; Pattern mPattern = Pattern.compile(string); Matcher matcher = mPattern.matcher(pass ...

hander

handler 中的发送message:   int HANDLER_INSTALLED_FINISH = 1; String packageName = "com.app"; public final Message obtainMessage (int what, Object obj) mHandler.sendMessage(mHandler.obtainMessage(HANDLER_INSTALLED_FINISH, packageName));  

calendar 类的使用

使用calendar类设定指定的时间:   下周,或者下个月 Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.YEAR, 2013); //设定年份 // calendar.set(Calendar.MONTH, 10); //设定月份,显示的比当前多一个月 calendar.set(Calendar.DAY_OF_MONTH, 20); //设定日期 calendar.set(Calendar.HOUR_OF_DAY, 1 ...

textview 小结

1、android:ems  ——设置为n个汉字的宽度。 textview的宽度设了wrap_content   2、跑马灯效果:    android:focusable="true" android:focusableInTouchMode="true" android:singleLine="true" android:ellipsize="marquee" android:marqueeRepeatLimit="marquee_forever& ...

中文API

 
textview的中文API   http://www.cnblogs.com/over140/archive/2010/08/27/1809745.html
判断字符串是否为空:   TextUtils.isEmpty("jfkdjfkjdfkjdk")
继承PreferenceActivity 的使用   链接:   http://blog.csdn.net/sfrysh/article/details/5985117   http://www.cnblogs.com/keyindex/articles/1814506.html

获取屏幕宽高

获取屏幕宽高的2种方法:   Display display = getWindowManager().getDefaultDisplay(); Log.d("view" , "height:" +display.getHeight()); Log.d("view" , "width:" +display.getWidth());   DisplayMetrics displayMetrics = getResources().getDisplayMetrics();Log.d("view ...
Global site tag (gtag.js) - Google Analytics