Rename package in Android Studio

In Android Studio, you can do this: For example, if you want to change com.example.app to my.awesome.game, then: In your Project pane, click on the little gear icon (  ) Uncheck the Compact Empty Middle Packages option Your package directory will now be broken up into individual directories Individually select each directory you want to rename, and: Right-click it Select Refactor Click on Rename … Read more

Android Studio SDK location

Download the SDK from here: http://developer.android.com/sdk/ to C:\android-sdk\. Then when you launch Android Studio again, it will prompt you for the SDK path just point it to: C:\android-sdk\. Update: new download location, https://developer.android.com/studio/#command-tools

Cannot resolve symbol ‘context’

You need to do some basic Java programming tutorials. Java is totally different to JavaScript. Here, you use context as a variable but you have neither declared it, or initialised it, hence the error. You could define it (and initialise at the same time) since this refers to the current object instance of a class and Activity is a Context, or more … Read more

Custom Adapter for List View

This is a class I had used for my project. You need to have a collection of your items which you want to display, in my case it’s <Item>. You need to override View getView(int position, View convertView, ViewGroup parent) method. R.layout.itemlistrow defines the row of the ListView. In the MainActivity define ListViewlike this,

Android Studio SDK location

Download the SDK from here: http://developer.android.com/sdk/ to C:\android-sdk\. Then when you launch Android Studio again, it will prompt you for the SDK path just point it to: C:\android-sdk\. Update: new download location, https://developer.android.com/studio/#command-tools

“ArrayAdapter requires the resource ID to be a TextView” XML problems

The ArrayAdapter requires the resource ID to be a TextView XML exception means you don’t supply what the ArrayAdapter expects. When you use this constructor: R.Layout.a_layout_file must be the id of a xml layout file containing only a TextView(the TextView can’t be wrapped by another layout, like a LinearLayout, RelativeLayout etc!), something like this: If you want your list row layout to be something a little different … Read more

How to resolve the “ADB server didn’t ACK” error?

Try the following: Close Eclipse. Restart your phone. End adb.exe process in Task Manager (Windows). In Mac, force close in Activity Monitor. Issue kill and start command in \platform-tools\ C:\sdk\platform-tools>adb kill-server C:\sdk\platform-tools>adb start-server If it says something like ‘started successfully’, you are good.