well you can do one thing I've created an another class
Home.java
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
public class Home extends Activity{
static int n = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.home);
Button go = (Button)findViewById(R.id.button1);
go.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
EditText sec = (EditText)findViewById(R.id.editText1);
n = Integer.parseInt(sec.getText().toString());
Intent go = new Intent("com.nerdwin15.demo.alarmdemo.AlarmMainActivity");
startActivity(go);
}
});
}
}
AlarmMainActivity.java
public class AlarmMainActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.main);
//Create an offset from the current time in which the alarm will go off.
Calendar cal = Calendar.getInstance();
cal.add(Calendar.SECOND, Home.n);
//Create a new PendingIntent and add it to the AlarmManager
Intent intent = new Intent(this, AlarmReceiverActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(this,
12345, intent, PendingIntent.FLAG_CANCEL_CURRENT);
AlarmManager am =
(AlarmManager)getSystemService(Activity.ALARM_SERVICE);
am.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(),
pendingIntent);
}
}
Now you enter your time in home class and it go to another one . make sure to change your LAUNCHER in manifest it should be Home.java