Posts

Showing posts from 2014

DeCompile .apk file on ubuntu 14.04

1. Download   Dex2jar from  http://dex2jar.googlecode.com/files/dex2jar-0.0.9.15.zip    and Extract it. 2. Go to Download path      ./d2j - dex2jar . sh / home /manoj / someApk . apk   if .sh is not compilable that giver chomod a+x d2j - dex2jar . sh permission.     3. It will generate .jar file.     To open that .jar file we have to use JD-Gui. Just download http://jd.benow.ca/jd-gui/downloads/jd-gui-0.3.5.linux.i686.tar.gz it    and Go to that path. and follow below command throught your terminal(ALT+CTR+T).   Here's the process I went through:    $ ./jd-gui ./jd-gui: error while loading shared libraries: libgtk-x11-2.0.so.0: cannot open shared object file: No such file or directory $ sudo apt-get install libgtk2.0-0:i386 $ ./jd-gui ./jd-gui: error while loading shared libraries: libXxf86vm.so.1: cannot open shared object file: No such file or directory $ sudo apt-get install libxxf86vm1:i386 $ ./jd-gui ./jd-gui: error while loading shared librar

Ubuntu Refrences and Commands Hacks

Privileges sudo command – run command as root sudo -s – open a root shell sudo -s -u user – open a shell as user sudo -k – forget sudo passwords gksudo command – visual sudo dialog (GNOME) kdesudo command – visual sudo dialog (KDE) sudo visudo – edit /etc/sudoers gksudo nautilus – root file manager (GNOME) kdesudo konqueror – root file manager (KDE) passwd – change your password Network ifconfig – show network information iwconfig – show wireless information sudo iwlist scan – scan for wireless networks sudo /etc/init.d/networking restart – reset network for manual configurations (file) /etc/network/interfaces – manual configuration ifup interface –

Dedicated Runtime Thread (ART vs Dalvik)

What is Dalvik? Dalvik is the process virtual machine (VM) in Google's Android operating system. It is the software that runs the apps on Android devices. Dalvik is thus an integral part of Android, which is typically used on mobile devices such as mobile phones and tablet computers as well as more recently on embedded devices such as smart TVs and media streamers. Programs are commonly written in Java and compiled to bytecode. They are then converted from Java Virtual Machine-compatible .class files to Dalvik-compatible .dex (Dalvik Executable) files before installation on a device. The compact Dalvik Executable format is designed to be suitable for systems that are constrained in terms of memory and processor speed. Dalvik is open-source software. Dalvik is named after an Icelandic city. (source) Okay so what is ART? ART is a project Google has been working on for reportedly for 2 years. The goal of ART was to produce a faster runtime that wou

How To Install Git 1.9.0 On Ubuntu 14.04,13.10,12.10,12.04,10.04, Linux Mint 16,14,13 And Elementary OS 0.2

Image
$ sudo add-apt-repository ppa:git-core/ppa $ sudo apt-get update $ sudo apt-get install git Push Your App to GitHub Check if Git is installed In the terminal type git --version (1.8 or higher preferred) If not, download Git [here] (http://git-scm.com/downloads). Then, setup your local Git profile - In the terminal: Type git config --global user.name "your-name" Type git config --global user.email "your-email" To check if Git is already config-ed you can type git config –list Push your app to GitHub using the command line git init git status git add . git commit -m "first commit" git remote add origin https://github.com/username/yourprojectname.git git push -u origin master enter your username and password of github GIT and REPO CheatSheet

Install JDK on Ubuntu

sudo apt-add-repository ppa:webupd8team/java sudo apt-get update sudo apt-get install oracle-java7-installer #replace 7 with 6 or 8 Switch installed JDK using below commands sudo update-alternatives --config java There are 2 choices for the alternative java (providing /usr/bin/java).   Selection    Path                                     Priority   Status ------------------------------------------------------------   0            /usr/lib/jvm/java-6-oracle/jre/bin/java   2         auto mode * 1            /usr/lib/jvm/java-6-oracle/jre/bin/java   2         manual mode   2            /usr/lib/jvm/java-7-oracle/jre/bin/java   1         manual mode Press enter to keep the current choice[*], or type selection number: select the number and press Enter

Generate SHA1 Key Using Terminal

keytool - list - v - keystore ~ /.android/ debug . keystore - alias androiddebugkey - storepass android - keypass android

How to Create & Extract tar.gz and tar.bz2 Files in Linux

>How to create a compressed tar.gz file from a folder or file in Linux?   tar czf new-tar-file-name.tar.gz file-or-folder-to-archive Here is the command explanation: tar - the tar command. c - create new archive. z - compress the archive using gzip. f - use archive file. new-tar-file-name.tar.gz - the name of the tar.gz to create. file-or-folder-to-archive - the name of the folder we want to archive. >How to create a compressed tar.gz file from multiple files and folders in Linux?   tar -czf new-tar-file-name.tar.gz file1 file2 folder1 folder2 >How to extract a compressed tar.gz file in Linux? tar -xzf tar-file-name.tar.gz Here is the command explanation: tar - the tar command. x - extract the archive. z - uncompress the archive using gzip. f - use archive file. tar-file-name.tar.gz - the name of the tar.gz to create. The tar command will extract all the files/folders in the archive to the current directory.   >How to extract a compress

Sample Syntax Declaration for NDK

Getting Static String from JNI               env->NewStringUTF( "I am back with string!" ); Ac c ess Fields Declared in java class ( public float [] VertexCoords ; ) 1. jclass cls = env->GetObjectClass(obj); // obj is the object of java class 2. jfieldID fieldId = env->GetFieldID(cls, "VertexCoords" , "[F" );                      // VertexCoords is the name of variable defined in java                     // [F defines the type of variable it is array float 3 . jobject objArray = env->GetObjectField (obj, fieldId);                  // Take the field in jobject. 4 . jfloatArray* fArray = reinterpret_cast <jfloatArray*>(&objArray);                // Cast it to jfloatArray 5. jsize len = env->GetArrayLength(*fArray);              //get the length of float array 6. float * dat
JNI Types and Data Structures   Table 3-1 Primitive Types and Native Equivalents Java Type Native Type Description boolean jboolean unsigned 8 bits byte jbyte signed 8 bits char jchar unsigned 16 bits short jshort signed 16 bits int jint signed 32 bits long jlong signed 64 bits float jfloat 32 bits double jdouble 64 bits void void N/A   Type Signatures The JNI uses the Java VM’s representation of type signatures. Table 3-2 shows these type signatures. Table 3-2 Java VM Type Signatures Type Signature Java Type Z boolean B byte C char S short I int J long F float D double    L fully-qualified-class ; fully-qualified-class [ type type[] ( arg-types ) ret-type method type For example, the Java method:

Design Android Settings page in application with Custom Strings.xml

Image
Hi Guys, In this tuttorial I would like to explain about the android settings screen and also how can a developers can customize there own strings.xml file ex. you can name your string.xml file as strings_common.xml or xyz.xml. Please find the source code from below link. Hope this will help to some of the developers. https://www.dropbox.com/s/dqvmji1swuw7bmj/SettingsPageDesign.zip

Fragments Video player with remote url

Image
If any one like this than please find out the source code from Below link https://www.dropbox.com/s/qwhyyooydzl26a4/FragmentVideoPlayer.zip

Write Utils Class in Android

public class Utils { public static void showToast(Context context, String message) { Toast toast = Toast.makeText(context, message, Toast.LENGTH_SHORT);    toast.show(); toast.setGravity(Gravity.CLIP_HORIZONTAL | Gravity.CENTER_HORIZONTAL, 0, 0); } public static int convertToDIP(Context context, int pixels) {    return Math.round(pixels * context.getResources().getDisplayMetrics()      .density);    // DIP  } public static String getDeviceName() { String manufacturer = Build.MANUFACTURER; String model = Build.MODEL; if (model.startsWith(manufacturer)) { return capitalize(model); } else { return capitalize(manufacturer) + " " + model; } } private static String capitalize(String s) { if (s == null || s.length() == 0) { return ""; } char first = s.charAt(0); if (Character.isUpperCase(first)) { return s; } else { return Character.toUpperCase(first) + s.s

Changing locale programmatically

private static void setLocale ( String newLocale ) { Locale locale = new Locale ( newLocale ); Locale . setDefault ( locale ); Configuration config = new Configuration (); config . locale = locale ; context . getResources (). updateConfiguration ( config , context . getResources (). getDisplayMetrics () ); }