摘要: Google Android 开发官方网站Google Android Group 开发官方讨论区stackoverflow.com Android著名讨论区Android Open Source Project Android源码,想研究源码朋友的去处anddev.org anddev.org里面有大量教程和范例developerlife.com developerlife.com 大量TutorialsT-Mobile G1 Forums T-Mobile Mobile论坛xda-developers 国外开发论坛。Android Forums Android经典讨论区 Android . 阅读全文
posted @ 2012-07-16 14:43 悬崖上的蒲公英 阅读(144) 评论(0) 推荐(0) 编辑
摘要: androidmanifest.xml中声明相关权限请求, 完整列表如下:android.permission.ACCESS_CHECKIN_PROPERTIES 允许读写访问”properties”表在checkin数据库中,改值可以修改上传( Allows read/write access to the “properties” table in the checkin database, to change values that get uploaded)android.permission.ACCESS_COARSE_LOCATION 允许一个程序访问CellID或WiFi热点来获 阅读全文
posted @ 2012-07-16 14:41 悬崖上的蒲公英 阅读(142) 评论(0) 推荐(0) 编辑
摘要: 为性能设计:1)避免创建对象 对象的创建从来不是免费的。虽然GC使得内存申请代价不再高昂,但是申请总是比不申请来得昂贵。如果你在一个用户接口循环中申请对象,你将会强行执行周期性的GC,在用户体验上出现一些小的“打嗝”,因此除非不得已,你应该避免创建对象实例,下面是一些例子可以帮助理解: 当你在一组输入数据中抽取字符串时,尝试返回源数据的子串,而非创建一个副本。你将会创建一个新的String对象,但是它会和数据共享字符数组char[]。 如果你有一个返回String的方法,而且你知道它的结果将会一直被追加到StringBuffer,改变你的签名和实现,使这个函数里面直接追加,避免创建临时对象。 阅读全文
posted @ 2012-07-16 14:40 悬崖上的蒲公英 阅读(148) 评论(0) 推荐(0) 编辑
摘要: 对于我们所熟悉的大部分软件都有一个比较典型的特点,应用现有的数据根据不同的需求来得到相应的结果。例如,我们最常用的Office word、Excel、PowerPoint等办公软件,它们都是帮助我们完成某种特定的需求,同时由其所产生的数据或者文档又可以被其它软件所读取和做进一步的优化等等,在这个层面上可以看成是这些软件通过相同的文件标准来共享数据。但是对于Android最大的不同点在于,其平台上的应用软件所存储的数据或者文件是私有,仅仅可以通过它自身才可以访问其所包含的数据资源。 那么基于这样的限制,该如何在Android平台上实现不同程序间的数据共享呢?答案非常简单 – 应用Content 阅读全文
posted @ 2012-07-16 14:38 悬崖上的蒲公英 阅读(203) 评论(0) 推荐(0) 编辑
摘要: 如果使用android进行大屏幕开发,比如开发平板电脑,我们需要进行如下的设置。 1、需要在AndroidManifest.xml中添加如下: 这样在虚拟机上显示大屏幕时才不会缩在中间显示。 2、大屏幕虚拟机的创建: 创建虚拟机时: 有一项Built-in 我们一般选择的是Defalut(HVGA)这是普通的屏幕 ,选择WVGA800 选择Resolution,然后自己输入分辩率即可。 阅读全文
posted @ 2012-07-16 14:37 悬崖上的蒲公英 阅读(171) 评论(0) 推荐(0) 编辑
摘要: Android ListView背景成透明设置方法,如果你只是换背景的颜色的话,可以直接指定android:cacheColorHint为你所要的颜色,如果你是用图片做背景的话,那也只要将android:cacheColorHint指定为透明(#00000000)就可以了,android:cacheColorHint="#00000000"但是这个设置会降低一些效率的。 阅读全文
posted @ 2012-07-16 14:31 悬崖上的蒲公英 阅读(423) 评论(0) 推荐(0) 编辑
摘要: WebView的背景设置成透明的方法,使用语句setBackgroundColor(0);WebView web = (WebView) findViewById(R.id.web);web .setBackgroundColor(0);web .setBackgroundResource(R.drawable.yourImage);web.loadData(profile, "text/html", "UTF-8"); 阅读全文
posted @ 2012-07-16 14:30 悬崖上的蒲公英 阅读(383) 评论(0) 推荐(0) 编辑
摘要: 项目中使用以下提取带有中文的html,出现了乱码holder.webView.loadData(html, “text/html”, “utf-8″);经过多次尝试发现用holder.webView.loadDataWithBaseURL (null, html, “text/html”, “utf-8″,null);这个方法却能很好解决乱码问题,遇到这个问题的朋友不妨一时。 阅读全文
posted @ 2012-07-16 14:28 悬崖上的蒲公英 阅读(265) 评论(0) 推荐(0) 编辑
摘要: android 键盘显示与隐藏InputMethodManager imm = (InputMethodManager)getSystemService(SendActivity.this.INPUT_METHOD_SERVICE);隐藏键盘imm.hideSoftInputFromWindow(editText.getWindowToken(), 0);显示键盘imm.showSoftInput(editText, 0); 阅读全文
posted @ 2012-07-16 14:28 悬崖上的蒲公英 阅读(156) 评论(0) 推荐(0) 编辑
摘要: Android 模拟器按Ctrl+F11切换横屏后,点击EditText不弹出软键盘,如何解决这个问题。具体方法如下:需要重新建一个模拟器,在新建的时候记得选择属性:Keyboard Support,然后再把它设置成no,这样就完全屏蔽了PC键盘的输入,就可以在模拟器竖屏的情况下弹出输入法了。 阅读全文
posted @ 2012-07-16 14:26 悬崖上的蒲公英 阅读(409) 评论(0) 推荐(0) 编辑
摘要: android发送HTTP请求代码,以GET方式发送。String uriAPI = “http://www.getideas.cn/service/service.do?me=1″; HttpGet httpRequest = new HttpGet(uriAPI); try { HttpResponse httpResponse = new DefaultHttpClient().execute(httpRequest); if (httpResponse.getStatusLine().getStatusCode() == 200) { //TODO } else... 阅读全文
posted @ 2012-07-16 14:25 悬崖上的蒲公英 阅读(142) 评论(0) 推荐(0) 编辑
摘要: android中全局变量的使用方法:class MyApp extends Application { private String myState; public String getState(){ return myState; } public void setState(String s){ myState = s; } }class Blah extends Activity { @Override public void onCreate(Bundle b){ … MyApp appState = ((MyApp)getApplicationContext()); String 阅读全文
posted @ 2012-07-16 14:25 悬崖上的蒲公英 阅读(117) 评论(0) 推荐(0) 编辑
摘要: 创建自定义view的时候,碰到 android.view.InflateException: Binary XML file line #异常,反复研究后发现是缺少一个构造器造成。public MyView(Context context,AttributeSet paramAttributeSet) { super(context,paramAttributeSet);}补齐这个构造器,异常就消失了,如果碰到这个问题不妨试试看。 阅读全文
posted @ 2012-07-16 14:23 悬崖上的蒲公英 阅读(1507) 评论(0) 推荐(0) 编辑
摘要: Android有用的代码片段1:查看是否有存储卡插入String status=Environment.getExternalStorageState(); if(status.equals(Enviroment.MEDIA_MOUNTED)) { 说明有SD卡插入 }2:让某个Activity透明OnCreate中不设Layout this.setTheme(R.style.Theme_Transparent); 以下是Theme_Transparent的定义(注意transparent_bg是一副透明的图片)3:在屏幕元素中设置句柄使用Activity.findViewById来取得屏幕. 阅读全文
posted @ 2012-07-16 14:22 悬崖上的蒲公英 阅读(104) 评论(0) 推荐(0) 编辑
摘要: android布局属性详解 各种Layout用到的一些重要的属性: 第一类:属性值为true或false android:layout_centerHrizontal 水平居中 android:layout_centerVertical 垂直居中 android:layout_centerInparent 相对于父元素完全居中 android:layout_alignParentBottom 贴紧父元素的下边缘 android:layout_alignParentLeft 贴紧父元素的左边缘 android:layout_alignParentRight 贴紧父元素的右边缘 ... 阅读全文
posted @ 2012-07-16 14:20 悬崖上的蒲公英 阅读(114) 评论(0) 推荐(0) 编辑
摘要: 1. 指定action 和type // SIM import Intent importIntent = new Intent(Intent.ACTION_VIEW); importIntent.setType(“vnd.android.cursor.item/sim-contact”); importIntent.setClassName(“com.android.phone”, “com.android.phone.SimContacts”); menu.add(0, 0, 0, R.string.importFromSim) .setIcon(R.drawable.ic_menu... 阅读全文
posted @ 2012-07-16 14:19 悬崖上的蒲公英 阅读(177) 评论(0) 推荐(0) 编辑
摘要: 代码如下:Intent startMain = new Intent(Intent.ACTION_MAIN);startMain.addCategory(Intent.CATEGORY_HOME);startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);startActivity(startMain);System.exit(0);执行后在任务管理器看不到。 阅读全文
posted @ 2012-07-16 14:18 悬崖上的蒲公英 阅读(180) 评论(0) 推荐(0) 编辑
摘要: android在处理一写图片资源的时候,会进行一些类型的转换:1、Drawable → Bitmap 的简单方法 ((BitmapDrawable)res.getDrawable(R.drawable.youricon)).getBitmap();2、Drawable → Bitmap Java代码 public static Bitmap drawableToBitmap(Drawable drawable) { Bitmap bitmap = Bitmap .createBitmap( drawable.getIntrinsicWidth(), drawable.getIntrinsic. 阅读全文
posted @ 2012-07-16 14:15 悬崖上的蒲公英 阅读(134) 评论(0) 推荐(0) 编辑
摘要: android发送http get请求的方法String uriAPI = “http://www.getideas.cn“; /* 建立HTTP Get对象 */ HttpGet httpRequest = new HttpGet(uriAPI); try { /* 发送请求并等待响应 */ HttpResponse httpResponse = new DefaultHttpClient().execute(httpRequest); /* 若状态码为200 ok */ if (httpResponse.getStatusLine().getStatusCode() == 20... 阅读全文
posted @ 2012-07-16 14:11 悬崖上的蒲公英 阅读(272) 评论(0) 推荐(0) 编辑
摘要: eclipse中Error generating final archive: Debug certificate expired on异常的解决方法Eclipse Android工程时,提示该错误 :Error generating final archive: Debug certificate expired on xxxxxx 解决办法:linux:Window--》Preferences--》Android--》Build中Default debug keystore显示了地址“/home/jinli/.android/debug.keystore”,删除此路径下的debug.key 阅读全文
posted @ 2012-07-16 14:10 悬崖上的蒲公英 阅读(93) 评论(0) 推荐(0) 编辑