Android Open Source - Attendance-AutoCounter Email Absentee Activity






From Project

Back to project page Attendance-AutoCounter.

License

The source code is released under:

GNU General Public License

If you think the Android project Attendance-AutoCounter 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.etonn.attendance_autocounter;
//from  www.  jav a2  s. co  m
import android.content.Intent;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;

import com.etonn.attendance_autocounter.db.DBManager;
import com.etonn.attendance_autocounter.db.Student;

import java.util.ArrayList;

/**
 * Created by Zeshi on 11/23/14.
 */
public class EmailAbsenteeActivity extends ActionBarActivity {

    DBManager db;
    ArrayList<Student> absenteesList;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_email_absentee);

        db = new DBManager(this);
        //todo assuming absentees are all students because didn't implement necessary activity
        absenteesList = db.getAllStudentsList();

        Intent intent = new Intent(Intent.ACTION_SEND);
        String[] tos = new String[absenteesList.size()];

        int i = 0;
        for(Student absentee : absenteesList){
            tos[i] = absentee.getName().replace(" ", "_")+"@student.uml.edu";
            i++;
        }

        intent.setType("message/rfc822");
        intent.putExtra(Intent.EXTRA_EMAIL, tos);
        intent.putExtra(Intent.EXTRA_SUBJECT,"You were absent for Android course");
        intent.putExtra(Intent.EXTRA_TEXT,
                "Dear student," +
                        "\n\nYou were absent for last android class, be careful." +
                        "\n\nBut if you already informed me before, and I approved it, please ignore this email." +
                        "\n\nRegards,\nYour Professor.");
        startActivity(Intent.createChooser(intent,"Your Client"));
    }


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

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }
}




Java Source Code List

com.etonn.attendance_autocounter.ApplicationTest.java
com.etonn.attendance_autocounter.ClassActivity.java
com.etonn.attendance_autocounter.CourseModifyDialog.java
com.etonn.attendance_autocounter.EmailAbsenteeActivity.java
com.etonn.attendance_autocounter.MainActivity.java
com.etonn.attendance_autocounter.ReportActivity.java
com.etonn.attendance_autocounter.ScanningActivity.java
com.etonn.attendance_autocounter.bluetooth.BluetoothHelper.java
com.etonn.attendance_autocounter.db.Attendance.java
com.etonn.attendance_autocounter.db.Course.java
com.etonn.attendance_autocounter.db.DBHelper.java
com.etonn.attendance_autocounter.db.DBManager.java
com.etonn.attendance_autocounter.db.Student.java