Guest User

cannot resolve symbol 'FloatingActionButton'

a guest
Jun 22nd, 2018
299
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.53 KB | None | 0 0
  1. /*
  2.  * Copyright (C) 2016 The Android Open Source Project
  3.  *
  4.  * Licensed under the Apache License, Version 2.0 (the "License");
  5.  * you may not use this file except in compliance with the License.
  6.  * You may obtain a copy of the License at
  7.  *
  8.  *      http://www.apache.org/licenses/LICENSE-2.0
  9.  *
  10.  * Unless required by applicable law or agreed to in writing, software
  11.  * distributed under the License is distributed on an "AS IS" BASIS,
  12.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13.  * See the License for the specific language governing permissions and
  14.  * limitations under the License.
  15.  */
  16. package com.example.android.pets;
  17.  
  18. import android.content.Intent;
  19. import android.os.Bundle;
  20. import android.support.design.widget.FloatingActionButton;
  21. import android.support.v7.app.AppCompatActivity;
  22. import android.view.Menu;
  23. import android.view.MenuItem;
  24. import android.view.View;
  25.  
  26. /**
  27.  * Displays list of pets that were entered and stored in the app.
  28.  */
  29. public class CatalogActivity extends AppCompatActivity {
  30.  
  31.     @Override
  32.     protected void onCreate(Bundle savedInstanceState) {
  33.         super.onCreate(savedInstanceState);
  34.         setContentView(R.layout.activity_catalog);
  35.  
  36.         // Setup FAB to open EditorActivity
  37.         FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
  38.         fab.setOnClickListener(new View.OnClickListener() {
  39.             @Override
  40.             public void onClick(View view) {
  41.                 Intent intent = new Intent(CatalogActivity.this, EditorActivity.class);
  42.                 startActivity(intent);
  43.             }
  44.         });
  45.     }
  46.  
  47.     @Override
  48.     public boolean onCreateOptionsMenu(Menu menu) {
  49.         // Inflate the menu options from the res/menu/menu_catalog.xml file.
  50.         // This adds menu items to the app bar.
  51.         getMenuInflater().inflate(R.menu.menu_catalog, menu);
  52.         return true;
  53.     }
  54.  
  55.     @Override
  56.     public boolean onOptionsItemSelected(MenuItem item) {
  57.         // User clicked on a menu option in the app bar overflow menu
  58.         switch (item.getItemId()) {
  59.             // Respond to a click on the "Insert dummy data" menu option
  60.             case R.id.action_insert_dummy_data:
  61.                 // Do nothing for now
  62.                 return true;
  63.             // Respond to a click on the "Delete all entries" menu option
  64.             case R.id.action_delete_all_entries:
  65.                 // Do nothing for now
  66.                 return true;
  67.         }
  68.         return super.onOptionsItemSelected(item);
  69.     }
  70. }
Add Comment
Please, Sign In to add comment