上一页 1 ··· 28 29 30 31 32 33 34 35 36 ··· 45 下一页
  2012年6月24日
摘要: 开启内置闹钟: Intent intent = new Intent(); intent.setAction("android.intent.action.SET_ALARM"); startActivity(intent); 开启所有程序的画面: startActivity(new Intent("android.provider.Settings.ACTION_MANAGE_ALL_APPLICATION_SETTINGS")); 开启指定程序的细节画面: //取得所有的PackageName PackageManager pm = getPacka 阅读全文
posted @ 2012-06-24 17:11 lee0oo0 阅读(2675) 评论(0) 推荐(0) 编辑
  2012年6月21日
摘要: Andorid应用会在打包成Apk时把应用中使用的资源文件都打包进去了,尤其是我们熟悉的assets和res文件夹里面存放的资源文件, 一般情况下我们可以直接使用AssetManager类访问Apk下的assets目录,而对于res目录下的资源,我们很少直接使用他们,基本上都是通过它们的id在代码中使用。那么是否可以直接访问APK压缩包中Res目录下的内容呢? 比如需要访问res/raw这样的文件夹?如果我们想访问res/raw/sample.png文件,可以使用android.resource://package_name/" + R.raw.sample.png这种格式来获取对应 阅读全文
posted @ 2012-06-21 11:57 lee0oo0 阅读(22400) 评论(4) 推荐(0) 编辑
  2012年6月9日
摘要: //File指的是文件路径 private void openFile(File file){ Intent intent = new Intent(); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); //设置intent的Action属性 intent.setAction(Intent.ACTION_VIEW); //获取文件file的MIME类型 String type = getMIMEType(file); //设置intent的data和Type属性。 intent.setDataAndType(Uri.from... 阅读全文
posted @ 2012-06-09 22:16 lee0oo0 阅读(1614) 评论(0) 推荐(0) 编辑
摘要: 观察者模式:定义了一种一对多的依赖关系,让多个观察者对象同时监听某一个主题对象。这个主题对象在状态上发生变化时,会通知所有观察者对象,让他们能够自动更新自己 。以下是例子: public abstract class Citizen { List pols; String help="normal"; public void setHelp(String help){ this.help = help; } public String getHelp(){ return this.help; } public abstract void ... 阅读全文
posted @ 2012-06-09 13:37 lee0oo0 阅读(369) 评论(1) 推荐(1) 编辑
摘要: 策略模式:定义一系列的算法,把它们一个个封装起来,并且使它们可相互替换。本模式使得算法可独立于使用它的客户而变化。以下是例子: public abstract class Strategy { public abstract void method(); } public class StrategyImplA extends Strategy{ public void method() { System.out.println("这是第一个实现"); } } public class StrategyImplB extends Strategy{ publ... 阅读全文
posted @ 2012-06-09 12:09 lee0oo0 阅读(168) 评论(0) 推荐(0) 编辑
  2012年6月8日
摘要: 状态模式:允许对象在内部状态改变时改变它的行为,对象看起来好像修改了它的类。以下是例子: public interface Weather { String getWeather(); } public class Rain implements Weather { public String getWeather() { return "下雨"; } } public class Sunshine implements Weather { public String getWeather() { return "阳光"; } } public clas 阅读全文
posted @ 2012-06-08 16:55 lee0oo0 阅读(186) 评论(0) 推荐(0) 编辑
摘要: 迭代模式:给定一个语言,定义它的文法的一种表示,并定义一个解释器,这个解释器使用该表示来解释语言中的句子。以下是例子: public interface Iterator { Object next(); void first(); void last(); boolean hasNext(); } public class IteratorImpl implements Iterator{ private List list; private int index; public IteratorImpl(List list){ inde... 阅读全文
posted @ 2012-06-08 16:37 lee0oo0 阅读(265) 评论(0) 推荐(0) 编辑
  2012年6月7日
摘要: PhoneGap在Android的配置已经有相应的文章,就不介绍了,发个链接:http://www.cnblogs.com/lee0oo0/articles/2534677.html 注意:我们插件可能只需要用到一个,但是在上面链接所列出的都必须全部显式声明在xml文件中。而且我们使用的android开发版本需要在2.3.3或以上,否者会出现莫名的错 误。以下以一个例子说明步骤,重要部分会使用不同的颜色进行表明。 Html文件:<!DOCTYPEHTML><html><head><metaname="viewport"content 阅读全文
posted @ 2012-06-07 11:35 lee0oo0 阅读(7892) 评论(3) 推荐(0) 编辑
  2012年6月4日
摘要: Getting Started with AndroidThis guide describes how to set up your development environment for Cordova and run a sample application. Note that Cordova used to be called PhoneGap, so some of the sites still use the old PhoneGap name.1. RequirementsEclipse 3.4+2. Install SDK + CordovaDownload and ins 阅读全文
posted @ 2012-06-04 14:40 lee0oo0 阅读(2417) 评论(1) 推荐(0) 编辑
摘要: 注意:变量声明后是浏览器关闭才释放,在没关闭之前可以随时使用。function Circle(radius){//r是实例属性,定义并初始化在构造函数中this.r = radius; }//Circle.PI是类属性Circle.PI = 3.14159;//这是一个实例方法Circle.prototype.area = function(){return Circle.PI * this.r * this.r; }//这是类方法Circle.MAX = function(a,b){if(a.r>b.r)return a;elsereturn b; }var c = new Circl 阅读全文
posted @ 2012-06-04 11:45 lee0oo0 阅读(460) 评论(0) 推荐(0) 编辑
上一页 1 ··· 28 29 30 31 32 33 34 35 36 ··· 45 下一页