Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5967043
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:53:10+00:00 2026-05-22T19:53:10+00:00

In my current working code, I pass the reference of an image from a

  • 0

In my current working code, I pass the reference of an image from a screen that shows some thumbnails. When the thumbnail is selected, the image id is stored and then used in a new activity. Now, when a thumbnail is selected, I want to store the image id and a reference to the associated video file.

When the thumbnail is selected, it opens a new activity that shows the full image with a play button. When the play button is selected, I want it to call a new activity that will play the video based on the reference saved on the thumbnail screen. I have everything working except getting the video to play using the reference. When I hard code the file name in, the video will play.

here’s some snippets of my code.

From thumbnail class:

public void onClick(View v) {
    Intent fullImage = new Intent(standard_main.this, full_image.class);
    Intent playVideo = new Intent(standard_main.this, video.class);

    switch(v.getId()){

    case R.id.img_standard1:
        fullImage.putExtra("Full", R.drawable.img_standard1);
        playVideo.putExtra("VideoFile", R.raw.standard); // added to try to reference video for future use
        startActivity(fullImage);
        break;

From full_image class:

if (x >= leftPlayPoint && x < rightPlayPoint && y >= topPlayPoint && y < bottomPlayPoint){
            startActivity(new Intent("com.example.PLAYVIDEO"));

From my video class:

VideoView vd = (VideoView) findViewById(R.id.VideoView);
    int vidID = getIntent().getIntExtra("VideoFile",0);
    Uri uri =  Uri.parse("android.resource://com.example/"+ R.raw.standard);

I want to somehow use vidID to replace R.raw.standard.

If I’m understanding correctly, I cannot use vidID because it is an Int and Uri.parse wants a string. I tried converting the Int to a String using toString() but I suspect that only converted the actual number to a string and did bring in the actual file name. I also tried String.valueOf(vidID).

I’m thinking that Parcelabel might be used somewhere, but I’m not following how to use it. One other option I thought was to store all the video names in an array and somehow use this to dynamically create the file name on the video.java file.

I’ll keep searching, but any help is much appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T19:53:11+00:00Added an answer on May 22, 2026 at 7:53 pm

    This is one way to do it. Perhaps there is an easier way, but none that I know of.

    Some example code.

    int myResourceId = getIntent().getIntExtra("AudioFile", 0);
    
    StringBuilder sb = new StringBuilder();
    // get full resource path, e.g. res/raw/audio.mp3
    sb.append(getResources().getString(myResourceId));
    // delete res folder
    sb.delete(0, sb.indexOf("/"));
    // delete file extension
    sb.delete(sb.indexOf(".mp3"), sb.length());
    // insert package at beginning
    sb.insert(0, "android.resource://com.example");
    
    Uri uri = Uri.parse(sb.toString());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I reference another eclipse project from the current project I am working on. Everything
How do I delete untracked local files from the current working tree?
Without routing, HttpContext.Current.Session is there so I know that the StateServer is working. When
Current, I've got a stored procedure that has a main goal of doing a
How can I retrieve the current working directory of cmd.exe? This seems possible. For
The current class library I am working on will have a base class (Field)
For a current project I am working I need to return an aggregate report
At my current job I've been working on making web apps with Java, Tapestry,
I am working on an in-house tool for interfacing to a database. My current
I am currently working on a app that has multi web browsers on a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.