获取手机的序列号

 1 try
2 {
3 String serialnum = null;
4 Class<?> c = Class.forName("android.os.SystemProperties");
5 Method get = c.getMethod("get", String.class,String.class);
6 serialnum = (String)(get.invoke(c, "ro.serialno","unknown"));
7 serialnum_textView.setText(serialnum);
8 }
9 catch (ClassNotFoundException e)
10 {
11 e.printStackTrace();
12 }
13 catch (SecurityException e)
14 {
15 e.printStackTrace();
16 }
17 catch (NoSuchMethodException e)
18 {
19 e.printStackTrace();
20 }
21 catch (IllegalArgumentException e)
22 {
23 e.printStackTrace();
24 }
25 catch (IllegalAccessException e)
26 {
27 e.printStackTrace();
28 }
29 catch (InvocationTargetException e)
30 {
31 e.printStackTrace();
32 }

serialnum 即为手机的序列号

posted @ 2012-01-03 16:01  程序学习笔记  阅读(553)  评论(0编辑  收藏  举报