Android First Program eclipse- getting started

Android apps are written in Java, and use XML extensively. I shall assume that you have basic knowledge of Java programming and XML.
Step 0: Read - Read "Hello, world" tutorial at http://developer.android.com/resources/tutorials/hello-world.html.
Step 1: Create a Android Virtual Device (AVD) - AVDs are emulators that allow you to test your application without the physical device. You can create AVDs for different android platforms (e.g., Android 2.3 for phone, Android 3.2 for tablet) and configurations (e.g., screen sizes and orientations, having SD card and its capacity).

java zip- create text file from list of string and zip them

java - create text files from list of string and zip them ( without creating temporary file)

 private static void list_of_string_into_text_file_and_zip_them_all(List dataList) throws Exception {

  File zipFile = new File("OutputZipFile.zip");
  ZipOutputStream out = new ZipOutputStream(new FileOutputStream(zipFile));
  int count = 0;

  for (String string : dataList) {

   // repeat for each string
   String fileNameInsideZip = ++count + "-inside_text_file.txt";
   ZipEntry e = new ZipEntry(fileNameInsideZip);
   out.putNextEntry(e);

   // write data into zip entry
   byte[] data = string.getBytes();
   out.write(data, 0, data.length);
   out.closeEntry();
  }
  out.flush();
  out.close();

 }

Testing the code :

 public static void main(String[] args) throws Exception {
  // store string into text file - and zip them . doesnot create a
  // temporary text file.
  List test = new ArrayList();
  test.add("This is amazing");
  test.add("What a wonderful world");
  test.add("This is a beautiful day ");
  list_of_string_into_text_file_and_zip_them_all(test);
 }

For creating a single text file from string and zip it - see  this post.

Final Report : Text Prompted Remote Speaker Authentication : Joint Speech and Speaker Recognition/Verification System

Here is complete report of our project :Text Prompted Remote Speaker Authentication : Joint Speech and Speaker Recognition/Verification System


Next time ... Runnable Project or may be snapshots..... just wait

Presentation Slide for this report and project work is here.

Some Intelligent Humorous Quotes about Computer/Science

Here is some my favorite quotes that i collected from different pages


  • "In order to understand recursion, one must first understand recursion."
  • Any fool can write code that a computer can understand. Good programmers write code that humans can understand.-Martin Fowler
  • Theory is when one knows everything, but nothing works. Practice is when everything works, but nobody knows why.
  • Theory is when you know something, but it doesn't work. Practice is when something works, but you don't know why. Programmers combine theory and practice: Nothing works and they don't know why.
  • If Java had true garbage collection, most programs would delete themselves upon execution.
  • Beware of bugs in the above code; I have only proved it correct, not tried it. Donald Knuth
  • "There are 10 types of people in the world, those who can read binary, and those who can't."
  • We better hurry up and start coding, there are going to be a lot of bugs to fix.
  • UNIX is basically a simple operating system, but you have to be a genius to understand the simplicity- Dennis Ritchie
  • If I had more time, I would have written a shorter letter-Cicero
  • "When all you have is a hammer, everything starts to look like a nail." 

java zip - create text file of String and zip it

Create a text file with some string (without temporary file) and zip it : working source code java

 private static void zip_single() throws Exception {
  final StringBuilder sb = new StringBuilder();
  sb.append("Test String that goes into text file inside zip");

  final File f = new File("single_text_file_inside.zip");
  final ZipOutputStream out = new ZipOutputStream(new FileOutputStream(f));
  ZipEntry e = new ZipEntry("inside_text_file.txt");
  out.putNextEntry(e);

  byte[] data = sb.toString().getBytes();
  out.write(data, 0, data.length);
  out.closeEntry();

  out.close();
 }

Call as :
 public static void main(String[] args) throws Exception {
  zip_single();
 }

For creating text files from List of string and zip them - see my earlier post 

Final Presentation Slide :Text Prompted Remote Speaker Authentication : Joint Speech and Speaker Recognition/Verification System

Here is the download link for our final years project's presentation slide. The title of project is Text Prompted Remote Speaker Authentication which is a Joint Speech and Speaker Recognition/Verification System and uses Gaussian Mixture Model and Hidden Markov Model/Vector Quantization for classification and MFCC as feature Vector.

Refer to http://ganeshtiwaridotcomdotnp.blogspot.com/2010/12/text-prompted-remote-speaker.html for detail of our project.

This project was done at Tribhuvan University, Institute of Engineering-Department of Electronics and Computer Engineering, Kathmandu, Nepal during November 2010 to January 2011.
The project members were:
Ganesh Tiwari
Madhav Pandey
Manoj Shrestha

Speaker Verification for Remote Authentication

Java open url in default system browser

open a url in system default browser - work for all  : windows, mac, linux operating systems

Full working JAVA source code example
import java.io.IOException;
public class StartBrowserUtil {
    private StartBrowserUtil() {
    }
    public static void openURL(String s) {
        String s1 = System.getProperty("os.name").toLowerCase();
        Runtime runtime = Runtime.getRuntime();
        try {

Java Image Processing : Negative of Input Image - source code

The code below is for getting negative of an input image in JAVA:


public class TestImagesss {
    public static void main(String[] args) {
        BufferedImage org = getImage("test.jpg");
        BufferedImage negative = getNegativeImage(org);
        new ImageFrame(org, "Original");
        new ImageFrame(negative, "After Negative");

java hex -int-string-byte conversion source code

Hexadecimal conversion - string, byte, integer - working java source code example :

public final class HexConvertUtils {

    private HexConvertUtils() {
    }

    public static byte[] toBytesFromHex(String hex) {

Java delete a folder and subfolders recursively

Java source code for deleting a folder and subfolders recursively.
Code for copying and moving files is here.
Working source code example:
public final class FileIOUtility {
    private FileIOUtility() {}
    public static boolean deleteFile(File fileToDelete) {
        if (fileToDelete == null || !fileToDelete.exists()) {
            return true;
        } else {

Java - contro lkeyboard 'lock key' state programmatically

Java Controlling the lock keys : Caps Lock, Scroll Lock, Num Lock 's state - programmatically
public class Lock_Key_Control_In_Java {
    public static void main(String[] args) {
        Toolkit tk = Toolkit.getDefaultToolkit();

        //enable disable key state Caps Lock, Scroll Lock, Num Lock keys
        tk.setLockingKeyState(KeyEvent.VK_NUM_LOCK, true);
        tk.setLockingKeyState(KeyEvent.VK_CAPS_LOCK, false);
        tk.setLockingKeyState(KeyEvent.VK_SCROLL_LOCK, false);
    }
}
The lock keys LED in the keyboard should be  turned ON or OFF ?

Java: Loading images in JFrame - Reusable ImageFrame

Sometimes we need to show multiple images in separate window by using single line statement :
new ImageFrame(inImg, "Input Image ");// inImg is reference to Image object
The code below can be used to load images in JFrame as a separate window.

java copy file, move file code example

Java source code - copying a file , moving a file - working source code example :
Code for deleting a folder and sub folder recursively is here 
public final class FileIOUtility {
    private FileIOUtility() {}
    public static void moveFile(File src, File targetDirectory) throws IOException {
        if (!src.renameTo(new File(targetDirectory, src.getName()))) {
            String str = (new StringBuilder()).append("Failed to move ").append(src).append(" to ").append(targetDirectory).toString();
            throw new IOException(str);
        } else

Installing Android SDK, ADT in eclipse

How to Install Android SDK, ADT
Step 0: Read the Documentations - 
Start from Android's mother site @http://www.android.com

Android: Introduction to android platform - framework

Brief Introduction

Android is an Operating System for mobile devices developed by Google, which is built upon Linux kernel. Android competes with Sambian OS,

Final Year Computer Project Suggestion, A HUGE LIST

Here is a list of project suggestion for final year project (BE computer).
I have collected them from various sites.

Screen capture Utility , Automatic Video Tutorial Maker
HTML Editor - text processing
Image Search engine using image clustering
Semantic WEB
PCI/USB FM RadiPlayer with Tunning, Volume Control, and capture feature
LAN Based Bit Torrent
Automatic Friend tagging on Facebook based on Face Recognition
Hostel Election Software
Collaborative Web Browsing
Web based Application for Multiple Clients
ATM USING FINGER PRINTS
WEBCAM BASED HUMAN MACHINE INTERACTION (WEBCAM MOUSE)
MAC Layer Scheduling in Ad-hoc Networks
WIRELESS AUDIENCE POLLING SYSTEM
FACE DETECTION USING HSV (BY PERFORMING SKIN SEARCH OF INPUT IMAGE)
Smart Mail Transfer Protocol
Windows Multi File Search utility
FTP Explorer
Harddisk data recovery tool
Consumer-oriented devices and services
Mobile TV and IPTV
Telemedicine portals
Gesture Recognition using ANN or HMM or ..
TCPIP Chat client server