Android Tutorial

1.30.2012

The Eclipse Color Theme Plugin

The Eclipse Color Theme Plugin

 

 

The Eclipse Color Theme plugin makes it possible to switch color themes conveniently and without side effects. It includes the most popular themes from eclipsecolorthemes.org, but you can add any theme created on the site by exporting it as XML.

Installation

If you are on Eclipse 3.6 (Helios), the easiest way to install the plugin is from the Eclipse Marketplace. Go to Help→Eclipse Marketplace..., then search for Eclipse Color Theme and install it.
If you are on Eclipse 3.5 (Galileo), go to Help→Install New Software..., press Add Site and enter Eclipse Color Theme as the name and http://eclipse-color-theme.github.com/update as the URL. Then select the new entry from the select box labeled Work with, mark Eclipse Color Theme for installation and proceed.
Please note: If you are using a version of the plugin lower than 0.6, please uninstall and reinstall it following the instructions above. Update site and plugin ID have changed.

Usage

After the installation, go to Window→Preferences→General→Appereance→Color Theme to change the color theme.
If you have a feature request, create an issue or a pull request on GitHub.

 

12.27.2011

Copy and delete file in android



private void copyFile(String pathIn, String pathOut) {
Log.d(TAG, "copyFile start");
InputStream in = null;
OutputStream out = null;
try {
in = new FileInputStream(pathIn);
out = new FileOutputStream(pathOut);
copy(in, out);
in.close();
in = null;
out.flush();
out.close();
out = null;
delFile(pathIn);
} catch (Exception e) {
Log.e("copy clipart ERROR", e.toString());
e.printStackTrace();
}
Log.d(TAG, "copyFile end");
}

private boolean delFile(String filePath) {
File file = new File(filePath);
boolean deleted = file.delete();
return deleted;
}

/* ------------- File Processes -------------> */
/**
* Copy data from $from to $to
*
* @param $from
*            source
* @param $to
*            destination
* @throws IOException
*/
public static void copy(InputStream $from, OutputStream $to)
throws IOException {
byte[] buffer = new byte[1024];
int length;
while ((length = $from.read(buffer)) > 0) {
$to.write(buffer, 0, length);
}
$to.flush();
$to.close();
$from.close();
}

Copy file from assets to app in android



/**********************************
*
* Copy List file from folder if fileName != null : copy file of folderName
* if folderName == null: copy file of folder root assets else if folderName
* == null : copy all file of folder root assets
*
*
* *********************************/
private void copyFileFromAssetsToApp(String folderName, String fileName,
String folderNameInApp, String fileNameInApp, Context Ctx) {
Log.d(TAG, "copyClipart start");
AssetManager assetManager = getResources().getAssets();
final String root_dir = "/data/data/" + Ctx.getPackageName();
String basepath = root_dir + "/" + folderNameInApp;
if (Utils.checkNullOrEmpty(folderNameInApp)) {
basepath = root_dir;
}
File clipartdir = new File(basepath);
if (!clipartdir.exists()) {
clipartdir.mkdirs();
}

Unzip file not password in Android



/****************************************************************************
* Unzip file not password
*
* Example:
* String path = "/sdcard/files.zip";
* String folderOut = "/data/data" + mCtx.getPackageName() + "/folder";
* File fi = new File(path);
* InputStream zipIn = new FileInputStream(fi);
* // if asset : AssetManager assetManager = getResources().getAssets();
* // InputStream zipIn = assetManager.open("files.zip");
* unZipFileNotPass(zipIn, folderOut);
*
******************************************************************************/

8.26.2011

Get version code and version name in android

      main:
         PackageInfo manager = ggetPackageManager().getPackageInfo(getPackageName(), 0);
        Log.d(TAG, "Version Code = " + getVersionCode(manager));
        Log.d(TAG, "Version Name = " + getVersionName(manager));


      /*
* get Version code
*
*  @para PackageInfo manager = ggetPackageManager().getPackageInfo(getPackageName(), 0);
*/
public static int getVersionCode(PackageInfo manager){
int verCode= 0;
verCode = manager.versionCode;  
   return verCode;
}

/*
* get Version name
*
*  @para PackageInfo manager = ggetPackageManager().getPackageInfo(getPackageName(), 0);
*/
public static String getVersionName(PackageInfo manager){
String verName = "";
verName = manager.versionName;  
   return verName;
}

8.25.2011

resizeImage trong Android.


 public static Drawable resizeImage(Context ctx, int resId, int w, int h) {

     // load the origial Bitmap
     Bitmap BitmapOrg = BitmapFactory.decodeResource(ctx.getResources(),
                                                     resId);

     int width = BitmapOrg.getWidth();
     int height = BitmapOrg.getHeight();
     int newWidth = w;
     int newHeight = h;

     // calculate the scale
     float scaleWidth = ((float) newWidth) / width;
     float scaleHeight = ((float) newHeight) / height;

     // create a matrix for the manipulation
     Matrix matrix = new Matrix();
     // resize the Bitmap
     matrix.postScale(scaleWidth, scaleHeight);
     // if you want to rotate the Bitmap
     // matrix.postRotate(45);

     // recreate the new Bitmap
     Bitmap resizedBitmap = Bitmap.createBitmap(BitmapOrg, 0, 0,
                                                width, height, matrix, true);

     // make a Drawable from Bitmap to allow to set the Bitmap
     // to the ImageView, ImageButton or what ever
     return new BitmapDrawable(resizedBitmap);

    }

7.24.2011

Developing Native Android Apps with Titanium

In today’s Titanium Week webinar, we took a look at features new and old for developing native Android applications using Titanium. Hacker Extraordinaire Marshall Culpepper surveys major Android native application concepts, like Activities, Intents, and Services, and shows how to apply these concepts in your Titanium application to create a deeply integrated native application experience on Android. Other cross-platform development techniques and code structure options are explored, and we tease our next great super demo app, Tweetanium!
Please find both the slides and recorded webinar below. In addition to Tweetanium, Marshall’s example project (used in this presentation) will be posted to GitHub early next week:

Android C native development – take full control!

EDIT Nov-2010 There is an easier way to compile native C code, see this article.
A recent project I've been working on required Bluetooth programming on the Android.
Having a quick look over the latest 1.5 Android SDK, I could see that bluetooth support was missing. Later research pointed out that Google expressively excluded Bluetooth APIs blaming lack of time.
On the other hand, I'm not a big Java fan, to say the least. I find Java unfriendly, and I don't like the look and feel of Java apps. Sorry, I prefer C/C++ since it provides better control and flexibility. So it's time to start doing C/C++ native applications for the Google Android.
How run a C program on Google Android?
First thing I'll show here, is to compile a simple C program for the Android.


#include <stdio.h>
int main()
{
printf("Hello Google Android world!\nwww.pocketmagic.net\n");
return 1;
}

7.13.2011

Top 5 Linux Video Editor Software

I'm looking for a free video editor similar to - Adobe Premiere Pro, Apple iMovie, Final Cut Pro or Microsoft Movie Maker under Linux Desktop operating system. My tasks are pretty simple such as cutting, filtering, and encoding tasks etc. Can you provide me a list of FOSS software which can be used for video capture and video editing purposes under Fedora or Ubuntu Linux desktop systems?

A non-linear editing system (NLE) is a video editing (NLVE) or audio editing (NLAE) system which can provide editing method for video clips or frams. You will be able to access any frame in a video clip. Non-linear editing is done for film and television post-production. However, the cost of editing system gone down and non-linear editing tools (including software) are now within the reach of most home users.
MS-Windows PC included Windows Movie Maker and Apple computer comes with iMovie. Most Linux based editing software can now be downloaded free of charge from the Internet. You also need a video capture card and a FireWire connection to capture digital video from a DV camera.

Avidemux

Converting Views to Bitmap Images in Android

When working with applications, developers can sometimes run in to a situation where they would like to create a view and then convert it to a Bitmap to work with it as an image. Learn how in this easy to follow guide.

In some applications, we would like to create a View with texts, images, and more view-elements and convert it to a Bitmap. Why? Well, you don't know until you need it, but imagine that you are working with OpenGL, you want to add textures to a OpenGL object, and you want these textures view-like. This is just an example, but I'm positive that more functionality will come to your mind while you are developing in Android.

Short introduction to Bitmap and Canvas

7.12.2011

How to move all Android apps to SD card

One of the most anticipated additions to Android 2.2 (aka Froyo) was ability to install applications to SD card. When internal phone memory gets full, Android users have two problems: 1) users can’t install any more apps and 2) phone starts working slowly. The slow down is caused by the lower speed of write operations to the internal phone flash memory when it’s getting full (see this post for more information on this topic), but the bottom line is that having low available space in the internal memory is not desirable.
So what should a user do when the phone is running out of internal memory? Uninstalling unused apps is an obvious and easiest solution. Moving apps that support Froyo’s apps2sd feature to SD card is another option. However, for this feature to work developers need to enable this option in their apps and unfortunately many large apps still do not support apps2sd. Turns out there is a hack that can let you move almost any Android app to SD card even if the app developer did not enable this option. More about this hack below, but first let’s take look at the limitations of the Android apps2sd feature.

uberSVN 11.6 Released

Welcome

1. Introduction

This user guide describes the beta edition of WANdisco's uberSVN.
Welcome to the uberSVN User Guide - quick start guide to getting uberSVN set up, a reference for getting the most out of uberSVN and getting more done, more quickly with Subversion.

1.1 What is uberSVN

uberSVN, as the name suggests, is intended to be the ultimate Subversion distribution. Developed with growth in mind, expanding the scope and functionality of Subversion (utilizing WANdisco's own rock-solid Subversion binaries) and delivering a fuller, more complete Free-to-use package than is currently available elsewhere.

1.2 uberSVN Family

While uberSVN is focused only on expanding the scope and functionality of Subversion, later products will expand into full ALM stacks, based on a completely modular approach that allows companies to benefit from increased integration, without being locked into specific components.

1.3 Intended Audience

We've developed uberSVN to be useful to both new-starters and experienced Subversion users. Likewise, this guide has been written with the same wide audience in mind.

1.4 Documentation for 3rd party components

uberSVN is integrated with several open source software components that require user-level documentation, in these cases links are provided to the open source vendor's own documentation.
You can keep up-to-date with the latest uberSVN news, talk to us or other users in SVNForum.org's uberSVN Community forum.

Installation SVN on Ubuntu

Installation on Ubuntu

You can install from our PPA, our tarball archive, or directly from our Subversion repository. Users new to Ubuntu should use the PPA option.

Adding the PPA

Karmic and later

sudo add-apt-repository ppa:rabbitvcs/ppa

Hardy, Intrepid and Jaunty

Add the following line to your /etc/apt/sources.list file (signing key=1024R/34EF4A35):
deb http://ppa.launchpad.net/rabbitvcs/ppa/ubuntu **DISTRIBUTION** main

Installing RabbitVCS

Update your software package repositories with:

Tu dien tieng viet cho android – Andict

 
Đây là bản từ điển Andict 1.0 được gửi đi tham dự cuộc thi HTC Android Contest và dành giải khuyến khích. Mình xin tặng lại toàn bộ mã nguồn cũng như dữ liệu của chương trình cho cộng đồng với mong muốn chương trình sẽ ngày càng phát triển và hữu ích cho nhưng người sử dụng Android.
Chương trình có đầy đủ các chức năng cơ bản của 1 app từ điển cộng với một số điểm đặc biệt sau
- hỗ trợ dịch đoạn văn thông qua google translate (dịch online)
- Có gần như các loại từ điển giữa tiếng việt và các ngôn ngữ thông dụng
- Có Wikipedia offline (hiện có tiếng việt và tiếng Đức, nếu có nhu cầu mình sẽ build thêm các ngôn ngữ khác)
- Phát âm giọng người thật = tiếng anh
Hướng dẫn cài đặt
- Trước khi cài file APK các bạn cần tạo thư mục trên thẻ nhớ của mình như hình vẽ, thư mục mẹ là Andict, các thư mục con là db và sound

Tải phần mềm Từ điển tiếng việt cho android tại đây:
- Download các gọi dữ liệu cũng như file apk tại
Code:
http://code.google.com/p/andict
- Download dữ liệu phát âm tại
Code:
http://www.box.net/shared/vrgf63r531
- Copy file dữ liệu vào thư mục tương ứng : dữ liệu từ điển copy vào thư mục db, dữ liệu phát âm copy vào thư mục sound
- Cài đặt file apk và bắt đầu sử dụng chương trình.
Lưu ý: phần âm thanh do quá lớn nên khi dịch máy xong là báo lỗi, bạn có thể bỏ phần sound này đi từ điển sẽ dùng được bình thường.

Website: porting Android to beagel board


http://code.google.com/p/beagleboard/wiki/DeprecatedBeagleSources

http://elinux.org/BeagleBoard#Revision_B
http://code.google.com/p/beagleboard/wiki/DeprecatedBeagleSources

Poarting Android on TI Zoom2

//COMPILER
//Download cross compiler to Desktop from:

$firefox http://www.codesourcery.com/sgpp/lite/arm/releases/2007q3
$ mkdir /home/user/bin
//(Select ARM GNU/Linux and IA32 GNU/Linux options)
//copy download zip to /home/user/bin and unzip here
$ cp /home/user/Desktop/arm-2007q3-51-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2 /home/user/bin
$ cd /home/user/bin
$ tar -xjvf arm-2007q3-51-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
//Edit bashrc shell setup
$ cd /home/user
$ gedit .bashrc
//add following to the end
#PATH
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
export PATH=$PATH:/home/user/bin/arm-2007q3/bin //for tools
//save and exit
//apply the path changes
$ source .bashrc
//verify path is ok for tools
$ which arm-none-linux-gnueabi-gcc
//should see /home/usr/bin/arm-2007q3/bin/arm-none-linux-gnueabi-gcc

Howto: Run Internet Explorer 7 within Ubuntu 10.04 (Lucid Lynx)

As a webdeveloper, I am obviously required to test the websites I create in the most common A-grade browsers to ensure that they are usable and functional for the majority of the visitors. After switching from Windows to Ubuntu, I soon recognized the need for an Internet Explorer clone to test website for malfunctions. Having a dualboot (Windows and Ubuntu installed on one system) did work for some time, but last week I started looking for a better and faster solution. First I ran into a IEs4Linux, a software package enabling the use of Internet Explorer 5, 5.5 and 6 on Linux (with partial support for Internet Explorer 7 in a two year old beta). While this package might be handy for webdevelopers still supporting antique browsers, I searched further and ran into a Spanish tutorial that enabled me to install Internet Explorer 7 within Ubuntu. Unable to find a good English tutorial, I decided to write my own tutorial using the knowledge from the Spanish version and my installation experiences. By following the steps below, you should be able to run Internet Explorer 7 within Ubuntu without much trouble.

7.11.2011

Running Internet Explorer in Ubuntu Linux

IEs4Linux is the simpler way to have Microsoft Internet Explorer running on Linux (or any OS running Wine).
No clicks needed. No boring setup processes. No Wine complications. Just one easy script and you’ll get three IE versions to test your Sites. And it’s free and open source.This may be very helpful for software developers and web developers to test their applications.
IEs4Linux Installation in Ubuntu
You have to enable universe packages first. It is also recommended that you use the official winehq ubuntu package:
Open /etc/apt/sources.list file
sudo gedit /etc/apt/sources.list
Uncomment following lines in your /etc/apt/sources.list and it may be different if you are in different country instead of UK
For Ubuntu Dapper Users