GithubHelp home page GithubHelp logo

xamarin-android-use-removable-sd-card's Introduction

Xamarin.Android: Use your removable SD card (KitKat+ too!)

Demonstrates how to how to access the 'external', REMOVABLE SD card plugged into your Android device.

The code example is done in C#, but exactly the same principles apply in Java, so it should be extremely easy for an Android Java dev to understand exactly what's going on.

Background

There's been a lot of questions on StackOverflow (and other places) about how to access the 'External Storage' on an Android device. Most people seem to want to know how to read from (and write to) the SD card the've plugged into the SD card slot in their device.

This sample project shows you how to do just that.

For more details, there's two blog posts about this that I've put together;

Everything in here is released as OSS under the MIT license, so feel free to use it any way you like.

xamarin-android-use-removable-sd-card's People

Contributors

wislon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

georgedalessio

xamarin-android-use-removable-sd-card's Issues

error if no external sdcard on android 5.1

in the public class ExternalSdStorageHelper on a lenovo tab yoga 3LT with no sdcard installed,

externalFilesDirs return 2 lines

  • the first : {Java.IO.File}
  • the second is null

string externalSdPath = externalFilesDirs.Length > 1 ? externalFilesDirs[1].AbsolutePath : string.Empty; // we only want the external drive, otherwise nothing!

return an error

*You can replace this line with *

                string externalSdPath;
                if (externalFilesDirs.Length > 1)
                {
                    if (externalFilesDirs[1] != null)
                    {
                        // we only want the external drive, otherwise nothing!
                        externalSdPath = externalFilesDirs[1].AbsolutePath;
                    }
                    else
                    {
                        externalSdPath = string.Empty;
                    }
                }
                else
                {
                    externalSdPath = string.Empty;
                }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.