Skip to content Skip to sidebar Skip to footer

Tutorial on Creating Mobile GIS Applications Using Android Studio: Main Menu [Bagian 4]

Continuing from the previous discussion, this time the author will explain the creation of the Main Menu in the GIS application that we will make. If you are just starting to read this article, you can follow from the first part at the link below:

Read also:

The following is a script that you must enter on res > layout > content_main.xml :


For tools:context you adapt to your project, then for image what you have to put in drawable you can get it on link below this :

Download Drawables Part 4

Here is the script on to be added to call image by using library Picasso. Here is the explanation library Picasso :

Picasso is a library for cached images on Android. This library was created and maintained by Square, and serve image loading and processing. This library simplifies the process of displaying images from external locations. In most cases, it only takes a few lines of code to implement this library.

Picasso’s advantage is when it is used to display images from the internet. This library handles every stage of the process, from HTTP requests to caching the image files. To implement it yourself (without libraries) is a long job. In this short tip we’ll see how it’s used in some common cases.

To add the picasso library to the project. open Gradle Script > Build.gradle (Module:app) then add inside

dependencies {

compile 'com.squareup.picasso:picasso:2.3.2'


Then restart Gradle by selecting, Try Again. Wait until the gradle process is complete and add the script for as shown below:

 protected void onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        setContentView(R.layout.activity_main);        Toolbar toolbar = (Toolbar) findViewById(;        setSupportActionBar(toolbar);        DrawerLayout drawer = (DrawerLayout) findViewById(;        ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(                this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);        drawer.setDrawerListener(toggle);        toggle.syncState();        NavigationView navigationView = (NavigationView) findViewById(;        navigationView.setNavigationItemSelectedListener(this);        ImageView ImageMenuUtama = (ImageView) findViewById(;        Picasso.with(this).load( "")                .placeholder(R.drawable.placeholder)                .fit()                .error(R.drawable.error)                .into(ImageMenuUtama);    }

If so, then go to AndroidManifest.xml then add a permission to access the Internet. permission This is needed because the application will use an internet connection for both data parsing and data processing image like Picasso. Add permission off tag

Here is the view output from Main course which has been made.

To beautify the application, of course icon of the application that will be visible on homepage smartphone Of course it must be interesting. Here are the steps to replace icon application :

open res > minmap > ic_launcher this is the default icon of the application, you can override it so you don’t need to change the name again in the Manifest by right-clicking on minmap, then selecting New > Image Asset

Change Asset Type Becomes Imagethen search path picture icon on your PC. No need to change the name, just let ic_launcher then next > finish. Next run the application.