Skip to main content

Home/ Android Dev/ Contents contributed and discussions participated by Vincent Tsao

Contents contributed and discussions participated by Vincent Tsao

Vincent Tsao

一个发布应用需要注意的地方 - China Android Dev | Google Groups - 0 views

  • 我今天说的,无关于功能,也无关于布局,而在于资源命名。 我是这样发现问题的,我的应用《千字文》发布两天内获得了大概600个安装,但是有三个用户说他们无法安装,错误是“安装包没有正确的签名”。用户们的 共同点是他们都是1.5的固件。怎么会出现这样的事情呢?我在发布之前使用我的1.6固件的G2进行测试的,没有在1.5固件上测试过,这是因为我在开 发时功能和布局都是以1.5固件为基准做的,我很有信心不会在1.5上出现异常。于是我尝试在1.5固件的虚拟机上安装我的apk文件,果然遇到了用户 提到的错误。我检查了AndroidManifest.xml文件,miniSDK是3,也没有1.5不支持的配置选项,没问题的。于是Google 之,发现了解决方案。 原来1.5和它之前的固件都有bug,就是对资源文件(asset或者res目录下的文件)的命名解析的不好,具体的错误我也没有仔细看,大概的意思就 是,资源文件的名字和数量的组合和排列有可能会造成某些资源文件无法被解析。我们无法得知哪些名字是无法解析的,也不知道哪些资源文件数量是恰好不能解 析的。我们可以做的,就是在打包之后,发布之前,自己在1.5固件(或之前的固件)上进行安装测试。通过了就好,通不过就尝试改几个资源文件的名字,或 者增加一个或几个dummy文件,再打包,直到测试安装成功。 我的应用就是在我改了一个资源文件的名字之后通过了1.5的安装测试。 希望我说的明白。重点:发布之前,务必在1.5固件上进行测试安装。
    • Vincent Tsao
       
      良子大哥关于平台兼容性的宝贵经验
Vincent Tsao

YouTube - Diigo Intro - 2 views

shared by Vincent Tsao on 24 Mar 10 - Cached
Vincent Tsao liked it
  •  
  •  
    A funny guy introduce how to use diigo
Vincent Tsao

[Disccuss] lasy load of images in ListView - 2 views

android "lazy load" listview tech
  • Vincent Tsao
     
    altchen share了一个解决方案: http://groups.diigo.com/group/android_related/content/android-how-do-i-do-a-lazy-load-of-images-in-listview-stack-overflow-1423027

    另外我在 Android developer邮件列表中看到了另外一个解决方案,看起来也大同小异了,代码如下:

    public class imageloader implements Runnable{

    private String ss;
    //private View v;
    //private View v2;
    private ImageView im;

    public imageloader(String s, ImageView im) {
    this.ss=s;
    //this.v2=v2;
    this.im=im;
    Thread thread = new Thread(this);
    thread.start();
    }
    public void run(){
    try {
    // URL url = new URL(ss);
    // URLConnection conn = url.openConnection();
    // conn.connect();
    HttpGet httpRequest = null;
    httpRequest = new HttpGet(ss);
    HttpClient httpclient = new DefaultHttpClient();
    HttpResponse response = (HttpResponse)
    httpclient.execute(httpRequest);
    HttpEntity entity = response.getEntity();
    BufferedHttpEntity bufHttpEntity = new
    BufferedHttpEntity(entity);
    InputStream is = bufHttpEntity.getContent();
    // BufferedInputStream bis = new
    BufferedInputStream(is);
    Bitmap bm = BitmapFactory.decodeStream(is);
    Log.d("img","img");
    // bis.close();
    is.close();
    im.setImageBitmap(bm);
    // im.forceLayout();
    // v2.postInvalidate();
    // v2.requestLayout();
    } catch (Exception t) {
    Log.e("bitmap url", "Exception in updateStatus()", t);
    //goBlooey(t);
    // throw new RuntimeException(t);
  • Vincent Tsao
     
    ah~ ,看来Diigo groups展示代码的样式得改进了.....
Vincent Tsao

Android - How do I do a lazy load of images in ListView - Stack Overflow - 2 views

  • public class DrawableManager { private final Map drawableMap; public DrawableManager() { drawableMap = new HashMap(); } public Drawable fetchDrawable(String urlString) { if (drawableMap.containsKey(urlString)) { return drawableMap.get(urlString); } Log.d(this.getClass().getSimpleName(), "image url:" + urlString); try { InputStream is = fetch(urlString); Drawable drawable = Drawable.createFromStream(is, "src"); drawableMap.put(urlString, drawable); Log.d(this.getClass().getSimpleName(), "got a thumbnail drawable: " + drawable.getBounds() + ", " + drawable.getIntrinsicHeight() + "," + drawable.getIntrinsicWidth() + ", " + drawable.getMinimumHeight() + "," + drawable.getMinimumWidth()); return drawable; } catch (MalformedURLException e) { Log.e(this.getClass().getSimpleName(), "fetchDrawable failed", e); return null; } catch (IOException e) { Log.e(this.getClass().getSimpleName(), "fetchDrawable failed", e); return null; } } public void fetchDrawableOnThread(final String urlString, final ImageView imageView) { if (drawableMap.containsKey(urlString)) { imageView.setImageDrawable(drawableMap.get(urlString)); } final Handler handler = new Handler() { @Override public void handleMessage(Message message) { imageView.setImageDrawable((Drawable) message.obj); } }; Thread thread = new Thread() { @Override public void run() { //TODO : set imageView to a "pending" image Drawable drawable = fetchDrawable(urlString); Message message = handler.obtainMessage(1, drawable); handler.sendMessage(message); } }; thread.start(); } private InputStream fetch(String urlString) throws MalformedURLException, IOException { DefaultHttpClient httpClient = new DefaultHttpClient(); HttpGet request = new HttpGet(urlString); HttpResponse response = httpClient.execute(request); return response.getEntity().getContent(); } }
  •  
    shared by Altchen
Vincent Tsao

Selecting text in a WebView? - Stack Overflow - 1 views

  • From the class that extends WebView: public void selectAndCopyText() {    try {        Method m = WebView.class.getMethod("emulateShiftHeld", null);        m.invoke(this, null);    } catch (Exception e) {        throw new AssertionError(e);    }} And then you have to use ClipboardManager to watch for new text. P.S. Historical note: this hack is based on Android 1.5 WebView implementation.
Vincent Tsao

欢迎加入Android Group - 2 views

welcome
started by Vincent Tsao on 23 Mar 10 no follow-up yet
  • Vincent Tsao
     
    看见好的网页,不妨收藏为bookmark分享出来,"Collaborate Research"这就是这个group存在的目的,也算是作为China-android-dev讨论组的一个补充
« First ‹ Previous 341 - 360 of 450 Next › Last »
Showing 20 items per page