Android Open Source - ShowTracker Show Add Activity






From Project

Back to project page ShowTracker.

License

The source code is released under:

GNU General Public License

If you think the Android project ShowTracker 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.rolandmai.showtracker;
/* ww w. j  a va  2s  .co m*/
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class ShowAddActivity extends Activity {

  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.show_add);

    Button btnSave = (Button) findViewById(R.id.btnAddSave);
    Button btnCancel = (Button) findViewById(R.id.btnAddCancel);

    btnSave.setOnClickListener(new OnClickListener() {
      @Override
      public void onClick(View v) {
        AddShow();
      }
    });

    btnCancel.setOnClickListener(new OnClickListener() {
      @Override
      public void onClick(View v) {
        RedirectToList();
      }
    });
  }

  private void AddShow() {
    DatabaseHandler dbh = new DatabaseHandler(this);
    Show show = new Show();
    show.setCurrentEpisode(1);
    show.setCurrentSeason(1);
    EditText txt = (EditText) findViewById(R.id.txtAddShowName);
    show.setName(txt.getText().toString());
    dbh.addShow(show);
    RedirectToList();
  }

  private void RedirectToList() {
    Intent intent = new Intent(getApplicationContext(),
        ShowListActivity.class);
    startActivity(intent);
  }
}




Java Source Code List

com.rolandmai.showtracker.DatabaseHandler.java
com.rolandmai.showtracker.Episode.java
com.rolandmai.showtracker.Season.java
com.rolandmai.showtracker.ShowActivity.java
com.rolandmai.showtracker.ShowAddActivity.java
com.rolandmai.showtracker.ShowEditActivity.java
com.rolandmai.showtracker.ShowListActivity.java
com.rolandmai.showtracker.ShowListAdapter.java
com.rolandmai.showtracker.Show.java