package com.eni.android.navigation;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class Ch7_ParcelableExempleActivity extends Activity {

	private final String EXTRA_USER = "user";

	private EditText login;
	private EditText password;
	private Button connection;

	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        login = (EditText) findViewById(R.id.login);
        password = (EditText) findViewById(R.id.pass);
        connection = (Button) findViewById(R.id.connect);
        connection.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				Intent intent = new Intent(Ch7_ParcelableExempleActivity.this, ConnectedActivity.class);
				User user = new User(login.getText().toString(), password.getText().toString());
				intent.putExtra(EXTRA_USER, user);
				startActivity(intent);
			}
		});
    }
}