Emulator 執行時會自動讀取img檔, 但是如果修改程式後不會自動安裝到emulator中
所以要repack image, 重新讀取新的img檔
2012年5月16日 星期三
2012年5月9日 星期三
[Android] Run Android 4.0.4 compiled android source build system on emulator
// set ANDROID_PRODUCT_OUT to environment
$ export ANDROID_PRODUCT_OUT="/android/out/target/product/generic"
// execute emulator
$ export ANDROID_PRODUCT_OUT="/android/out/target/product/generic"
// execute emulator
$ ./out/host/linux-x86/bin/emulator
[Android] 解決 Ubuntu 11.10 編譯Android 4.0.4 錯誤 - Solve Compile Android 4.0.4 failed on Ubuntu 11.10
在Ubuntu 11.10 Compile Android 4.0.4 時會有這個錯誤
make: *** [out/host/linux-x86/obj/EXECUTABLES/obbtool_intermediates/Main.o] Error 1
make: *** Waiting for unfinished jobs....
<command-line>:0:0: warning: "_FORTIFY_SOURCE" redefined [enabled by default]
<built-in>:0:0: note: this is the location of the previous definition
後來發現是gcc版本4.6.1導致的問題, 降到4.4就可以
降的方法就是把gcc-4.4設成預設在bin裡面, 可以藉由檢查$PATH, 知道bin的優先順序
像我是有在家目錄另外開一個bin (~/bin), 然後擺在$PATH的第一個
所以我只要把gcc跟g++ link到~/bin裡
$ ln -s /usr/bin/gcc-4.4 ~/bin/gcc
$ ln -s /usr/bin/gcc-4.4 ~/bin/cc
$ ln -s /usr/bin/g++-4.4 ~/bin/g++
$ ln -s /usr/bin/g++-4.4 ~/bin/c++
// 檢查版本
$ gcc -v
$ g++ -v
如果你的電腦沒有4.4版就要透過apt-get另外安裝
$ sudo apt-get install gcc-4.4 g++-4.4 gcc-4.4-multilib
2010年11月12日 星期五
[Android] 預設開啟Menu選單 openOptionsMenu
在Activity加上onAttachedToWindow() 方法
public void onAttachedToWindow() {
super.onAttachedToWindow();
openOptionsMenu();
}
2010年11月10日 星期三
[Android] Conversion to Dalvik format failed with error 1 解決方法
今天Eclipse的Console突然出現一堆錯誤訊息都是
1. 選取所有的Project
2. 點選單列的Project -> Clean
3. 選Clean All Projects, 然後按OK就解決了!
可能有其他情況會出現一樣的錯誤, 如果這成功/不成功 解決你的問題, 請讓我知道 :) thanks
Conversion to Dalvik format failed with error 1
解決方法
1. 選取所有的Project
2. 點選單列的Project -> Clean
3. 選Clean All Projects, 然後按OK就解決了!
可能有其他情況會出現一樣的錯誤, 如果這成功/不成功 解決你的問題, 請讓我知道 :) thanks
2010年11月8日 星期一
[Android] 將ImageButton背景設為透明
左邊透明, 右邊是一般
我發現設為透明最快的方法, 就是設為@null:
在網路上看到有人說
透明是#00000000
半透明是#e0000000
不過目前我試不出半透明跟透明差在哪= ="
我發現設為透明最快的方法, 就是設為@null:
<ImageButton android:id="@+id/ImageButton01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/normal" android:background="@null" />
在網路上看到有人說
透明是#00000000
半透明是#e0000000
不過目前我試不出半透明跟透明差在哪= ="
[Android] Activity Lifecycles 生命週期
執行App時: OnCreate() -> OnStart() -> OnResume()
結束App時: OnPause() -> OnStop() -> OnDestroy()
Finish() -> OnPause() -> OnStop() -> OnDestroy()
暫停App時: OnPause() -> OnStpop()
重啟App時: OnRestart() -> OnStart() -> OnResume()
以下是測試程式 (使用Toast顯示文字):
package com.demo.activitycycle;
import android.app.Activity;
import android.os.Bundle;
import android.widget.Toast;
public class ActivityLifeCycle extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Toast.makeText(this, "OnCreate()", Toast.LENGTH_SHORT).show();
}
@Override
protected void onDestroy() {
super.onDestroy();
Toast.makeText(this, "OnDestroy()", Toast.LENGTH_SHORT).show();
}
@Override
protected void onPause() {
super.onPause();
Toast.makeText(this, "OnPause()", Toast.LENGTH_SHORT).show();
}
@Override
protected void onRestart() {
super.onRestart();
Toast.makeText(this, "OnRestart()", Toast.LENGTH_SHORT).show();
}
@Override
protected void onResume() {
super.onResume();
Toast.makeText(this, "OnResume()", Toast.LENGTH_SHORT).show();
}
@Override
protected void onStart() {
super.onStart();
Toast.makeText(this, "OnStart()", Toast.LENGTH_SHORT).show();
}
@Override
protected void onStop() {
super.onStop();
Toast.makeText(this, "OnStop()", Toast.LENGTH_SHORT).show();
}
}
Reference:
http://developer.android.com/guide/topics/fundamentals.html#lcycles
http://developer.android.com/reference/android/widget/Toast.html
[Android] ADB常用指令
adb [-d | -e | -s <serialNumber>] <command>
-d 是送到USB的實際連接設備
-e 是只送到模擬器
如果執行複數個模擬器, 就要用serialNumber來區別
-s <serialnumber>
安裝或移除apk
install安裝後面接的參數是apk的檔案路徑名稱
uninstall移除後面接的參數是package name
ex:
adb -s emulator-5554 install helloworld.apk adb uninstall com.myandroid.helloworld
偵測設備資訊
# List of devices attached adb devices # device(運作中), offline(離線), bootloader(開機中) adb get-state # 取得執行模擬器的序號 adb get-serialno
進入shell命令列模式
指令跟Linux一樣adb shell # ls /data/data # ls /data/app
2010年11月5日 星期五
[Android] HTC Desire 開發機環境設置
安裝Android SDK
安裝HTC Sync
USB連線類型選HTC Sync
手機設定:
設定->應用程式
未知的來源 -> 打勾
開發 -> 除錯 -> 打勾
開發 -> 除錯 -> 打勾
2009年6月5日 星期五
[Android] Android Architecture
- Applications
- All applications are written using the Java programming language.
- Application Framework
- Developers have full access to the same framework APIs used by the core applications. The application architecture is designed to simplify the reuse of components
- Libraries
- System C library - a BSD-derived implementation of the standard C system library (libc), tuned for embedded Linux-based devices
- Media Libraries - based on PacketVideo's OpenCORE; the libraries support playback and recording of many popular audio and video formats, as well as static image files, including MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG
- Surface Manager - manages access to the display subsystem and seamlessly composites 2D and 3D graphic layers from multiple applications
- LibWebCore - a modern web browser engine which powers both the Android browser and an embeddable web view
- SGL - the underlying 2D graphics engine
- 3D libraries - an implementation based on OpenGL ES 1.0 APIs; the libraries use either hardware 3D acceleration (where available) or the included, highly optimized 3D software rasterizer
- FreeType - bitmap and vector font rendering
- SQLite - a powerful and lightweight relational database engine available to all applications
- Android Runtime
- Every Android application runs in its own process, with its own instance of the Dalvik virtual machine.
- The Dalvik VM relies on the Linux kernel for underlying functionality such as threading and low-level memory management.
- Linux Kernel
- Android relies on Linux version 2.6 for core system services such as security, memory management, process management, network stack, and driver model.
What is Android?
[Android] Dalvik VM Internals
Dalvik Virtual Machine insights
http://www.dalvikvm.com
Dalvik VM Internals - Dan Bornstein (Google)
http://sites.google.com/site/io/dalvik-vm-internals
http://www.dalvikvm.com
Dalvik VM Internals - Dan Bornstein (Google)
http://sites.google.com/site/io/dalvik-vm-internals
[Android] 相關資源網站
Android API Levels
http://developer.android.com/guide/appendix/api-levels.html
Android | Official Website
http://www.android.com
Welcome (Android Open Source Project)
http://source.android.com/
Android Developers
http://developer.android.com/
Android Programming
http://andbook.anddev.org/
AiDiJi.com - Android Apps & Games Store
http://www.aidiji.com/
Programming with the Google SDK
DroidDraw Beta
User Interface (UI) designer/editor for programming the Android Cell Phone Platform
http://www.droiddraw.org/
Android中文資源站
AndroidBMI 是 Android 平台上的 BMI (Body Mass Index) 值計算器
21 個免費 Android 程式 讓你的 i7500 更實用!
訂閱:
文章 (Atom)



