Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Mobile Development
  3. Android
  4. How to give path in Android

How to give path in Android

Scheduled Pinned Locked Moved Android
tutorialandroidcomquestionlearning
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jasonalien
    wrote on last edited by
    #1

    I'm trying to display gif images on Android. This is my code to display a.gif :

        WebView wView = new WebView(this);
        wView.loadUrl("android.resource://" + getPackageName() + "/" + R.drawable.a);
        setContentView(wView);
    

    But I get this : The webpage at android.resource://com.example.mypc.myapp/2497475928917 could not be loaded because : net::ERR_UNKNOWN_URL_SCHEME My gif files are in drawable and raw folder under res folder. Can you tell me how to give paths of gifs correctly? Thanks in advance.

    D M J 3 Replies Last reply
    0
    • J jasonalien

      I'm trying to display gif images on Android. This is my code to display a.gif :

          WebView wView = new WebView(this);
          wView.loadUrl("android.resource://" + getPackageName() + "/" + R.drawable.a);
          setContentView(wView);
      

      But I get this : The webpage at android.resource://com.example.mypc.myapp/2497475928917 could not be loaded because : net::ERR_UNKNOWN_URL_SCHEME My gif files are in drawable and raw folder under res folder. Can you tell me how to give paths of gifs correctly? Thanks in advance.

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      Animated GIF, or just a single image? Lots of suggestions here.

      jasonalien wrote:

      wView.loadUrl("android.resource://" + getPackageName() + "/" + R.drawable.a);

      This should probably be:

      wView.loadUrl("file:///android_asset/a.gif");

      "One man's wage rise is another man's price increase." - Harold Wilson

      "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

      "You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles

      1 Reply Last reply
      0
      • J jasonalien

        I'm trying to display gif images on Android. This is my code to display a.gif :

            WebView wView = new WebView(this);
            wView.loadUrl("android.resource://" + getPackageName() + "/" + R.drawable.a);
            setContentView(wView);
        

        But I get this : The webpage at android.resource://com.example.mypc.myapp/2497475928917 could not be loaded because : net::ERR_UNKNOWN_URL_SCHEME My gif files are in drawable and raw folder under res folder. Can you tell me how to give paths of gifs correctly? Thanks in advance.

        M Offline
        M Offline
        mack GUI
        wrote on last edited by
        #3

        just drag and drop file in assets folder and add the upper commented path

        1 Reply Last reply
        0
        • J jasonalien

          I'm trying to display gif images on Android. This is my code to display a.gif :

              WebView wView = new WebView(this);
              wView.loadUrl("android.resource://" + getPackageName() + "/" + R.drawable.a);
              setContentView(wView);
          

          But I get this : The webpage at android.resource://com.example.mypc.myapp/2497475928917 could not be loaded because : net::ERR_UNKNOWN_URL_SCHEME My gif files are in drawable and raw folder under res folder. Can you tell me how to give paths of gifs correctly? Thanks in advance.

          J Offline
          J Offline
          Jervie Ocampo
          wrote on last edited by
          #4

          myVideoView.setVideoURI(Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.introvideo));

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups