Main course [Bagian 4]

Continuing the previous discussion, this time the author explains how to create the main menu in the GIS application that we are going to create. If you are just starting to read this article, you can follow the first part at the link below:

Also read:

The following is a script that you will need to enter res> layout> content_main.xml :


to Tools: context They adapt to your project, then for image what do you have to put in drawable you can wear it shortcut including:

Download Drawables Part 4

Here is the script on to be added to the call image through the use library Picasso. Here is the explanation library Picasso:

picasso is a library for cached pictures on Android. This library is created and maintained by Square and is used for loading and processing images. This library makes it easy to view images from external locations. In most cases, it only takes a few lines of code to implement this library.

The advantage of Picasso lies in the display of images from the Internet. This library handles every phase of the process, from HTTP requests to caching the image files. Implementing it yourself (without libraries) is a long job. In this quick tip, we’ll see how it is used in some common cases.

To add the Picasso library to the project. open minded Gradle script> Build.gradle (Module: app) then add in

Dependencies {

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


Then restart Gradle by selecting “Try Again”. Wait for the gradle process to 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 necessary because the application uses an internet connection for both data analysis and data processing image like Picasso. Add to permission Off day

Here is the view exit from Main course that was made.

To beautify the application, of course symbol the application that is displayed on Home page Smartphone Of course it has to be interesting. Here are the steps to replace it symbol Use :

open minded res> minmap> ic_launcher This is the application’s default icon. You can override it so you don’t have to change the name again in the manifest by right-clicking Minmap and then selecting New> Image Asset

Change Asset type Will image, then search path image symbol on your pc. You don’t need to change the name, just leave ic_launcher Next> quit. Next, run the application.

Leave a Reply

Your email address will not be published.