请看代码~~
红色字体总是提示错误,我真不知道怎么改了~~  文件raw内的video1.3gp,只是想程序开始播放这个而已,我该怎么做~~
public class AdActivity extends Activity {
private VideoView v;
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        v = (VideoView) findViewById(R.id.videoView1);
        Uri uri=Uri.parse
         (
          "android.resource://com.ad/"+ R.raw.video1
         );
        v.setVideoURI(uri);
        v.requestFocus();
        v.start();
        v.setOnCompletionListener(new MediaPlayer.OnCompletionListener()
        {
         @Override
         public void onCompletion(MediaPlayer arg0)
         {
           /*略*/         }
         });
        }
    }
xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
    <VideoView 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:id="@+id/videoView1">
    </VideoView>
</LinearLayout>

解决方案 »

  1.   

    R.layout.main这里错,说明layout中没有main.xml文件?
    你确定你的命名没有问题?
      

  2.   

    R没有指明是Android全局的还是针对你自己的package的,以前遇到过,看看你的import语句
      

  3.   

    你看看的项目结构是否有错误,看你的代码都是在读Eclipse自动生成的R文件时出的问题,你看看你的项目自动生成R文件没?最好能发个你项目结构的截图
      

  4.   

    重新贴图的问题地址,帮忙看看
    http://topic.csdn.net/u/20110917/11/690b33d5-a427-40b1-af22-582ffa0c5ea9.html?032997219237895203