View 列表视图中出现错误?

View 列表视图中出现错误?,view,methods,android-listview,android-mediaplayer,onclicklistener,View,Methods,Android Listview,Android Mediaplayer,Onclicklistener,我实现了播放歌曲的列表视图。当我在listview中单击项目时,它将强制关闭。如果我在列表视图中调用media player,它将正常工作。但是在方法上它越来越接近了。请帮我解决 public class ListMobileActivity extends ListActivity { MediaPlayer mp; boolean playing=false; View preView; ImageView imageView; int itemno; static fina

我实现了播放歌曲的列表视图。当我在listview中单击项目时,它将强制关闭。如果我在列表视图中调用media player,它将正常工作。但是在方法上它越来越接近了。请帮我解决

     public class ListMobileActivity extends ListActivity {
MediaPlayer mp;
boolean playing=false;
View preView;
 ImageView imageView;
 int itemno;

static final String[] MOBILE_OS = new String[] { "Songs1", "Songs2",
        "Songs3", "Songs4","SOngs5","Songs6","songs7","songs8","Songs9","Songs10"};
private static final String TAG = "LIstMobileActivity";
int songs []= {R.raw.lazy,R.raw.tamil,R.raw.turn,R.raw.lazy,R.raw.tamil,R.raw.lazy,R.raw.turn,R.raw.tamil,R.raw.turn};

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    //setListAdapter(new ArrayAdapter<String>(this, R.layout.list_mobile,
    //R.id.label, MOBILE_OS));

    setListAdapter(new MobileArrayAdapter(this, MOBILE_OS));


}

@Override
protected void onListItemClick(ListView l, View v, int pos, long id) {

    ListMobileActivity.this.playSample(pos);

    }

           private void playSample( int position)
        {

        AssetFileDescriptor afd = getApplicationContext().getResources().openRawResourceFd(songs[position]);


           try{
              if(this.mp.isPlaying())
            {
                this.mp.stop();


                this.mp.reset();}
                this.mp.setDataSource(afd.getFileDescriptor(), afd.getStartOffset(), afd.getDeclaredLength());
                this.mp.prepare();
             this.   mp.start();
                afd.close();



        }
        catch (IllegalArgumentException e)
        {
            Log.e(TAG, "Unable to play audio queue do to exception: " + e.getMessage(), e);
        }
        catch (IllegalStateException e)
        {
            Log.e(TAG, "Unable to play audio queue do to exception: " + e.getMessage(), e);
        }
        catch (IOException e)
        {
            Log.e(TAG, "Unable to play audio queue do to exception: " + e.getMessage(), e);
        }
}}
公共类ListMobileActivity扩展了ListActivity{
MediaPlayer mp;
布尔播放=假;
查看预览;
图像视图图像视图;
国际项目编号;
静态最终字符串[]MOBILE_OS=新字符串[]{“Songs1”、“Songs2”,
“Songs3”、“Songs4”、“SOngs5”、“Songs6”、“songs7”、“songs8”、“Songs9”、“Songs10”};
私有静态最终字符串TAG=“LIstMobileActivity”;
int songs[]={R.raw.lazy,R.raw.tamil,R.raw.turn,R.raw.lazy,R.raw.tamil,R.raw.turn,R.raw.tamil,R.raw.turn};
@凌驾
创建时的公共void(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
//setListAdapter(新阵列适配器)(此,R.layout.list\u移动、,
//R.id.label,MOBILE_OS));
setListAdapter(新的MobileArrayAdapter(这个,MOBILE_OS));
}
@凌驾
受保护的void onListItemClick(列表视图l、视图v、整数位置、长id){
ListMobileActivity.this.playSample(pos);
}
私有无效播放示例(内部位置)
{
AssetFileDescriptor afd=getApplicationContext().getResources().openRawResourceFd(歌曲[position]);
试一试{
if(this.mp.isPlaying())
{
这个.mp.stop();
this.mp.reset();}
this.mp.setDataSource(afd.getFileDescriptor(),afd.getStartOffset(),afd.getDeclaredLength());
这个.mp.prepare();
这个.mp.start();
afd.close();
}
捕获(IllegalArgumentException e)
{
Log.e(标记“无法播放音频队列do to exception:”+e.getMessage(),e);
}
捕获(非法状态)
{
Log.e(标记“无法播放音频队列do to exception:”+e.getMessage(),e);
}
捕获(IOE异常)
{
Log.e(标记“无法播放音频队列do to exception:”+e.getMessage(),e);
}
}}

@JJPA现在看到我添加了一张图片。你能发布第108行的内容吗?