How to Declare a DataInputStream

DataInputStream was added in API Level 1
Wraps an existing InputStream and reads big-endian typed data from it. Typically, this stream has been written by a DataOutputStream. Types that can be read include byte, 16-bit short, 32-bit int, 32-bit float, 64-bit long, 64-bit double, byte strings, and strings encoded in modified UTF-8.

1. In the MainActivity.java file, add the below import to the imports section.

import java.io.DataInputStream;

2. In the onCreate method, add the below line to declare a new DataInputStream named myDataInputStream.

DataInputStream myDataInputStream;

3. Compile and run!

Next Recommended Article: How to Initialize a DataInputStream

Resources:
http://developer.android.com/reference/java/io/DataInputStream.html
http://android-er.blogspot.com/2011/01/simple-communication-using.html