Android Open Source - firstcodeandroid Select Act






From Project

Back to project page firstcodeandroid.

License

The source code is released under:

MIT License

If you think the Android project firstcodeandroid 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.vjia.hellonote;
// w  w  w  .  jav a 2 s .  c o m
import android.app.Activity;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.VideoView;

public class SelectAct extends Activity implements OnClickListener {

  private Button s_delete, s_back;
  private ImageView s_img;
  private VideoView s_video;
  private TextView s_tv;
  private NotesDB notesDB;
  private SQLiteDatabase dbWriter;

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.select);
    // System.out.println(getIntent().getIntExtra(NotesDB.ID, 0));
    s_delete = (Button) findViewById(R.id.s_delete);
    s_back = (Button) findViewById(R.id.s_back);
    s_img = (ImageView) findViewById(R.id.s_img);
    s_video = (VideoView) findViewById(R.id.s_video);
    s_tv = (TextView) findViewById(R.id.s_tv);
    notesDB = new NotesDB(this);
    dbWriter = notesDB.getWritableDatabase();
    s_back.setOnClickListener(this);
    s_delete.setOnClickListener(this);

    if (getIntent().getStringExtra(NotesDB.PATH).equals("null")) {
      s_img.setVisibility(View.GONE);
    } else {
      s_img.setVisibility(View.VISIBLE);
    }
    if (getIntent().getStringExtra(NotesDB.VIDEO).equals("null")) {
      s_video.setVisibility(View.GONE);
    } else {
      s_video.setVisibility(View.VISIBLE);
    }
    s_tv.setText(getIntent().getStringExtra(NotesDB.CONTENT));
    Bitmap bitmap = BitmapFactory.decodeFile(getIntent().getStringExtra(
        NotesDB.PATH));
    s_img.setImageBitmap(bitmap);
    s_video.setVideoURI(Uri
        .parse(getIntent().getStringExtra(NotesDB.VIDEO)));
    s_video.start();
  }

  @Override
  public void onClick(View v) {
    switch (v.getId()) {
    case R.id.s_delete:
      deleteDate();
      finish();
      break;

    case R.id.s_back:
      finish();
      break;
    }
  }

  public void deleteDate() {
    dbWriter.delete(NotesDB.TABLE_NAME,
        "_id=" + getIntent().getIntExtra(NotesDB.ID, 0), null);
  }
}




Java Source Code List

com.example.activitylifecycletest.DialogActivity.java
com.example.activitylifecycletest.MainActivity.java
com.example.activitylifecycletest.NormalActivity.java
com.example.activitytest.FirstActivity.java
com.example.listviewtest.FruitAdapter.java
com.example.listviewtest.Fruit.java
com.example.listviewtest.MainActivity.java
com.jikexueyuan.counttime.MainActivity.java
com.jikexueyuan.getmyphonenumber.GetNumber.java
com.jikexueyuan.getmyphonenumber.MainActivity.java
com.jikexueyuan.getmyphonenumber.MyAdapter.java
com.jikexueyuan.getmyphonenumber.PhoneInfo.java
com.vjia.bookcollector.MainActivity.java
com.vjia.coolweather.MainActivity.java
com.vjia.coolweather.activity.ChooseAreaActivity.java
com.vjia.coolweather.activity.WeatherActivity.java
com.vjia.coolweather.db.CoolWeatherDB.java
com.vjia.coolweather.db.CoolWeatherOpenHelper.java
com.vjia.coolweather.model.City.java
com.vjia.coolweather.model.County.java
com.vjia.coolweather.model.Province.java
com.vjia.coolweather.util.HttpCallbackListener.java
com.vjia.coolweather.util.HttpUtil.java
com.vjia.coolweather.util.Utility.java
com.vjia.helloandroid.FirstActivity.java
com.vjia.helloandroid.HelloAndroidActivity.java
com.vjia.hellonote.AddContent.java
com.vjia.hellonote.MainActivity.java
com.vjia.hellonote.MyAdapter.java
com.vjia.hellonote.NotesDB.java
com.vjia.hellonote.SelectAct.java
com.vjia.jokeking.GetJoke.java
com.vjia.jokeking.HttpCallbackListener.java
com.vjia.jokeking.HttpUtil.java
com.vjia.jokeking.Joke.java
com.vjia.jokeking.MainActivity.java
com.vjia.jokeking.MyAdapter.java
com.vjia.locationtest.MainActivity.java