When you call a resource you must exclude its extension, so.. you have
to type R.raw.vid instead of R.raw.vid.avi
On Mar 28, 3:19 pm, rahul <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I am developing an android application in which i need the user to
> upload some data on to a server. I am creating a folder "raw" in /res
> and saving my file there. However, i get an error "R.raw cannot be
> resolved".
> My code is:
>
> package com.android.Client_data;
>
> import android.app.Activity;
> import android.graphics.PixelFormat;
> import android.media.MediaPlayer;
> import android.os.Bundle;
> import android.util.Log;
> import android.view.View;
> import android.webkit.URLUtil;
> import android.widget.EditText;
> import android.widget.ImageButton;
> import java.io.*;
> import android.content.Context;
> import java.net.*;
>
> public class Client_data extends Activity {
> /** Called when the activity is first created. */
> @Override
> public void onCreate(Bundle icicle) {
> super.onCreate(icicle);
> showVideo(this);
> setContentView(R.layout.main);
> }
>
> void showVideo(Context context)
> {
> InputStream is =
> this.getResources().openRawResource(R.raw.vid.avi);
> MediaPlayer mp = MediaPlayer.create(context, R.raw.vid.avi);
> mp.prepare();
> mp.start();
> }
>
> }
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---