ITeye博客

decade_zuo的博客

decade_zuo · 共 9 篇文章

invalidate()和postInvalidate()

invalidate()是用来刷新View的,必须是在UI线程中进行工作。比如在修改某个view的显示时,调用invalidate()才能看到重新绘制的界面。invalidate()的调用是把之前的旧的view从主UI线程队列中pop掉。 一个Android 程序默认情况下也只有一个进程,但一个进程下却可以有许多个线程。在这么多线程当中,把主要是负责控制UI界面的显示、更新和控件交互的线程称为UI线程,由于onCreate()方法是由UI线程执行的,所以也可以把UI线程理解为主线程。其余的线程可以理解为工作者线程。 invalidate()得在UI线程中被调动,在工作者线程中可以通过Hand…

2011-07-18 16:55 · android · 评论(2)

查看Sqlite 数据库

<> 8月20日 在android命令行下使用sqlite3 现在已经可以在真机(nexus one)下使用sqlite3命令行工具了。不想在模拟器上面使用,android的模拟器和真机比较起来,太慢了,尤其是启动的时候。 如果在android上无法使用下面提到的命令行工具,报告: sqlite3: not found 那么可能需要安装带sqlite3的ROM,见nexus one更新第三方ROM。另外,想使用sqlite3访问程序私有目录下的文件,需要具备ROOT权限,见nexus one获取root权限。 如果这两条都具备了,可以开始使用。 在android SDK tools目录下,运…

2011-03-25 17:22 · 评论(0)

Drawable,Bitmap常用转换

android在处理一写图片资源的时候,会进行一些类型的转换。 1、Drawable → Bitmap Java代码 public static Bitmap drawableToBitmap(Drawable drawable) { Bitmap bitmap = Bitmap .createBitmap( drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), drawable.getOpacity() != PixelFormat.OPAQUE ? Bitmap.Config.ARGB_8888 : Bitmap.Con…

2011-03-25 12:47 · android · 评论(0)

shared preferences 存储数据

1、创建SharedPreferences对象: String spName = "SharedPreferences"; SharedPreferences dataBase; dataBase = getSharedPreferences(spName, 0); 2、创建保存方法: public void saveData() { dataBase.edit().putString("NAME", userName.getText().toString()) .putString("PASS", password.getText().toString()).commit(); } 3、创…

2011-03-25 10:52 · android · 评论(0)

sqllite 存储图片

方法一: Java代码 public void saveIcon(Bitmap icon) { if (icon == null) { return; } // 最终图标要保存到浏览器的内部数据库中,系统程序均保存为SQLite格式,Browser也不例外,因为图片是二进制的所以使用字节数组存储数据库的 // BLOB类型 final ByteArrayOutputStream os = new ByteArrayOutputStream(); // 将Bitmap压缩成PNG编码,质量为100%存储 icon.compress(Bitmap.CompressFormat.PNG, 100,…

2011-03-24 20:46 · android · 评论(0)

gridview 显示图片及文字

配置文件: string.xml night_item.xml AndroidManifest.xml

2011-03-23 17:11 · android · 评论(1)

android系统自带图标

http://since2006.com/android/1.6-drawables.php

2011-03-17 10:35 · android · 评论(0)

Android Intent 用法汇总

常用intent列表: Android Intent 用法汇总 显示网页 For these schemes were not particular MIME type has been supplied, we are a good candidate. --> We are also the main entry point of the browser. -->

2011-03-16 17:37 · android · 评论(0)

android 的分享功能

package com.ghstudio.sharetest; import java.util.List; import android.app.Activity; import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; public class Main ext…

2011-03-14 20:38 · android · 评论(0)