随笔分类 -  安卓开发

摘要:Configure FiddlerClick Tools > Fiddler Options > Connections.Ensure that the checkbox by Allow remote computers to connect is checked.If you check the box, restart Fiddler.Hover over the Online indicator at the far right of the Fiddler toolbar to display the IP address of the Fiddler server.Co 阅读全文
posted @ 2013-07-17 18:07 CY. 阅读(578) 评论(0) 推荐(0)
摘要:public int getStatusBarHeight() { int result = 0; int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android"); if (resourceId > 0) { result = getResources().getDimensionPixelSize(resourceId); } return result}this method worked fine for me.. 阅读全文
posted @ 2013-06-21 00:20 CY. 阅读(294) 评论(0) 推荐(0)
摘要:[Question]I am running app in debug mode from eclipse, constructor ofDatabaseHleperis called butonCreate()is not called.[Soltuon]Create instance ofORMLiteHelperand callgetWritableDatabase(). When database is not created then onCreate will be invoked.[Reference]http://stackoverflow.com/questions/1026 阅读全文
posted @ 2013-06-19 22:15 CY. 阅读(503) 评论(0) 推荐(0)
摘要:Since those jars are added dynamically through a classpathcontainer, the devs cannot set the source path and the javadocthrough Eclipse UI (container don't allow editing those).To fix this, and to make sure that both paths are picked upnot only by the current project, but also by other projects( 阅读全文
posted @ 2013-06-18 16:17 CY. 阅读(227) 评论(0) 推荐(0)
摘要:因为ScrollView把ViewFlipper的触碰事件拦截了,所以在ScrollView上不能滑动,不过可以解决。就是想办法先响应ViewFlipper,再响应ScrollView。@Overridepublic boolean dispatchTouchEvent(MotionEvent ev){ gd.onTouchEvent(ev); //让GestureDetector响应触碰事件 super.dispatchTouchEvent(ev); //让Activity响应触碰事件 return false;}@Overridepublic boolean onTouc... 阅读全文
posted @ 2013-06-18 13:05 CY. 阅读(472) 评论(0) 推荐(0)
摘要:方法1、网上很多流行的方法,先测量listview或gridview的高度,然后再scrollview中设为定值public static void setListViewHeightBasedOnChildren(ListView listView) { ListAdapter listAdapter = listView.getAdapter(); if (listAdapter == null) { listView.setVisibility(View.GONE); return; } ... 阅读全文
posted @ 2013-06-18 13:03 CY. 阅读(703) 评论(0) 推荐(0)
摘要:Memory Analysis for Android Applicationshttp://android-developers.blogspot.com/2011/03/memory-analysis-for-android.htmlAvoiding memory leakshttp://android-developers.blogspot.com/2009/01/avoiding-memory-leaks.htmlTrack memory allocationshttp://android-developers.blogspot.com/2009/02/track-memory-all 阅读全文
posted @ 2013-06-18 12:59 CY. 阅读(163) 评论(0) 推荐(0)
摘要:1、<viewStub />在使用普通的view时,把View的初始可见View.GONE但是在Inflate布局的时候View仍然会被Inflate,也就是说仍然会创建对象,会被实例化,会被设置属性。也就是说,会耗费内存等资源。使用viewStub,在Inflate布局的时候,只有ViewStub会被初始化,然后当ViewStub被设置为可见的时候,或是调用了ViewStub.inflate()的时候,ViewStub所向的布局就会被Inflate和实例化,然后ViewStub的布局属性都会传给它所指向的布局。这样,就可以使用ViewStub来方便的在运行时,要还是不要显示某个布 阅读全文
posted @ 2013-06-18 12:58 CY. 阅读(206) 评论(0) 推荐(0)
摘要:[Background]ANR:Application Not Responding系统向用户显示一个对话框,这个对话框称作应用程序无响应(ANR:Application Not Responding)对话框。用户可以选择“等待”而让程序继续运行,也可以选择“强制关闭”。默认情况下,在android中Activity的最长执行时间是5秒,BroadcastReceiver的最长执行时间则是10秒。[Solution]1、找到SDK下的adb工具,连接手机2、输入命令adb bugreport,查看log信息3、在log中查找last anr,就可以非常清楚的看到最后一次ANR的详细信息 阅读全文
posted @ 2013-06-18 12:56 CY. 阅读(260) 评论(0) 推荐(0)
摘要:[Question]使用startActivityForResult,并没有启动设置中的activity,而是直接调用了onActivityReslut()方法。[Solution]查看Androidmanifest.xml中关于要启动的activity的声明是否有 android:launchMode="singleTask",把这句话去掉就OK了[Analyse]1、Activity 的加载模式(launchMode)有关,该属性可以在 AndroidManifest.xml 中设置。2、将其设为 singleInstance,经测试,所有需要传递或接收的 Activi 阅读全文
posted @ 2013-06-18 12:55 CY. 阅读(214) 评论(0) 推荐(0)
摘要:ORMLite[offical site]http://ormlite.com/GreenDAO[offical site]http://greendao-orm.com/ActiveAndroid[offical site]http://www.activeandroid.com/ORMDroid[Github]https://github.com/roscopeco/ormdroidDroidParts[offical site]http://droidparts.org/Androrm[offical site]http://androrm.the-pixelpla.net/ 阅读全文
posted @ 2013-06-18 12:48 CY. 阅读(177) 评论(0) 推荐(0)