顯示具有 Android 標籤的文章。 顯示所有文章
顯示具有 Android 標籤的文章。 顯示所有文章

linux 所有檔案轉成 utf-8

enca -L zh_TW -x utf-8 *

Android 螢幕旋轉不執行create 的方法


AndroidManifest.xml
<activity 內加入
 
android:configChanges="orientation|keyboardHidden"

NDK - Ubuntu

新的 NDK R8 找不到build/host-setup.sh 檔案

直接寫入bashrc


jimmy@jimmyubuntu:~$ gedit ~/.bashrc


最後寫入

export NDK_HOME=/home/jimmy/android-sdk-linux/android-ndk-r8/
export PATH=$PATH:$NDK_HOME

存檔


jimmy@jimmyubuntu:~$ source ~/.bashrc

確認 

jimmy@jimmyubuntu:~$ ndk-build
Android NDK: Could not find application project directory !    
Android NDK: Please define the NDK_PROJECT_PATH variable to point to it.  

 

測試 make hello-jni
jimmy@jimmyubuntu:~$ ndk-build -C $NDK_HOME/samples/hello-jni

可以在libs 目錄內產生libhello-jni.so
  

Samsung GALAXY Tab 10.1 adb on Ubuntu

http://kobablog.wordpress.com/2011/05/25/connecting-samsung-galaxy-tab-10-1-via-adb-on-ubuntu/


$export PATH=${HOME}/android-sdk-linux_x86/platform-tools/:$PATH



http://www.dotblogs.com.tw/bowwowxx/archive/2010/09/03/17548.aspx



有一些需要改 .android/adb_usb.ini




http://www.linuxidc.com/Linux/2012-10/73100.htm

在Linux(ubuntu)上安裝Eclipse + Android SDK

http://androidbiancheng.blogspot.com/2009/12/linuxubuntueclipse-android-sdk.html




//ubuntu 12.04 update


1.download JDK 7 ==> http://www.wikihow.com/Upgrade-Oracle-Java-on-Ubuntu-Linux


http://www.oracle.com/technetwork/java/javase/downloads/jdk7u9-downloads-1859576.html


2.


cd 下載


sudo mkdir /usr/local/java/


sudo -s cp -r jdk-7u9-linux-x64.tar.gz /usr/local/java/


cd /usr/local/java/


sudo -s chmod a+x jdk-7u9-linux-x64.tar.gz


sudo -s tar xvzf jdk-7u9-linux-x64.tar.gz


sudo gedit /etc/profile



sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/local/java/jdk1.7.0_09/bin/javac" 1


sudo update-alternatives --set javac /usr/local/java/jdk1.7.0_09/bin/javac



. /etc/profile


test


java -version



java version "1.7.0_09"


Java(TM) SE Runtime Environment (build 1.7.0_09-b05)


Java HotSpot(TM) 64-Bit Server VM (build 23.5-b02, mixed mode)



sudo gedit /etc/environment


add


JAVA_HOME=/usr/local/java/jdk1.7.0_09




Failed to get the adb version: Cannot run program “/opt/android-sdk/platform-tools/adb”: error=2


==> sudo apt-get install ia32-libs



Android SDK Manager 下載Android SDK失敗


Failed to fetch URL


==> etc/hosts =>增加


74.125.237.1 dl-ssl.google.com

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

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 設定到了,取消後就可以了

 

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 中文變亂碼:未處理