我有CheckedTextView
几个项目。一旦我选择列表,我想删除文本,当我重新加载我的应用程序时它必须删除我的 xml 包含以下代码
<?xml version="1.0" encoding="utf-8"?>
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/title"
android:layout_width="fill_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:textAppearance="?android:attr/textAppearanceLarge"
android:gravity="center_vertical"
android:checkMark="?android:attr/textCheckMark"
android:paddingLeft="6dip"
android:paddingRight="6dip"
style="@style/CodeFont"
/>
我的活动包含以下代码:
import android.app.ListActivity;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.CheckedTextView;
import android.widget.ListView;
import android.widget.Toast;
public class def extends ListActivity {
/** Called when the activity is first created. */
static String[] value;
MediaPlayer mediaPlayer = new MediaPlayer();
static int i=0;
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
Bundle b = getIntent().getExtras();
value = b.getStringArray("a1");
this.setListAdapter(new ArrayAdapter<String>(this,R.layout.abc,value));
}
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
super.onListItemClick(l, v, position, id);
// Get the item that was clicked
//Object o = this.getListAdapter().getItem(position);
//Generate and display the List of visits for this day by calling the AsyncTask
getListView().setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
String keyword = value[position];
mediaPlayer.reset();
try
{
mediaPlayer.setDataSource("/sdcard/"+keyword+".mp4");
mediaPlayer.prepare();
mediaPlayer.start();
}
catch(Exception e)
{
e.printStackTrace();
}
}
如果有任何方法可以做到这一点,请帮助我。