Android URL Encode 處理

URLEncoder.encode(strsearch.trim(), "utf-8");





httpRequest.setEntity(new UrlEncodedFormEntity(params, HTTP.UTF_8));

ListView touch 不會變顏色

android:cacheColorHint="#00000000"


背景非黑色時,拖曳變黑問題:
將android:cacheColorHint指定為透明(#00000000)

1)點擊Item時無背景顏色變化
在xml文件中的ListView控件中加入如下属性:
android:listSelector="@drawable/timer_list_selector"
在drawable中定义timer_list_selector的属性值
timer_list_selector.xml中定义如下:




在values文件夹下的colors.xml中定义transparent如下:
#50000000

2)設置Item之間無間隙
在xml文件中ListView控件中加入如下属性:
android:divider="#00000000"
或者在javaCode中如下定義:
listView.setDividerHeight(0);


3) 自定義的BaseAdapter中調用notifyDataSetChanged()方法會重新調用BaseAdapter的getView()方法。


from
http://www.wretch.cc/blog/hamowe/11465485


http://www.wretch.cc/blog/michaeloil/23294101

Sent to 傳送到

C:\Users\帳號\AppData\Roaming\Microsoft\Windows\SendTo

Google CTS testing Debuggable

無法查看此摘要。請 按這裡查看文章。

re-installation failed due to different application signatures

移除實機上的apk
再重新run

Android 開發環境



1. JDK Download
 

Java SE Downloads



http://www.oracle.com/technetwork/java/javase/downloads/index.html



//*********************************************************************************

 
 
2.Android SDK Download



http://developer.android.com/sdk/index.html



(注意安裝至Program files 顯示JDK 未安裝,back \ next) 


//*********************************************************************************

 

3.Eclipse Download

http://www.eclipse.org/downloads/ 
 
>
 
Eclipse IDE for Java Developers
 
Eclipse設定
(A)   ADT Plugin 
HELP  \  install new software      
ADT - http://dl-ssl.google.com/android/eclipse

(B) Set Android SDK Path
 
Windows / Perfences

(注意不要設 Program files\) 
  

Debug Certificate expired Unknown Android Packaging Problem


delete the debug.keystore

Delete file debug.keystore in  C:\Documents and Settings\<user>\.android

 C:\Documents and Settings\<user>\Local Settings\Application Data\Android

自定義元件的UI




<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true" android:drawable="@drawable/searchbar01" />
<item android:drawable="@drawable/searchbar01" />
</selector> 

 

style="@style/cp_edittext_style"

Android Debug Breakpoint 無作用

Android Debug Breakpoint 無作用

設定breakpoint 時,出現藍色圈中間一條線,

Run \ Skip all breakpoint 設定到了,取消後就可以了

 

windows 7 xp 共享取消

檢查所有共享目錄 windows 7 xp

電腦/右鍵/管理/系統工具/共用資料夾



windows 7 可以直接取消

xp不行

Flash ExternalInterface.call 問題

Flash ExternalInterface.call在call HTML Javascript function, 在本機測試一直有問題





對於在瀏覽器內執行的 local 內容,只有當 SWF 檔和內含的網頁位於本機信任的安全執行程序之內時,呼叫 ExternalInterface.addCallback() 方法才有作用



不只addCallback() ,ExternalInterface.call也有問題

Android 3.0 3.1 Webview flash無法正常撥放問題

Android 3.0 3.1  Webview flash無法正常撥放問題,有聲音,無影像

這問題花了很多時間處理,沒想到就一行就處理掉了

AndroidManifest.xml

 <application 

加入  android:hardwareAccelerated="true"
 

Android加入Timer


import android.os.Handler;


private Handler handler = new Handler();

onCreate{

handler.removeCallbacks(updateTimer);

handler.postDelayed(updateTimer, 2000);

}


    private Runnable updateTimer = new Runnable() {
        public void run() {
            
       }
      };

MAC 下安裝Android 開發環境

MAC 下安裝Android 開發環境比想像中容昜
1. mac 已安裝好JDK ,不需要再安裝JDK 
2. Perference 由window 移至Eclipse目錄
 

Android requires compiler compliance level 5.0. Please fix project properties.

新建eclipse環境,compile  舊project發生的題
解決方法
project /properties / java compiler ==> JDK Compliance :修改成已安裝版本

另外  windows 的project 移到mac 中文變亂碼:未處理

 

Android Runtime Error 的處理

Android Runtime Error 有時侯很難查出錯誤的原因.

1.  AndroidManifest.xml 漏列activity 頁

2 . 物件忘給初使條件 findViewById(R.id....

 

R.java 無法更新

刪掉 r.java  執行 Project / Clean  取消 Build Automatically , 再執行Build Project

檢查 Console 的錯誤訊息, 如果有AndroidManifest.xml 或是layout內的XML 有錯誤都會造成R.java無法自動更新

這次是發生在drawable內的錯誤,這個錯誤不會在 Package Exploer 顯示, 所以很難發現

在Console中的訊息看到錯誤
res\drawable\....   Invalid file name : mst contain only [a-...] 
 

Android Full screen

20130110更新


getWindow().getDecorView().setSystemUiVisibility(4);



//************************************************************

requestWindowFeature(Window.FEATURE_NO_TITLE);

getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);