MainActivity: [java] package c. c; import android. app. activity; import android. content. contentValues; import android. content. intent; import android.net. uri; import android. OS. bundle; import android. provider. mediaStore; import android. view. view; import android. view. view. onClickListener; import android. widget. button; import android. widget. editText;/*** Demo Description: * 1. Use the System camera to take a video. * 2. Use the system control to play the video. * 3. Modify the video metadata (for example, video title). ** note: * When the metadata is updated in MediaStore, the * Data of the video file itself is not updated; instead, it only updates the record about the video in MediaStore */public class MainActivity extends Activity {private final static int VIDEO_CAPTURE = 9527; private Uri mVideoUri; private Button mCaptureButton; private Button mPlayButton; private Button mSaveButton; private EditText mEditText; @ Override public void onCreate (Bundle savedInstanceState) {super. onCreate (savedInstanceState); setContentView (R. layout. main); init ();} private void init () {mCaptureButton = (Button) findViewById (R. id. capture_Button); mCaptureButton. setOnClickListener (new ButtonClickListenerImpl (); mPlayButton = (Button) findViewById (R. id. play_Button); mPlayButton. setEnabled (false); mPlayButton. setOnClickListener (new ButtonClickListenerImpl (); mSaveButton = (Button) findViewById (R. id. save_Button); mSaveButton. setOnClickListener (new ButtonClickListenerImpl (); mSaveButton. setEnabled (false); mEditText = (EditText) findViewById (R. id. editText); mEditText. setEnabled (false);} private class ButtonClickListenerImpl implements OnClickListener {public void onClick (View v) {if (v. getId () = R. id. capture_Button) {Intent intent = new Intent (MediaStore. ACTION_VIDEO_CAPTURE); startActivityForResult (intent, VIDEO_CAPTURE);} if (v. getId () = R. id. play_Button) {Intent intent = new Intent (Intent. ACTION_VIEW, mVideoUri); startActivity (intent);} if (v. getId () = R. id. save_Button) {ContentValues contentValues = new ContentValues (1); String title = mEditText. getText (). toString (); contentValues. put (MediaStore. mediaColumns. TITLE, title); int result = getContentResolver (). update (mVideoUri, contentValues, null, null); if (result = 1) {System. out. println ("video name set successfully");} else {System. out. println ("failed to set video name") ;}}@ Override protected void onActivityResult (int requestCode, int resultCode, Intent data) {super. onActivityResult (requestCode, resultCode, data); if (resultCode = RESULT_ OK & requestCode = VIDEO_CAPTURE) {mVideoUri = data. getData (); mPlayButton. setEnabled (true); mSaveButton. setEnabled (true); mEditText. setEnabled (true) ;}} main. xml is as follows: [html] <LinearLayout xmlns: android = "http://schemas.android.com/apk/res/android" xmlns: tools = "http://schemas.android.com/tools" android: layout_width = "match_parent" android: layout_height = "match_parent" android: orientation = "vertical"> <Button android: id = "@ + id/capture_Button" android: layout_width = "150dip" android: layout_height = "wrap_content" android: text = "Video Capture"/> <Button www.2cto.com android: id = "@ + id/play_Button" android: layout_width = "150dip" android: layout_height = "wrap_content" android: text = "Video Play"/> <EditText android: id = "@ + id/editText" android: layout_width = "150dip" android: layout_height = "wrap_content" android: hint = "video title"/> <Button android: id = "@ + id/save_Button" android: layout_width = "150dip" android: layout_height = "wrap_content" android: text = "save Button"/> </LinearLayout>