package com.eni.android.bloquearuithreadejemplo;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class BloquearUiThreadActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_bloquear_ui_thread);
		
        final Button blockUiThread = (Button) findViewById(R.id.blockUiThreadBtn);
        blockUiThread.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				try {
					Thread.sleep(15000L);
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
			}
		});
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.bloquear_ui_thread, menu);
		return true;
	}

}
