package com.hyperling.carbupbeta; import android.content.Intent; import android.content.res.Resources; import android.os.Build; import android.os.Bundle; import android.app.Activity; import android.support.v7.app.AppCompatActivity; import android.view.Menu; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.Toast; public class Home extends AppCompatActivity { Resources recs; Button btnCarbCalc, btnCalcHelp, btnWhyHCLF, btnWhyVegan; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home); //////////////////////////////////////////////////////////////////////////////////////////// // Set up variables recs = getResources(); //////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////// // Set up views btnCarbCalc = (Button) findViewById(R.id.btnCarbCalc); btnCalcHelp = (Button) findViewById(R.id.btnCalcHelp); btnWhyHCLF = (Button) findViewById(R.id.btnWhyHCLF); btnWhyVegan = (Button) findViewById(R.id.btnWhyVegan); //////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////// // Set up button click listeners btnCarbCalc.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startActivity(new Intent(Home.this, Main.class)); } }); btnCalcHelp = (Button) findViewById(R.id.btnCalcHelp); btnWhyHCLF = (Button) findViewById(R.id.btnWhyHCLF); btnWhyVegan = (Button) findViewById(R.id.btnWhyVegan); //////////////////////////////////////////////////////////////////////////////////////////// } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_home, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_exit) { finish(); return false; } return super.onOptionsItemSelected(item); } }