title: Saving an EditText into an Array (different activity)
body: <p>Thanks for taking the time of reading my post.</p>
  
  <p>How would i be able to have the value of an email in an EditText (emailEditText) to be saved from Create.java into this array in the activity AlarmService?</p>
  
  <p>Where it says <code>String[] toArr =</code> </p>
  
  <p>Is there anyone that is able to provide a solution or give any suggestions? I have tried multiple times without success.</p>
  
  <p>Any help would be greatly appreciated! :)</p>
  
  <p><strong>AlarmService.java</strong></p>
  
  <pre><code>package com.example.pc.achieve;
  
  import android.app.IntentService;
  import android.app.NotificationManager;
  import android.app.PendingIntent;
  import android.content.Context;
  import android.content.Intent;
  import android.content.SharedPreferences;
  import android.os.PowerManager;
  import android.preference.PreferenceManager;
  import android.support.v4.app.NotificationCompat;
  import android.util.Log;
  import android.widget.Toast;
  
  import static android.graphics.Color.GREEN;
  
  public class AlarmService extends IntentService {
  
  SharedPreferences pref;
  
  PowerManager powerManager;
  PowerManager.WakeLock wakeLock;
  
  public AlarmService() {
      super("");
  }
  
  @Override
  protected void onHandleIntent(Intent intent) {
      powerManager = (PowerManager) getSystemService(POWER_SERVICE);
      wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "FCFCFCFC");
  
      SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this);
  
      addNotification();
      sendMAIL();
  
  }
  
  public void addNotification() {
      NotificationCompat.Builder builder =
              new NotificationCompat.Builder(getApplicationContext())
                      .setSmallIcon(R.drawable.icon_transperent)
                      .setLights(GREEN, 700, 700)
                      .setContentTitle("Alert!")
                      .setContentText("This is a reminder");
  
      Intent notificationIntent = new Intent(getApplicationContext(), MainMenu.class);
      PendingIntent contentIntent = PendingIntent.getActivity(getApplicationContext(), 0,     notificationIntent,
              PendingIntent.FLAG_UPDATE_CURRENT);
      builder.setContentIntent(contentIntent);
  
      // Add as notification
      NotificationManager manager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
      builder.setVibrate(new long[] { 0, 1000, 1000, 1000, 1000 });
      manager.notify(0, builder.build());
  }
  
  public void sendMAIL(){
  
      String getEmail = pref.getString("email", "");
      String[] toArr = {getEmail};
      m.setTo(toArr);
      m.setFrom("notification@gmail.com");
      m.setSubject("Alert!");
      m.setBody("This is a reminder.");
  
      try {
          if(m.send()) {
          } else {
          }
      } catch (Exception e) {
          e.printStackTrace();
      }
  }
  
  
  @Override
  public void onDestroy() {
      super.onDestroy();
  }
  }
  </code></pre>
  
  <p><strong>Create.java</strong></p>
  
  <pre><code>package com.example.pc.achieve;
  
  import android.app.Activity;
  import android.content.DialogInterface;
  import android.content.Intent;
  import android.content.SharedPreferences;
  import android.os.Bundle;
  import android.preference.PreferenceManager;
  import android.support.v7.app.AlertDialog;
  import android.view.View;
  import android.widget.EditText;
  
  public class Create extends Activity {
  
  SharedPreferences pref;
  
  private EditText subjectEditText;
  private EditText descEditText;
  EditText emailEditText;
  
  private DBManager dbManager;
  
      @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_create);
  
          SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this);
  
          subjectEditText = (EditText) findViewById(R.id.subject_edittext);
          descEditText = (EditText) findViewById(R.id.description_edittext);
          emailEditText = (EditText) findViewById(R.id.email_edittext);
  }
  
  public void btnCreate(View view) {
  
      String email = emailEditText.getText().toString();
      pref.edit().putString("email", email).apply();
  
      dbManager = new DBManager(this);
      dbManager.open();
  
      final String name = subjectEditText.getText().toString();
      final String desc = descEditText.getText().toString();
  
      dbManager.insert(name, desc);
  
      AlertDialog.Builder builder = new AlertDialog.Builder(this);
      builder.setMessage("Your deadline has now been created.")
              .setCancelable(false)
              .setPositiveButton("OK", new DialogInterface.OnClickListener() {
                  public void onClick(DialogInterface dialog, int id) {
                      finish();
                  }
              });
      AlertDialog alert = builder.create();
      alert.show();
  }
  
  
  public void btnSetAlarm(View view) {
  
      startActivity(new Intent(Create.this, Alarm.class));
  }
  }
  </code></pre>