Android Open Source - 301Assignment1 Settings Activity






From Project

Back to project page 301Assignment1.

License

The source code is released under:

Apache License

If you think the Android project 301Assignment1 listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.ckchan.assignment1.ckchan_todolist;
/*from   ww w .j  ava  2 s.  co  m*/
import org.json.JSONException;

import com.ckchan.assignment1.ckchan_notes.R;
import com.ckchan.assignment1.ckchan_todolist.Email;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

//Sets email address to where emails will be sent to
public class SettingsActivity extends Activity {
  
  Context context;
  EditText editText;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_settings);
    
    context = getApplicationContext();
    
    editText = (EditText) findViewById(R.id.editText1);
    Button  button = (Button) findViewById(R.id.button1);
    
    button.setOnClickListener(new View.OnClickListener() {
      
      @Override
      public void onClick(View v) {
        
        TaskDatabase taskDatabase = new TaskDatabase();  
        Email email = new Email();      
        email.setAddress(editText.getText().toString());
        try {
          
          taskDatabase.saveEmailAddress(context, email);
        } catch (JSONException e) {
          
          // TODO Auto-generated catch block
          e.printStackTrace();
        }
      }
    });  
  }
}




Java Source Code List

com.ckchan.assignment1.adapter.TabsPagerAdapter.java
com.ckchan.assignment1.adapter.TaskArrayAdapter.java
com.ckchan.assignment1.ckchan_todolist.ArchiveFragment.java
com.ckchan.assignment1.ckchan_todolist.DatabaseInterface.java
com.ckchan.assignment1.ckchan_todolist.Email.java
com.ckchan.assignment1.ckchan_todolist.MainActivity.java
com.ckchan.assignment1.ckchan_todolist.SettingsActivity.java
com.ckchan.assignment1.ckchan_todolist.SummaryInfoActivity.java
com.ckchan.assignment1.ckchan_todolist.TaskDatabase.java
com.ckchan.assignment1.ckchan_todolist.TaskFragmentInterface.java
com.ckchan.assignment1.ckchan_todolist.TodoFragment.java
com.ckchan.assignment1.ckchan_todolist.TodoTask.java