• 5,606,729
  • 37,336

Posts Tagged: Java


Unlike most other mobile OSes, Android allows users to modify its source code to make the most of it. This is accomplished by editing code from the AOSP or AOSP-derived projects before compiling. However, not all of us build our own ROMs from source. Thus, there’s the world of decompiling and Smali editing.

Here on XDA, developers create amazing things. One new and exciting project allows users to create external controls for SystemUI.APK. The project comes in the form of a guide written by XDA Recognized Developer and Themer serarj, and it allows users to change the look of the status bar and other UI elements on the fly. But rather than simply providing completed applications that accomplish this goal, Serarj decided to share his knowledge and show others how to do this themselves in Eclipse.

If you are a ROM chef and want to add something interesting to your work, or if you simply wish to use it in your own personal builds, your way to the guide thread to get started.



Java is a programming language that is used to code software for many devices, including Android. It’s criticized by many, but Java is still widely used, mostly because its ability to run properly across many OSes as Windows, Linux, and Mac OS. Quite a few tools available on XDA are written in Java, including the Sony-specific Flashtool application, CASUAL, and so on.

Here at XDA, we’ve already presented a couple of applications, guides, and tutorials for Java. You may have already noticed that Java uses classes to handle various tasks. One such class, FileFilter, was recently presented in the form of a picture guide by XDA Senior Member Beatsleigher. The guide shows you how to write a custom class from scratch, so it’s pretty nice for all beginning programmers to understand the language better.

FileFilter can be used to display only a given file extension in an open window. So for example, a user can select .apk or .mp3 files only, and the rest won’t be visible. If you are working on your first Java project and it opens different file types, this guide will probably be very helpful.

You can find all needed resources in the guide thread.


Odin and Heimdall were pretty badass gods in the Nordic mythology. But to Samsung device owners, these are important and powerful tools designed to flash stock ROM files, much like Flashtool on Sony phones. In short, they are an essential part of Samsung Android development here at XDA.

Many times in the past, we’ve talked about XDA Senior Recognized Developer AdamOutler‘s CASUAL, otherwise known as Cross-platform Android Scripting Unified Auxiliary Loader.  The cross-platform Java-based tool allows you to perform many cool tasks like rooting, flashing stock ROMs. and so on.

The project is now on a different level, as Adam has presented JOdin3, a web browser-based and offline flashing tool. With JOdin3, you are able to flash stock Samsung firmware directly from your browser. The project is a collaboration of between Adam and XDA Senior Developers Benjamin Dobell and Ralekdev, and XDA Senior Members Loglud and jrloper.

You need to have Java installed on your PC in order to use JOdin3. Heimdall is also required, but it will be automatically downloaded and installed. As it’s a cross-platform tool, it works flawlessly on Windows, Mac, and Linux.

More information regarding this project can be found in the original thread. You can read more about CASUAL on the official website of the project.

[Thanks to XDA Recognized Contributor benkxda for the tip!]


Android is meant to be open source. And most components, despite being covered by the Apache license, have publicly available source code. Unfortunately, the sad truth is that only Nexus devices owners can do Java modifications without digging into Smali assembler language, which is not simple and needs much more effort than Java. Also, decompiled applications can’t be imported to Eclipse or Android Studio.

There are some tools like GetJava that already can do the job, but in most situations the result isn’t 100% accurate and some files still need to be translated to Java. XDA Senior Member darkguy2008 decided to start a project aimed to provide a better solution than JAD or JD-GUI.

The project is still at a very early stage, but most things are working already. This project is written in C# and needs Visual Studio 2012 and .NET Framework 4.5 installed to work properly. Hopefully in the future, it will be possible to use it on other operating systems like Linux or Mac OS X. Undoubtedly, this project has terrific potential and with help of other developers, the Android development can be significantly improved.

More information regarding this converter can be found in the original thread, so don’t hesitate to go there and give some input to the developer. Of course, you can also contribute by pushing some patches to the Github repository.

Bear in mind that tools like this should not be used to get some freebies from paid apps and re-release it under your name. Developers sell their work for a reason, so you should use it only for educational purposes.


Many of us would love to become famous programmers like XDA’s Senior Recognized Developers. But coding isn’t easy, and you need to know the basics and have a working knowledge of whatever language you choose before even getting started. And of course, writing a simple “Hello world!” app is not enough, as you will have to look deeper to create more complicated functions.

If you are looking a good place to begin, you should take a look at the guide written by XDA Senior Member Dark Wraith, who gathered some useful information together and wrote a handy guide with commands for many popular languages like C, C++, Java, Python, and BASH.

With the instructions provided in the thread and added acquired knowledge, you will be able to understand the structure of each language better and hopefully create your first application or modify your favorite ROM. With this guide, you will be also able to edit the overclocking settings and governors of kernels, which is a good practice for the C language.

Dreams sometimes come true, so if you want to start your developer career, make your way to the guide thread and hone your coding skills. We all want to wish you good luck!


Android is an operating system that uses a lot of programming languages. The most common languages are Java (or Android Java if you prefer), C, XML, Bash, as well as a few more. Android applications can be decompiled by APKTool and a few similar tools, and their output is Smali. I know that many of you will disagree with me, but Smali is quite complicated language—much more than Java.

There are two tools that can convert Smali back to Java: Dex2Jar and JAD. They are pretty hard to use, though, and need some experience to use them properly. Luckily, XDA Recognized Developer broodplank1337 created a simple bash script, that does all the work for us. This script can get all necessary dependencies, as well as get the Java code straight from APK. It works on Linux only, but I’m quite sure that can be used on non UNIX-like systems like Windows with Cygwin. The developer recommends that you put the file in ~/bin and make it executable. Further instructions are available in the thread.

Sometimes scripts can make life a lot easier. If you are interested in the project, make your way to the original thread to get more information and learn how to convert assembler code into Java.

Note: Tools like this should be used for educational purposes. “Borrowing” code from applications (paid or free) is unethical and should not take place. They are closed source for a reason. Keep that in mind.


About a year ago, we covered a tool by XDA Recognized Developer lyriquidperfection that allows users to create, modify, and analyze Samsung PIT (Partition Information Tables ) files. For those who aren’t familiar with PIT files, they contain all of the relevant information for each partition such as partition id, partition name, flash filename, block size, block range, partition description, and more.

Some time ago, XDA Recognized Developer Benjamin Dobell created a Java-based library for Samsung PIT files, as part of the Heimdall project. Then to further development, Benjamin relinquished copyright over to XDA Senior Recognized Developer AdamOutler, who relicensed the project under GPL, with source available over on GitHub.

Now, Adam has released an online PIT analysis tool and associated library that allows you to obtain a human-readable analysis of a PIT file easily, either through his online web-app, or directly on your local computer with a provided library. What makes Adam’s tool unique is that thanks to work by Adam, Recognized Developer Ralekdev, and Senior Recognized Developer Rebellos, the tool can identify every part of the PIT file. As stated by Adam:

I’m happy to announce that we have 100% identification of all parts of the PIT files as they stand today. We are no longer working on identifying variables thanks to Ralekdev, Rebellos and Benjamin’s work. We can read, and write and integrate PIT files into our Java Applications.

Make your way over to the original thread to learn more!


We’ve talked quite a bit about the Google Chromecast in the past few weeks. Ever since it was launched a little under a month ago, the little $35 media streamer has lived an exciting life. From gaining root to losing root and from alternate receivers to alternate content providers, there have certainly been more than a few twists and turns. We were even recently shown how to enable ADB on the device, so long as you were one of the lucky few to have obtained and kept root access before the root-killing OTA.

Now, there’s a new application by developer Leon Nicholls called Fling that runs on your desktop computer and sends many formats of local content to your Chromecast device. Fling is a Java application, which means that it will run on any computer that has JRE and the latest version of VLC (preferably 64-bit) installed. The app lists support for various media types (wmv, avi, mkv, mpg, mpeg, flv, 3gp, and ogm), with various transcoding parameters available within the configuration menu. The host computer’s instance of VLC is then used for the transcoding process.

Unfortunately for those who don’t yet have a physical Chromecast device, this seems to only work on hardware Chromecast devices rather than Android devices that have CheapCast installed. However, those who already have a device (yours truly just ordered his second a few hours ago) are in for a treat.

Best of all, Leon has made it open source, with all the relevant code available on Github. Head over to Leon Nicholls’s Google+ post to learn more. There, you’ll find links to the source code, which is available on his Github, as well as a download link for Fling itself. Be sure to leave your comments for the developer, as this tool just made Chromecast quite a bit better for quite a few people.


It’s fair to say that unless you’ve spent some time digging around inside APK files and making some heavy duty modifications to apps or the Android OS itself, you probably haven’t come face-to-face with a .smali file in its natural environment. They are a common component in many of the most popular Android tweaks and hacks out there such as adding toggles, extending the power menu, and adding CRT screen off animation.

The files themselves can often be found nestled inside APKs and become available for modification once that particular file is decompiled with a utility such as APKTool. Unfortunately, these smali files sometimes have a tendency to squirrel themselves away inside the classes.dex of a JAR file and make themselves a little more awkward and time consuming to reach and manipulate. Following on from his recent guide to ADB commands, XDA Senior Member iamareebjamal has put together a one-click tool that will allow you to decompile the classes.dex from any APK or JAR file with ease.

Simply place the relevant file in the input folder, decompile, make any necessary changes to the newly available files, recompile, and check the output folder for your modified version. It’s as simple as that. Obviously there are a few prerequisites to this, namely some kind of personal computing device running Windows, Java (ideally in software and liquid form), the relevant files and tools (notepad++, an archive manager etc), and some idea of what you’d actually like to achieve as the end result. If you have all of those at your disposal, this could prove to be a great little time saver and well worth a visit to the original thread.


Recently, XDA Developer TV has been talking about becoming a Hacker. What we mean by hacker is not the basement dwelling anarchist types, we mean the expert coding kinds. We talked about how to become a hacker, and last week we talked about ranking hacker schools. This week, we are talking about how to get accepted into a hacker school.

In this episode, XDA Developer TV Producer Jayce interviews developers and people from the hacking school world to answer these questions. Interviews include Co-Founder of Mobile Makers Don Bora and Co-Founder at Hack Reactor Douglas Calhoun. Check out this video!



Last week, XDA Developer TV Producer Jayce interviewed Co-Founder of App Academy Kush Patel and Co-Founder of Mobile Makers Don Bora to talk about intense learning curriculum known as Hacker School. There were quite a few questions about what and where you could find such schools.

In this episode, Jayce names a few schools and talks about what they cover. Programming languages from Ruby on Rails to Java are covered. Jayce gives some advice on how to find out if the school is any good and what one might expect to pay for these schools. Check out this video!



Everyone has experienced the desire to program at one point or another. However, there are generally four limiting factors: Time Constraints, Study Material, Mental Blocks, and Attention Span. So clear your schedule, clear your mind, and self-medicate your ADD with a nice cup of your favorite coffee because here’s the material you need to learn how to program.

The hardest part of learning to program is overcoming a mental block. First, there is no programming deity out there who grants code-literacy to anyone. Learning to code is the same as learning any language—there are nouns, verbs, and sentences that come together in a certain way in order to make sense to the computer. Once you’ve written down a complete thought, the program works properly.

Second, even Java experts with PhDs in computer science think of Java as having huge black-boxes with inputs and outputs. Just as with any language, the higher your expertise means the more obscure language structures you can use. Anyone can learn basic language structures though.

The third mental block is to get motivated and “Just do it.” The tools are free.  The resources are available. Anyone who wants to write a program can do it and publish their work.  So you need to just jump right into your IDE and start making something.

Tools: How to Build an Android App Part 1: Setting up Eclipse and the Android SDKSetting up Eclipse and the Android SDK will give you the basic tools you need to get started making an Android app.  As with any project, you should start by gathering up your tools and learning to use them first.

Skills: “The Java Tutorials”The Java Tutorials is essentially an http E-Book that is laid out in the same format as many certifications and online courses. Many people have stated that they want to “Sit-down and learn Java.”  The Java Tutorials are a great way to do precisely this. This is tailored to writing generic Java applications, and not specifically Android’s implementation of Java. Learning this material will give you a strong knowledge base for programming Java applications.

Materials: Android “Package Index”The Android Package Index is a reference for all of the Packages, Classes, and APIs provided by Google.  Once you learn how to program in Java, you need to learn about the individual building blocks of an application. Each of these packages function as the nouns and verbs in your writing. The documentation show the appropriate time and place to use these words as well as what you get out of them. This package index serves as your dictionary.

Architecture: “Android Design”The Android Design page is a great launchpad for ideas in your Android application. This page is examples of what Google would like to see.  Each page shows design implementations recommended by Google.

The Human Aspect: Our Android hacking forum is the perfect place to ask questions, get answers, and see the works of other developers.

So, we’ve covered all the basics needed to get started creating your own Android applications. There are almost infinite resources available on the Internet. Please share your favourite resources below.


XDA TV: Most Recent Video

Buy/Sell on Swappa