上一页 1 ··· 3 4 5 6 7 8 9 10 下一页
摘要: 1 /TestGridView/res/layout/main.xml:<?xml version="1.0" encoding="utf-8"?><GridView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/gridview" android:layout_width="fill_parent" android:layout_height="fill_par 阅读全文
posted @ 2012-01-03 16:09 程序学习笔记 阅读(192) 评论(0) 推荐(0) 编辑
摘要: 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 seria... 阅读全文
posted @ 2012-01-03 16:01 程序学习笔记 阅读(546) 评论(0) 推荐(0) 编辑
摘要: 方法A:1.5版本到2.1版本的退出方法是ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); activityManager.restartPackage("包名"); 2.2版本必须把后台数据清空了:步骤1: /** * activityList:所有activity对象,用于退出时全部finish; Activity走onCreate时,添加到该集合 */ public static List<Activity 阅读全文
posted @ 2011-11-09 22:44 程序学习笔记 阅读(7993) 评论(0) 推荐(2) 编辑
摘要: 一、Activity和Task(栈)的关系 Task就像一个容器,而Activity就相当与填充这个容器的东西,第一个东西 (Activity)则会处于最下面,最后添加的东西(Activity)则会在最低端。从Task中取出东西(Activity)则是从最顶端取出,也 就是说最先取出的是最后添加的东西(Activity),一次类推,最后取出的是第一次添加的Activity,而Activity在Task中的顺序是 可以控制的,那则在Activity跳转时用到Intent Flag 二、界面跳转和服务的启动都会用到Intent,现在介绍Intent Flag是关于Activity的跳转 In... 阅读全文
posted @ 2011-11-09 22:11 程序学习笔记 阅读(7424) 评论(0) 推荐(1) 编辑
摘要: //去掉系统title requestWindowFeature(Window.FEATURE_NO_TITLE); 阅读全文
posted @ 2011-11-09 22:07 程序学习笔记 阅读(150) 评论(0) 推荐(0) 编辑
摘要: 横竖屏判断: // 横屏判断 if (this.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { // 横屏代码 } // 竖屏判断 if (this.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) { // ... 阅读全文
posted @ 2011-11-09 22:05 程序学习笔记 阅读(226) 评论(0) 推荐(0) 编辑
摘要: 1.首先,在values文件夹下定义一个atts.xml的文件,描述自定义的控件的属性,在values/attrs.xml中的代码如下: 1 <?xml version="1.0" encoding="utf-8"?> 2 <resources> 3 <declare-styleable name="TestView"> 4 <attr name="textColor" format="color" /> 5 <attr name=" 阅读全文
posted @ 2011-10-30 16:00 程序学习笔记 阅读(555) 评论(1) 推荐(0) 编辑
摘要: File pathFile = Environment.getExternalStorageDirectory();StatFs statfs = new StatFs(pathFile.getPath());//获得可供程序使用的Block数量long nAvailaBlock = statfs.getAvailableBlocks();//获得SDCard上每个block的SIZElong nBlocSize = statfs.getBlockSize();//计算SDCard剩余大小MBlong nSDFreeSize = nAvailaBlock * nBlocSize / 1024 阅读全文
posted @ 2011-10-30 15:56 程序学习笔记 阅读(278) 评论(0) 推荐(0) 编辑
摘要: 一、首先找到以下2个路径(本人电脑android虚拟机安装路径)D:\Downloads\android-sdk_r08-windows\android-sdk-windows\platform-toolsD:\Downloads\android-sdk_r08-windows\android-sdk-windows\tools二、环境变量中添加内容1、右键单击【我的电脑】的属性2、点击【高级】选项卡3、打开高级选项中的【环境变量】4、在【系统变量】中点击【新建】添加内容。如下:编辑系统变量变量名:Android变量值:D:\Downloads\android-sdk_r08-windows\ 阅读全文
posted @ 2011-10-30 15:55 程序学习笔记 阅读(641) 评论(0) 推荐(0) 编辑
摘要: 1.代码:Activity: 1 package com.vanceinfo.KeyEvent; 2 3 import android.app.Activity; 4 import android.os.Bundle; 5 import android.view.KeyEvent; 6 import android.view.MotionEvent; 7 import android.view.View; 8 import android.view.View.OnClickListener; 9 import android.widget.Button; 10 import... 阅读全文
posted @ 2011-10-30 15:54 程序学习笔记 阅读(211) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 10 下一页