随笔分类 -  ANDROID

摘要:java.long.NoClassDefFoundError: sun.misc.BASE64Encoder 阅读全文
posted @ 2013-03-14 19:17 Atlas's blog 阅读(11965) 评论(0) 推荐(0)
摘要:02-20 16:28:22.920: E/AndroidRuntime(8523): java.lang.ClassCastException: android.widget.GridView cannot be cast to android.widget.TextView02-20 16:28:22.920: E/AndroidRuntime(8523): at android.widget.SimpleExpandableListAdapter.bindView(SimpleExpandableListAdapter.java:247)由于SimpleExpandableListAd. 阅读全文
posted @ 2013-02-20 16:37 Atlas's blog 阅读(1374) 评论(0) 推荐(0)
摘要:使用系统设置中的API会改变系统的语言,在onpause等去改变语言,效果不是太好。另外下面的方法只有在新启动的activity中才能生效。 public void switchLanguage(Locale locale) { Resources resources = getResources();// 获得res资源对象 Configuration config = resources.getConfiguration();// 获得设置对象 DisplayMetrics dm = resources.getDisplayMetrics()... 阅读全文
posted @ 2013-02-19 11:40 Atlas's blog 阅读(14548) 评论(2) 推荐(0)
摘要:我们在使用ListView的时候,一般都会为ListView添加一个响应事件android.widget.AdapterView.OnItemClickListener。本文主要在于对OnItemClickListener的position和id参数做详细的解释,我相信有些人在这上面走了些弯路。先来看一下官方的文档positionThepositionof the view in the adapter.idThe row id of the item that was clicked.而这两行字并没有解释清楚position和id的区别。另外,我们还有个Adapter的getView方法。p 阅读全文
posted @ 2013-01-30 14:33 Atlas's blog 阅读(29289) 评论(0) 推荐(0)
摘要:利用Stack倒序List,利用Set是List不能添加重复元素 阅读全文
posted @ 2012-12-25 18:54 Atlas's blog 阅读(848) 评论(0) 推荐(0)
摘要:问题:调用TextView.setTextColor(intcolorResourceId)设置light_gray之后,字体颜色改变,设置其为black没有反应。原因:Setsthetextcolorforallthestates(normal,selected,focused)tobethiscolor.由于设置的不是colorResouceId,而是Color对应的,在不相同的情况下就不会改变其值。解决办法:使用nameTextView.setTextColor(Color.parseColor(Constants.COLOR_BLACK));f(viewHolder.nameFollo 阅读全文
posted @ 2012-12-25 18:35 Atlas's blog 阅读(6881) 评论(0) 推荐(0)
摘要:某些机型应用图标未改变的问题解决 阅读全文
posted @ 2012-12-25 18:25 Atlas's blog 阅读(248) 评论(0) 推荐(0)
摘要:REFERENCES:http://www.icodelogic.com/?p=575 阅读全文
posted @ 2012-12-25 12:43 Atlas's blog 阅读(248) 评论(0) 推荐(0)
摘要:造成原因:View.OnClickListener是一个内部匿名类。在内部匿名类中调用外部类元素需要final解决办法:class FollowOnClickListener implements ImageView.OnClickListener { private ImageView iconImageView; private TextView nameTextView; public FollowOnClickListener(ImageView iconIV, TextView nameTV) { ... 阅读全文
posted @ 2012-12-25 12:39 Atlas's blog 阅读(597) 评论(0) 推荐(0)
摘要:Fastjson:http://code.alibabatech.com/wiki/pages/viewpage.action?pageId=2424946 阅读全文
posted @ 2012-12-20 20:59 Atlas's blog 阅读(304) 评论(0) 推荐(0)
摘要:AndroidManifest.xml<uses-library android:name="android.test.runner"/><instrumentation android:name="android.test.InstrumentationTestRunner" android:targetPackage="com.myapp.tests" android:label="MyAppTests" />1.继承androidTestCase类。2.Assert类判断所得到值与期望 阅读全文
posted @ 2012-12-18 09:22 Atlas's blog 阅读(3531) 评论(0) 推荐(0)
摘要:12-12 16:43:16.876: E/AndroidRuntime(7395): FATAL EXCEPTION: main12-12 16:43:16.876: E/AndroidRuntime(7395): java.lang.IndexOutOfBoundsException: Invalid index 10, size is 1012-12 16:43:16.876: E/AndroidRuntime(7395): at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:251)12-12... 阅读全文
posted @ 2012-12-12 17:41 Atlas's blog 阅读(5346) 评论(0) 推荐(1)
摘要:首先有人说是MIUI里面做了缓存,我本想让朋友第一次安装一下我更改后的应用,没有得逞。本程序的AndroidManifest.xml 相关配置如下: <application android:name=".MOAApplication" android:icon="@drawable/moa" android:label="@string/app_name" android:theme="@android:style/Theme.Light.NoTitleBar" > <activity andr 阅读全文
posted @ 2012-12-12 16:18 Atlas's blog 阅读(354) 评论(0) 推荐(0)
摘要:REFERENCES:http://www.cnblogs.com/ghj1976/archive/2011/04/29/2032495.html建议首先阅读下面两篇文章,这样才可以更好的理解Activity的加载模式:Android的进程,线程模型http://www.cnblogs.com/ghj1976/archive/2011/04/28/2031586.html其中对“Android的单线程模型”的描述,明白Activity的一些注意事项。Android Application Task Activities的关系http://www.cnblogs.com/ghj1976/arch 阅读全文
posted @ 2012-12-10 22:22 Atlas's blog 阅读(216) 评论(0) 推荐(0)
摘要:REFERENCES:http://blog.csdn.net/zzf112/article/details/7034412注:LinearLayout中的TextView按比例显示的时候,layout_width="0dp"或者layout_height="0dp"在android开发中LinearLayout很常用,LinearLayout的内控件的android:layout_weight在某些场景显得非常重要,比如我们需要按比例显示。android并没用提供table这样的控件,虽然有TableLayout,但是它并非是我们想象中的像html里面 阅读全文
posted @ 2012-12-07 10:59 Atlas's blog 阅读(335) 评论(0) 推荐(0)
摘要:class MyThread extends Thread{ private SurfaceHolder holder; public boolean isRun ; float radius = 10f; Paint p; public MyThread(SurfaceHolder holder) { this.holder =holder; isRun = true; p = new Paint(); } public ... 阅读全文
posted @ 2012-11-22 10:34 Atlas's blog 阅读(5280) 评论(0) 推荐(0)
摘要:问题:使用了thread,asyncTask在其中使用了toast等更新ui解决办法:1.使用handler来发送消息,在主线程中更新ui 2.在报错的方法前加上Looper.prepare(); 末尾加上Looper.loop();REFERENCES:http://sdlqhjk.iteye.com/blog/1112204 阅读全文
posted @ 2012-11-19 16:08 Atlas's blog 阅读(478) 评论(0) 推荐(0)
摘要:在截取字符串的时候,final String str = "http://172.26.1.1/IMG/USER/AVATAR/090214/676.jpg"; String[] s = str.split("\\."); System.out.println(s.length);此处的dot应该要使用转义才行 阅读全文
posted @ 2012-11-19 16:06 Atlas's blog 阅读(1687) 评论(0) 推荐(0)
摘要:异常场景:经常在应用中需要处理一些耗时的工作,诸如读取大文件、访问网络资源等。为了避免因程序假死而带来的糟糕用户体验,通常我们可以通过线程+Handler或者Android提供的AsyncTask来解决该问题,并一般以ProgressDialog等提示性控件来告知用户当前的程序进度。而标题中描述的异常则会常常出现在这样的场景中,并且往往掩盖了导致异常的真正的罪魁祸首。问题原因:从异常描述中,大致的意思是存在窗口句柄泄露,即未能及时销毁某个PhoneWindow。而这往往误导了我们,把过多的精力放在查找所谓的内存泄露上了。其实存在这么一种情况,即因我们在非主线程中的某些操作不当而产生了一个严重的 阅读全文
posted @ 2012-11-19 11:10 Atlas's blog 阅读(375) 评论(0) 推荐(0)
摘要:错误代码:SoapFault-faultcode:'soapenv:Server'faultstring:'Unresolvedcompilationproblem: decannotberesolved'faultactor:'null'detail:org.kxml2.kdom.Node@41632b9REFERENCES:http://www.cnblogs.com/jadic/archive/2012/02/08/2342925.html 阅读全文
posted @ 2012-11-14 14:38 Atlas's blog 阅读(202) 评论(0) 推荐(0)