Posts

Showing posts from October, 2013

Fix Android Studio error "Local path doesn't exist."

Image
There are many solutions. I will begins with easiest solution.

a. Sync project with Gradle file.
b. Build/Rebuild project.
c. Restart Android Studio then do step a,b.
d. search *.iml in your project directory 
which named as your_project_name.iml
then add
<option name="APK_PATH" value="/build/apk/your_apk_file_name.apk" /> under <configuration>

ref.
http://www.youtube.com/watch?v=i4WcMIyc8OQ&feature=youtu.be
http://stackoverflow.com/questions/18256177/android-studio-local-path-doesnt-exist

How to handle EditText that cannot be null string

Image
There are two ways to handle editText that cannot be null string.

a. Check null string before INSERT to DB.
This way user may confuse because user cannot see the exact value.
However, this solution is easy to implement.

b. Check instantly when user type any text.
This way let user see the exact value by instantly change null string in the editText to " " or "0" or what ever you want.

The sample source code.

public void onCreate(Bundle bundleSavedInstanceState) {

super.onCreate(bundleSavedInstanceState);
editTextBtnStringValue[type][subType].setOnFocusChangeListener(this);

}

This method aim to prevent null value by update the Global variable which is currentFocusedEditText then call setNullCurretFocusedEditText()

@Override
public void onFocusChange(View view, boolean b) {
currentFocusedEditText = (EditText)view;
setNullCurretFocusedEditText();

}

public void setNullCurretFocusedEditText(){

if(currentFocusedEditText==null){
L.error("currentFocusedEditText=null");
return;
}
if(cur…

How to pull/read Android App 's database

Image
Outline

Pull Change Permission ReadProblems and Solutions
The program to read SQLite Database Download
To Pull
open cmd
then 
move to adb 's directory then run adb as root then pull
for example

D:
cd D:\Android\android-sdks\platform-tools
adb root

adb pull /data/data/com.example.umitems/databases/umitems.db .

note that   adb pull <source> <destination>

Change File permission and pull

adb shell "run-as package.name chmod 666 /data/data/package.name/databases/file"

adb pull /data/data/package.name/databases/file .


adb shell "run-as package.name chmod 600 /data/data/package.name/databases/file"

To Read
open cmd
then 
move to adb 's directory 
then run adb as root 
then move to your apps's directory
then use command sqlite3
D:
cd D:\Android\android-sdks\platform-tools
adb shell
su
cd /data/data/com.example.umitems/databases
ls
sqlite3 HealthAdvisor.db 

This is some useful command.
.helpList all commands and options.
.exitExit the sqlite3 command.
.schemaShow the CREATE statemen…