package com.example.ghomi.chapter6_1;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.content.Intent;
import android.widget.EditText;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
    public void onClickStart(View v){
        EditText sleepTime=(EditText)findViewById(R.id.editText);
        Long secondsToSleep=Long.parseLong(sleepTime.getText().toString());
        Intent intent= new Intent(MainActivity.this,MyIntentService.class);
        intent.putExtra("seconds", secondsToSleep);
        startService(intent);
    }
 }
