I made my Android app looks like iPhone app. See the image below.
Make Android UI looks like iPhone UI
Posted in Programming | Tags: Android
Make iOS UISwitch style in Qt4.
Recursively remove a directory in Qt4
Today I wrote a code to remove a directory and all its sub-directories and files.
bool MyUtil::removeDir(const QString& dirName)
{
bool result = true;
QDir dir(dirName);
if (dir.exists(dirName))
{
Q_FOREACH(QFileInfo info, dir.entryInfoList(QDir::NoDotAndDotDot|QDir::AllDirs|QDir::Files, QDir::DirsFirst))
{
if (info.isDir())
result = removeDir(info.absoluteFilePath());
else
result = QFile::remove(info.absoluteFilePath());
if (!result)
return result;
}
result = dir.rmdir(dirName);
}
else
{
QFile file(dirName);
if (file.exists())
result = file.remove();
}
return result;
}//removeDir()
Posted in Programming | Tags: Qt, Qt4
How to compile ffmpeg/x264 for Windows
Very good script that will checkout codes and compile libraries. Nice!
http://csbarn.blogspot.com/2011/02/how-to-compile-ffmpegx264-for-windows.html
Posted in Programming | Tags: ffmpeg, x264
Android NDK with PThread
After spending several hours debugging, I finally figure out how to solve the crash in my native code while calling pthread_exit(). The log showed “thread exiting, not yet detached (count=0)“.
Scenario:
I have an Android java code which will call my JNI (NDK) native code. In my native code, I create a pthread and in my pthread loop, I called AttachCurrentThread() to the JVM in the beginning of the loop.
When my java code finish some jobs, I need to stop the pthread and it crashed at the end of pthread loop.
Solution:
So, before I exit my pthread loop (before calling pthread_exit), I need to make sure I do call DetachCurrentThread from JVM.
Posted in Programming | Tags: Android, JNI, NDK, pthread

