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. ...

Get Learning Mobile App Development: A Hands-on Guide to Building Apps with iOS and Android now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.