How to Declare and Set an InputStream

InputStream was added in API Level 1
A readable source of bytes.Most clients will use input streams that read data from the file system, the network, or from an in-memory byte array.

1. Create an Android project, if you don't already have one.

2. In the MainActivity.java file, add the line below to the imports section.

      import java.io.InputStream;

3.Add the code below to the onCreate method. This will declare the InputStream and set it to null.

InputStream myInputStream = null; 

4. Compile and run!

Next Recommended Article: How to Open an InputStream