O'Reilly logo

Learning Mobile App Development: A Hands-on Guide to Building Apps with iOS and Android by Michael Eierman, Jakob Iversen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Code the Navigation Bar

Movement and data transfer between activities is done with Intents as discussed earlier in this chapter. The use of Intents makes coding navigation relatively simple. The Intent does most of the work. Open the ContactActivity.java file in the src folder by double-clicking it. Begin by coding the List ImageButton. Enter the code in Listing 4.8 before the last } in the ContactActivity.java file.

Listing 4.8 List Button Code

private void initListButton() {  ImageButton list = (ImageButton) findViewById(R.id.imageButtonList);            //1  list.setOnClickListener(new View.OnClickListener() {                            //2    public void onClick(View v) {      Intent intent = new Intent(ContactActivity. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required