package com.example.karthika.connect;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;

public class welcomeboth extends AppCompatActivity {
    private Toolbar toolbar;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_welcomeboth);
        toolbar = (Toolbar) findViewById(R.id.tool_bar);
        setSupportActionBar(toolbar);
        Constants.addToActivityStack(this);

    }

    @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_welcomeboth, 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();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_logout) {
            Constants.killAllExcept(null);
            //finish();
        }

        return super.onOptionsItemSelected(item);
    }

    public void both(View v) {
        if (v.getId() == R.id.seeker) {
            Intent intent = new Intent(this, welcome.class);
            startActivity(intent);
        }
        else if (v.getId() == R.id.volunteer) {
            Intent intent = new Intent(this, welcome_volunteer.class);
            startActivity(intent);

        }

    }
}


Create welcomeboth.java