`
文章列表
1、      List<String> list  删除操作:remove(value);方法报错: java.lang.UnsupportedOperationException        解决办法:List<String>改成 ArrayList<String>

索引DEMO

listview的索引
1、解决问题:      加了checkbox之后,就会影响setOnItemClickListener(new OnItemClickListener() 不起作用。      办法:checkbox 默认设置:android:focusable="false"   2、解决问题:     Info info = list.get(position); viewHolder.checkBox.setChecked(info.getCheckState()); viewHolder.checkBox.setOnCheckedChangeListene ...

popup

public class PopupWindowActivity extends Activity { private Button bShow = null; // show popup window button private boolean isClick = false; // if the button is clicked private PopupWindow popupWindow = null;// popup window /** Called when the activity is first created. */ @Override ...
转载;   http://blog.sina.com.cn/s/blog_713953c5010123k6.html   1. 现象   ListView中,当前点击的那行,设置为红色。往下滚动,发现隔11行或12行的那行也会变红色,但是你并没有点过它。2.原因  主要的问题在于自定义的Adapter中的getView()方法。一般我们会这样写:    public View getView(int position, View convertView, ViewGroup parent) {         ZuJian zuJian = null;         if(conver ...

解决ANR

解决ANR问题: 转载:http://blog.csdn.net/gemmem/article/details/7446421

drawable

drawable 一些总结:   http://www.cnblogs.com/fighter/archive/2012/02/20/android-bitmap-drawable.html (drawable的一些处理)   //1,已将图片保存到drawable目录下 //通过图片id获得Drawable Resource res=gerResource(); Drawable drawable=res.getDrawable(id);//id为R.drawable.图片名称 //通过图片id获得Bitmap Resource res=gerResourc ...
file size 的大小计算:   String android.text.format.Formatter.formatFileSize(Context context, long number) String apkSize = Formatter.formatFileSize( , );     //返回数组,下标1代表大小,下标2代表单位 KB/MB String[] filesize(long size){ String str=""; if(size>=1024){ ...
设置指定文字颜色:   String str = "There are 36 apps in your phone."; int index = appNum.indexOf("apps"); SpannableStringBuilder ss = new SpannableStringBuilder(str); ForegroundColorSpan span=new ForegroundColorSpan(Color.parseColor("#F79719")); ss.setSpan(span,16, index, ...
String name = "fdfdfdf,fdfdfs.fdfdfj'dfd" ; name.contains(","); 是否包含, name.contains("abc"); 是否包含 name .split(",") ; 按分号拆分返回一个数组。String[] age ; age = new String[1]; age[0] = " " ; Arrays.asList(array) ;    

sdcark卡。

转载:http://www.cnblogs.com/TerryBlog/archive/2010/06/27/1766363.html
1、android.content.pm.PackageManager$NameNotFoundException      这个是因为安装的应用程序,不完整,apk有问题导致。      下载的时候出异常的话写一个接口。有一个回调。      出错了,怎么处理。     从arraylist删除 D/PackageManager( 1991): generateServicesMap(android.accounts.AccountAuthenticat or): 5 services unchanged W/System.err(19190): android.content.p ...
package com.yarin.android.TestOnPDialog; import android.app.Activity; import android.app.ProgressDialog; import android.content.DialogInterface; import android.os.Bundle; import android.view.View; import android.widget.Button; public class PDialog extends Activity { private Button ...

android读写文件

一、 从resource中的raw文件夹中获取文件并读取数据(资源文件只能读不能写) String res = ""; try{ InputStream in = getResources().openRawResource(R.raw.bbi); //在\Test\res\raw\bbi.txt, int length = in.available(); byte [] buffer = new byte[length]; in.read(buffer); / ...

读取assessts的txt

try { // Return an AssetManager instance for your application's package InputStream is = getAssets().open("index.txt"); int size = is.available(); // Read the entire asset into a local byte buffer. byte[] buffer = new byte[size]; is.read(buffer); is.close(); ...
Global site tag (gtag.js) - Google Analytics