• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Need help! Android Java code R.raw cannot be resolved

Greetings: can some please help with this test app?
It is a basic video media app but I keep getting R raw cannot be resolved I have tried everything been on Stack over flow installed re installed Eclipse Juno Kepler now Indigo and I get same error can some talented Developer please assist me with this? Im using Windows 7 64bit Indigo Eclipse
package com.scseriestest;

import android.app.Activity;
import android.os.Bundle;
import android.media.MediaPlayer;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class ScSeriesTest extends Activity implements MediaPlayer.OnCompletionListener {

Button mPlay;
MediaPlayer mPlayer;

@override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

mPlay = new Button(this);
mPlay.setText("Play Sound");
mPlay.setOnClickListener(playListener);

setContentView(R.layout.activity_main);

}
@override
public void onDestroy() {
super.onDestroy();
if(mPlayer != null) {
mPlayer.release();
}
}
private View.OnClickListener playListener = new View.OnClickListener() {
@override
public void onClick(View v) {
if(mPlayer == null) {
try {
mPlayer = MediaPlayer.create(ScSeriesTest.this, R.raw.scs);
mPlayer.start();
} catch (Exception e) {
e.printStackTrace();
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">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="Now Playing..."
/>

<VideoView
android:id="@+id/videoView1"
android:layout_width="match_parent"
android:layout_height="wrap_content" />

<ImageView
android:id="@+id/coverImage"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="centerInside"
/>
</LinearLayout>
 

Attachments

  • upload_2015-5-16_19-9-50.png
    upload_2015-5-16_19-9-50.png
    166.7 KB · Views: 654
Make sure that raw folder exists inside res directory, and contains the scs named file. If problem still exists, clean and project and restart the eclipse

Anirudh
 
Last edited by a moderator:
Anirudh can i send you the complete code can you edit and show me where I went wrong?
Thank you very much for helping me

Greetings: can some please help with this test app?
It is a basic video media app but I keep getting R raw cannot be resolved I have tried everything been on Stack over flow installed re installed Eclipse Juno Kepler now Indigo and I get same error can some talented Developer please assist me with this? Im using Windows 7 64bit Indigo Eclipse
package com.scseriestest;

import android.app.Activity;
import android.os.Bundle;
import android.media.MediaPlayer;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class ScSeriesTest extends Activity implements MediaPlayer.OnCompletionListener {

Button mPlay;
MediaPlayer mPlayer;

@override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

mPlay = new Button(this);
mPlay.setText("Play Sound");
mPlay.setOnClickListener(playListener);

setContentView(R.layout.activity_main);

}
@override
public void onDestroy() {
super.onDestroy();
if(mPlayer != null) {
mPlayer.release();
}
}
private View.OnClickListener playListener = new View.OnClickListener() {
@override
public void onClick(View v) {
if(mPlayer == null) {
try {
mPlayer = MediaPlayer.create(ScSeriesTest.this, R.raw.scs);
mPlayer.start();
} catch (Exception e) {
e.printStackTrace();
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">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="Now Playing..."
/>

<VideoView
android:id="@+id/videoView1"
android:layout_width="match_parent"
android:layout_height="wrap_content" />

<ImageView
android:id="@+id/coverImage"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="centerInside"
/>
</LinearLayout>
Make sure that raw folder exists inside res directory, and contains the scs named file. If problem still exists, clean and project and restart the eclipse

Anirudh
 
Last edited by a moderator:
Anirudh can i send you the complete code can you edit and show me where I went wrong?
Thank you very much for helping me
Thank you for your response I did all that I went to your website and got your email adddress I am sending over now thank you and pls help me thank you
Regards
Joseph
 
Back
Top Bottom