package cn.class3g.video; … public class VideoClientActivity extends Activityimplements OnClickListener { EditText nameEt, timeLengthEt, fileEt; Button saveBtn; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.setContentView(R.layout.save_video_info); findViews(); } private void findViews() { nameEt = (EditText) this.findViewById(R.id.nameEt); timeLengthEt = (EditText) this.findViewById(R.id.timeLengthEt); fileEt = (EditText) this.findViewById(R.id.videoFileEt); saveBtn = (Button) this.findViewById(R.id.saveBtn); saveBtn.setOnClickListener(this); } public void onClick(View v) { String videoName = nameEt.getText().toString(); String timeLength = timeLengthEt.getText().toString(); String videoFile = fileEt.getText().toString(); try { File file = new File(Environment.getExternalStorageDirectory(), videoFile); if (VideoService.saveVideo(videoName, timeLength, file)) { Toast.makeText(this, R.string.success, 1).show(); } else { Toast.makeText(this, R.string.error, 1).show(); } } catch (Exception e) { Log.e("TAG", e.toString()); Toast.makeText(this, R.string.error, Toast.LENGTH_SHORT).show(); } } } |