Please note that I actually have no plans of posting how to root and upgrade certain devices here in our blog. (But if many of you insists, I may change my mind haha!)

This is because there are already a lots of resources on other sites, especially in the XDA-Developers forum.

In my experience, rooting and flashing a custom ROM to your device may take a lot of trial and error. One blog post may not work for you, so you have to look on other blog post or forums and maybe combine their instructions or installation files for your device to work.

So, this tutorial will just cover some ADB commands that I learned and can be useful when doing such tasks. This list can be your reference too!

1.0 What is ADB?

First off, for those who have no idea what ADB is, ADB stands for Android Debug Bridge. Basically, it is a command line interface that lets you communicate from PC to your Android device or emulator.

On windows, it is an .exe file where you can execute some commands (see section 4.0 below) with the help of command prompt (cmd.exe).

2.0 Where can I get ADB?

I used the ADB from the Android ADT Bundle we installed, yes it is with the Android developmenet environment files. I actually wrote a post regarding its installation. You can find it in the path: YourADT_Folder > sdk > platform-tools > adb.exe

3.0 How To Run The ADB?

Easy, just follow the steps below:

3.1. Open your command prompt.

On windows, you can type on the search box “cmd.exe” and then press enter. It will pop up a really cool black window.

3.2 Find your adb.exe

Go to your ADT folder > sdk > platform-tools

Copy the path, go back to the black window, right click then paste it there. After pasting, press enter. See screenshots below:

4.5 Get file from Android device to your PC by using the “adb pull” command. Sample use:

adb pull /sdcard/my_file.zip c:\my_file.zip

4.6 If you have an APK installer file in your PC, you can also install it using the ADB via “adb install” command. Sample use:

adb install c:\your_app.apk

4.7 – adb reboot command will simply reboot your Android device.

4.8 – adb reboot recovery will reboot your device in recovery mode.

4.8 – adb logcat is useful when you’re making an app and debugging. Eclipse also provide this functionality.

If you think I missed something important that should be on this list, please feel free to leave a comment below, I’m more than willing to udpate this post. Hope this ADB basic commands list help you get started!

I have an Android Action Bar Tutorial for you guys! Android ActionBar looks good on our smartphone apps and at the same time, it is really useful. Aside from displaying your app’s title or section, the ActionBar can also be used as a back function (upper left) or a viewable button or dropdown options (upper right).

This is a step by step guide on how you can create an ActionBar for your awesome Android app. I’ll walk you through the process of creating a very simple but awesome android ActionBar. Let’s get started!

The following Android intents tutorial will help increase your app’s Facebook likes or twitter followers. Almost every app has their own social media accounts or links that you can like, follow, +1, or even send an email to. There’s always an app that can connect you to that product or service.

Now, from that app, a user must be able to view your accounts effortlessly and in a standard, native and beautiful way. Don’t just throw a browser with a link to a social media account, impress your users by opening it in the native app! The most commonly used social media apps are Facebook, Twitter and Google Plus.

Those are covered in this post, but with the additional Browser and GMail intents! For this code’s demo, see our Android Intents video demo below.

By the way, the app on the demo above is this blog’s official browser app. You might want to download it on Google Play. I didn’t have enough time to develop that app due to my busy schedule. But it is working fine, try it out!

2.0 Google Plus Intent in Android

Calling the official Google Plus app to show the Google+ page of your customers would be great. That’s one feature I already worked with and now I’m ready to show you the working code I used.
Here’s how I did it:Step 1: Go to the Google+ Page and copy the page ID. In my case, it is: 101266899643014043497https://plus.google.com/101266899643014043497/posts

How to use the method above? Remember the twitter username you got on step 1 and put code below on your click listener:

openTwitterPage("ninjazhai");

4.0 Browser Intent in Android

This time we are going to take a look at the browser intent filter in android. I used this one when I want my users have the ability to view the subscribe form of this blog. This code basically answers the question “How do I show a web page from my app to a web browser?”
Here’s the working code I used. Just follow this two step guide.Step 1: Of course, prepare the URL you wanted to be shown. In my case, it was:http://feedburner.google.com/fb/a/mailverify?uri=TheCodeOfANinja

5.0 Gmail Intent in Android

You can use this code when you want your users to have the ability to send email from your app, for example is the app feature where the users can send feedback, comments or suggestions directly to any given email address.

This code will open the Gmail App with the help of android intent filter.

// you can try to add more email in this array: new String[] { "ninjazhai30@gmail.com", "email2@yahoo.com" }
// if you're going to send the message to multiple people
openGmailApp(
new String[] { “ninjazhai30@gmail.com” },
“Feedback for The Code of a Ninja Programming Blog”,
“Sent using The Code of a Ninja Android App:nn“
);

6.0 How to Check If An App Is Installed in Android?

Before a specific app will run, we have to verify if that app exists or installed in the device. This will enable us to tell the user that a certain app must be installed before using a feature. This prevents showing an error or force close message, so it is good for the user experience. The method below will show us the way.

Checking if an app is installed in the Android device is required if you are going to start another applications’s intent. There are other ways to do this but the code below is what’s working for me.

I used and tested this code when I wanted to start an intent to some apps like:

Facebook

Twitter

Google Plus

Browser

Gmail

// method to check whether an app exists or not
public void checkIfAppExists(Intent appIntent, String appName){

if (appIntent.resolveActivity(context.getPackageManager()) != null) {

// start the activity if the app exists in the system
startActivity(appIntent);

} else {

// tell the user the app does not exist
Toast.makeText(context, appName + ” app does not exist!”, Toast.LENGTH_LONG).show();
}
}

Sample Usage: Below is the code I used when I want to open my google plus page with the Google+ official android app.

Lately I encountered this annoying android EditText lag, each time I try to type a character, it makes me wait for around 1 to 3 seconds before I can type the next character! Now that’s horrible. EditText is not useful. Keyboard looks broken.

If you have the same issue, I have a good news for you, I found a fix! Now take a look at the code below.

Old Code

This is the XML layout I used for my customized search bar, and it is very laggy.

So what’s the actual solution? Avoid using EditText inside a RelativeLayout, use LinearLayout instead. According to James, If you look at the DDMS, a lot of redraws and recalculations occur while entering the text which is related to the RelativeLayout. So that gives us a clue the the problem is indeed the RelativeLayoutUpdate: I forgot to mention that setting a fixed with of an EditText will help a lot with the performance. It prevents re-calculation and re-drawing of layout. Thanks to Giorgos Kylafas for pointing it out in the comments section below! He also included links that can be useful for you when it comes to Android performance tips so I suggest reading his comment.

Did you have the same experience? If this solution did not work for you and you found your own solution, please share it in the comments section below, I’m willing to include your story and update this post!

Recently I was working with the Facebook SDK for Android and found the error: Android Dependencies – Missing facebooksdk.jar. My project was unable to run and the eclipse console or logcat does not give a clear description of the error.

But it can be seen when you try to view the properties > java build path > libraries tab > android dependencies of your project.
It looks like the project is looking for the facebooksdk.jar in the Facebook SDK bin folder. But it was missing. I wasn’t able to found a fix after around 30 minutes of googling the error. I don’t know, maybe my google skills are just failing me.
But the good thing is I was able to fixed this error myself. And here is the solution:

Wait for a while while eclipse re-builds the workspace. Suddenly it was fixed!
Sorry I was too lazy to put up some screenshots, this is just a quick post that I thought can be useful to some devs. As always, thanks for reading!

In relation to that, I was inspired again to make a post about android ListView with Adapter, but this one is much more simple than the previous post: How To Customize Android ListView?

Today I’m going to show you the code I use whenever I wanted the user to select an “item” in an AlertDialog with ListView. If you are looking for an example AlertDialog with simple ListView (without an adapter), here’s a blog post I made: Android AlertDialog with ListView.

A ListView item here contains a text (item name) and an ID (item ID), so whenever the user selects an item in the pop up, you’ll be able to get the text and ID of that selected item.
This is very useful if the items are from a database – records with IDs and names. The tags (item IDs) were set using the TextView’s setTag() method.

Video Demo

Here’s the final output of our code for today. Name and ID were fetched and show via toast.

Joda Time is another very useful library for your Android application development. It provides a quality library of classes to replace the Java JDK Date and Time classes.

This post is generally about how to import a library in eclipse for Android development, we just choose Joda Time library as a good example. Every time I have a post instructing to install a library, I’ll probably link into this post.

https://www.codeofaninja.com/wp-content/uploads/2016/06/codeofaninja-logo-100x100-op-80x80.png00Mike Dalisayhttps://www.codeofaninja.com/wp-content/uploads/2016/06/codeofaninja-logo-100x100-op-80x80.pngMike Dalisay2013-08-30 15:26:002016-11-22 09:24:30How to Use Joda Time in Eclipse?