Android examples for Android OS:Process
get Process Name From File system
//package com.java2s; import java.io.BufferedReader; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static String getProcessNameFromFilesystem() { StringBuilder sb = new StringBuilder(); BufferedReader cmdlineReader = null; try {// w w w.ja v a2 s . c o m cmdlineReader = new BufferedReader(new InputStreamReader( new FileInputStream("/proc/" + android.os.Process.myPid() + "/cmdline"), "iso-8859-1")); int c; while ((c = cmdlineReader.read()) > 0) { sb.append((char) c); } return sb.toString(); } catch (IOException e) { } finally { if (cmdlineReader != null) { try { cmdlineReader.close(); } catch (IOException e) { } } } return sb.toString(); } }