摘要:        
1:包结构如下:2:MyService.javapublic class MyService {	public int add(int a,int b){ return a+b;	} public int cal(int a,int b){ return a*b;	}}3:MyServiceTest.javapublic class MyServiceTest extends AndroidTestCase {	MyService ms=new MyService(); public void testAdd(){ int sum=ms.add(1, 2); Assert.asse...    阅读全文
posted @ 2013-10-11 12:04
yshy
阅读(240)
评论(0)
推荐(0)
        
            
        
        
摘要:        
1:activity_main.xml 2:文件操作类:FileService.javapublic class FileService {	private Context context=null; public FileService(Context context){ this.context=context;	} //save file	public void saveFile(String filename,String content) throws Exception{ FileOutputStream...    阅读全文
posted @ 2013-10-11 11:11
yshy
阅读(1842)
评论(0)
推荐(0)
        
            
        
        
摘要:        
/** * 检查是否安装SD卡 * @return */	public static boolean checkSaveLocationExists() { String sDCardStatus = Environment.getExternalStorageState(); boolean status; if (sDCardStatus.equals(Environment.MEDIA_MOUNTED)) { status = true; } else status = false; return status; }}    阅读全文
posted @ 2013-10-11 09:43
yshy
阅读(314)
评论(0)
推荐(0)
        
            
        
        
摘要:        
/** * 检测网络是否可用 * @return */	public boolean isNetworkConnected() { ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo ni = cm.getActiveNetworkInfo(); return ni != null && ni.isConnectedOrConnecting();	}    阅读全文
posted @ 2013-10-11 09:08
yshy
阅读(206)
评论(0)
推荐(0)
        
            
        
        
摘要:        
/** * 获取当前网络类型 * @return 0:没有网络 1:WIFI网络 2:WAP网络 3:NET网络 */	public int getNetworkType() { int netType = 0; ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo(...    阅读全文
posted @ 2013-10-11 09:07
yshy
阅读(383)
评论(0)
推荐(0)
        
            
        
        
摘要:        
1:首先在res/anim/文件夹下建立动画xml文件。2:在java代码中对UI控件使用动画。//加载动画 Animation myAnim=AnimationUtils.loadAnimation(this, R.anim.my_anim);//对UI控件开启动画 tvShow.startAnimation(myAnim);3:说明Android的animation由四种类型组成在XML文件中:alpha渐变透明度动画效果scale渐变尺寸伸缩动画效果translate画面转换位置移动动画效果rotate画面转移旋转动画效果在Java 源码中定义了相应的类,可以使用这些类的方法来获取和..    阅读全文
posted @ 2013-10-11 08:29
yshy
阅读(288)
评论(0)
推荐(0)
        
            
        
        
摘要:        
1:~$ vim .bashrc2:在打开的.bashrc文件中加入:alias adt='./adt-bundle-linux-x86-20130729/eclipse/eclipse'3:保存退出。4:注销用户重新登录。5:打开终端输入:~$ adt    阅读全文
posted @ 2013-10-11 07:19
yshy
阅读(198)
评论(0)
推荐(0)
        
 
                     
                    
                 
                    
                
 
         浙公网安备 33010602011771号
浙公网安备 33010602011771号