摘要: /** * @author gongchaobin * * Media录音类 */public class AudioRecoder { private static final String TAG = AudioRecoder.class.getSimpleName(); private MediaRecorder mRecorder; private MediaPlayer mPlayer; public static AudioRecoder instance; private AudioRecoder() { super(... 阅读全文
posted @ 2012-10-18 11:55 暗殇 阅读(207) 评论(0) 推荐(0)
摘要: /** * 获取当前的时间 * 时间格式:2012-01-12 */ public static String getNowTime(Date date){ SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); String nowTime = format.format(date); print(nowTime); return nowTime; } /** * 得到当月的第一天 */ p... 阅读全文
posted @ 2012-10-18 11:54 暗殇 阅读(153) 评论(0) 推荐(0)
摘要: /** * @author gongchaobin * * 翻书效果 * 2012-9-25 */public class TurnPage extends View{ private static final String TAG = TurnPage.class.getSimpleName(); private int mWidth = 620; private int mHeight = 770; private int mCornerX = 0; // 拖拽点对应的页脚 private int mCornerY = 0; private Path m... 阅读全文
posted @ 2012-10-18 11:52 暗殇 阅读(584) 评论(0) 推荐(1)
摘要: package com.cn.teachmobile.utils;import java.io.File;import java.io.FileOutputStream;import org.apache.tools.ant.Project;import org.apache.tools.ant.taskdefs.Expand;import de.innosystec.unrar.Archive;import de.innosystec.unrar.rarfile.FileHeader;/** * @author gongchaobin * * 解压缩zip rar文件 */public cl 阅读全文
posted @ 2012-10-15 11:42 暗殇 阅读(511) 评论(0) 推荐(0)
摘要: WindowManager.LayoutParams lp = new WindowManager.LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.TYPE_APPLICATION, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutP... 阅读全文
posted @ 2012-10-09 11:13 暗殇 阅读(277) 评论(0) 推荐(0)
摘要: package com.cn.teachmobile.view;import android.content.Context;import android.os.Handler;import android.util.AttributeSet;import android.view.MotionEvent;import android.view.View;import android.view.animation.AccelerateInterpolator;import android.view.animation.Animation;import android.view.animatio 阅读全文
posted @ 2012-10-08 17:59 暗殇 阅读(428) 评论(0) 推荐(0)
摘要: 用 Heap监测应用进程使用内存情况的步骤如下:1. 启动eclipse后,切换到DDMS透视图,并确认Devices视图、Heap视图都是打开的;2. 将手机通过USB链接至电脑,链接时需要确认手机是处于“USB调试”模式,而不是作为“Mass Storage”;3. 链接成功后,在DDMS的Devices视图中将会显示手机设备的序列号,以及设备中正在运行的部分进程信息;4. 点击选中想要监测的进程,比如system_process进程;5. 点击选中Devices视图界面中最上方一排图标中的“Update Heap”图标;6. 点击Heap视图中的“Cause GC”按钮;7. 此时在He 阅读全文
posted @ 2012-09-29 11:43 暗殇 阅读(393) 评论(0) 推荐(0)
摘要: java环境变量的配置:用鼠标右击“我的电脑”->属性->高级->环境变量系统变量->新建->变量名:JAVA_HOME 变量值:C:/Program Files/Java/jdk1.5.0_12(这只是我的JDK安装路径)系统变量->编辑->变量名:Path 在变量值的最前面加上:%JAVA_HOME%/bin;(若已经有Path项,无须另外新建,直接在后面加,但需用;与前面已有的项分隔开,注意这里是修改,不要把原来的path参数删掉,会出问题的)系统变量->新建->变量名:CLASSPATH 变量值:%JAVA_HOME%/lib;%J 阅读全文
posted @ 2012-09-26 23:40 暗殇 阅读(196) 评论(0) 推荐(0)
摘要: 在开发过程中,我们一般会碰到图片选择功能。它包括两部分:一个是通过直接调用系统的相册获取,一个是通过系统相机拍照获取。public class SelectImageUtil { private static final String TAG = SelectImageUtil.class.getSimpleName(); private Context mContext; private Intent mData; public SelectImageUtil(Context context,Intent data){ mContext ... 阅读全文
posted @ 2012-08-20 10:18 暗殇 阅读(282) 评论(0) 推荐(0)
摘要: Oauth认证作为当前主流的开发公共API认证方式,越来越受到一些开发者的使用。它主要是为了保证账号的安全性。下面以新浪微博API为例:OAuth2的authorize接口URLhttps://api.weibo.com/oauth2/authorizeHTTP请求方式GET/POST请求参数必选类型及范围说明client_idtruestring申请应用时分配的AppKey。redirect_uritruestring授权回调地址,站外应用需与设置的回调地址一致,站内应用需填写canvas page的地址。response_typefalsestring返回类型,支持code、token,默 阅读全文
posted @ 2012-08-11 15:14 暗殇 阅读(665) 评论(0) 推荐(0)
摘要: /**截屏操作 * * 把图片保存到SD卡 */ private void ScreenShot(View v,String fileName){ View view = v.getRootView(); view.setDrawingCacheEnabled(true); Bitmap bitmap = view.getDrawingCache(); FileOutputStream fos = null; File dirFile = new File(DIRPAT... 阅读全文
posted @ 2012-08-11 14:59 暗殇 阅读(329) 评论(0) 推荐(0)
摘要: public static String getWeiboResult(String url,String httpType) { HttpClient httpClient = getNewHttpClient();// HttpGet httpGet = null;// HttpPost httpPost = null;// if(StaticData.GET.equals(httpType)){// httpGet = new HttpGet(url);// }else if(StaticData.POST.equals(httpType)){// httpPo... 阅读全文
posted @ 2012-07-24 14:20 暗殇 阅读(557) 评论(0) 推荐(0)
摘要: /** * 上传图片到服务器 * @param uploadFile 要上传的文件目录 * @param actionUrl 上传的地址 * @return String */ public static HashMap<String, Object> uploadFile(String actionUrl,Drawable drawable){ Log.info(TAG, "urlPath= " + actionUrl); String end ="\r\n"; String twoHyphens ="-... 阅读全文
posted @ 2012-07-23 12:29 暗殇 阅读(940) 评论(0) 推荐(0)
摘要: package com.APPShare.db;import java.util.ArrayList;import java.util.List;import com.APPShare.Bean.AppBean;import com.APPShare.Bean.FriendBean;import com.APPShare.Bean.WeiboBean;import android.content.ContentValues;import android.content.Context;import android.database.Cursor;import android.database. 阅读全文
posted @ 2012-07-20 18:28 暗殇 阅读(491) 评论(0) 推荐(0)
摘要: 很多时候,我们从网络上获取到的图片只是一个Url地址。我们必须采用异步加载的方法,将图片显示才来。public class AsyncImageLoader { private HashMap<String, SoftReference<Drawable>> imageCache; public AsyncImageLoader() { imageCache = new HashMap<String, SoftReference<Drawable>>(); } public Drawable... 阅读全文
posted @ 2012-07-20 18:24 暗殇 阅读(244) 评论(0) 推荐(0)
摘要: List<String> list1 = new ArrayList<String>(); List<String> list2 = new ArrayList<String>(); list1.add("1"); list1.add("3"); list1.add("8"); list1.add("9"); list2.add("2"); list2.add("3"); list2.add("7"); fo 阅读全文
posted @ 2012-07-18 12:15 暗殇 阅读(2133) 评论(0) 推荐(0)
摘要: public class autoScrollView extends ScrollView { private View inner; private float y; private Rect normal = new Rect(); public autoScrollView(Context context) { super(context); // TODO Auto-generated constructor stub } public autoScrollView(Context conte... 阅读全文
posted @ 2012-06-08 15:08 暗殇 阅读(913) 评论(0) 推荐(0)
摘要: public class PageDragView extends ViewGroup{ private static final String TAG = PageDragView.class.getSimpleName(); /** * 用来追踪触摸事件(flinging事件和其他手势事件)的速率 * 用obtain()函数来获得类的实例, * 用addMovement(MotionEvent)函数将motion event加入到VelocityTracker类实例中, * 当你使用到速率时,使用computeCurrentVelocity... 阅读全文
posted @ 2012-06-04 17:02 暗殇 阅读(561) 评论(0) 推荐(0)
摘要: 很多情况下,我们需要自定义一些Dialog效果。首先继承系统的Dialog/** * @author gongchaobin * * 自定义Dialog样式 */public class SelfDialog extends Dialog implements android.view.View.OnClickListener{ private Context mContext; private Button mBtnCha; private Button mBtnUse; private ActivityManagerCommon managerCommon; ... 阅读全文
posted @ 2012-06-04 15:06 暗殇 阅读(296) 评论(0) 推荐(0)
摘要: private static final String TAG = MainActivity.class.getSimpleName(); private Button button ; private Notification notification; private NotificationManager manager; private String softwarePath; private int downedFileLength=0; private int fileLength; private static fin... 阅读全文
posted @ 2012-06-01 14:28 暗殇 阅读(343) 评论(0) 推荐(0)