1 Replies - 1672 Views - Last Post: 04 May 2015 - 12:56 AM

#1 javajoeb   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 26-January 14

Android IntelliJ Errors Cannot resolve R.raw Cannot find symbols (3)

Posted 03 May 2015 - 01:22 PM

I am using IntelliJ coding Android Moduble and I get these three errors trying to build and compile my program
Error:(22, 24) java: cannot find symbol
symbol: variable layout
location: class com.scsvideo.ScSVideo
Error:(26, 47) java: cannot find symbol
symbol: variable id
location: class com.scsvideo.ScSVideo
Error:(27, 89) java: cannot find symbol
symbol: variable raw
location: class com.scsvideo.R
Here is the code:
package com.scsvideo;

import android.app.Activity;
import android.net.Uri;
import android.os.Bundle;
import android.widget.MediaController;
import android.widget.Toast;
import android.widget.VideoView;
import com.scsvideo.*;




public class ScSVideo extends Activity {
    private VideoView mVideoView;
    /**
     * Called when the activity is first created.
     */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(layout.main);

        Toast.makeText(getApplicationContext(), "Turn device to side tap screen", Toast.LENGTH_LONG).show();

        mVideoView = (VideoView) findViewById(id.surface_view);
        mVideoView.setVideoURI(Uri.parse("android.resource://" + getPackageName() +"/"+R.raw.s));
        mVideoView.setMediaController(new MediaController(this));
         mVideoView.requestFocus();
        }
    }



Now here is the main XML
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:orientation="vertical"
              android:layout_width="match_parent"
              android:layout_height="match_parent">

    <VideoView
            android:id="@+id/surface_view"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"/>
</LinearLayout>

Next Android Manifest XML
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.scsvideo"
          android:versionCode="1"
          android:versionName="1.0">
    <uses-sdk android:minSdkVersion="22"/>
    <application android:label="@string/app_name" android:icon="@drawable/ic_launcher">
        <activity android:name="ScSVideo"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
    </application>
</manifest>


Can someone PLS PLS help me?

This post has been edited by macosxnerd101: 03 May 2015 - 01:24 PM
Reason for edit:: Added code tags and moved to Android


Is This A Good Question/Topic? 0
  • +

Replies To: Android IntelliJ Errors Cannot resolve R.raw Cannot find symbols (3)

#2 AKMafia001   User is offline

  • </code.in.dream>
  • member icon

Reputation: 238
  • View blog
  • Posts: 738
  • Joined: 11-June 11

Re: Android IntelliJ Errors Cannot resolve R.raw Cannot find symbols (3)

Posted 04 May 2015 - 12:56 AM

Hi, Welcome to DIC!

Your project resources(drawables, layouts, strings, etc) are accessible using R. If I would need to use an id, I would write R.id.my_id.

Kindly fix these errors,
22        setContentView(layout.main);
26        mVideoView = (VideoView) findViewById(id.surface_view);


Was This Post Helpful? 0
  • +
  • -

Page 1 of 1