Tag Archives: read

6,421 views

Preferences settings save open read write application Android example

Android app setup preferences, settings, open, read, write, onStop(), onPause(), getSharedPreferences(), SharedPreferences.Editor getInt(), getBoolean(), getString() , putInt(), putString(), putBoolean() example source code.   import android.content.SharedPreferences;   public class MainClass extends Activity { public static final String PREFERENCES_NAME = "MyPrefsFile"; String … Continue reading

Posted in Android Examples Code | Tagged , , , , , , , , | Comments Off on Preferences settings save open read write application Android example
53,573 views

Get Assets folder path and read txt file to string Android example code

Programmatically load text from Asset folder file myData.txt to string Android example source code. Read file to byte[] buffer and convert into string Android example. Assets folder path may be: c:\documents\_android_projects\MyProject\assets // Path for a WebView String sAssets = "file:///android_asset/" … Continue reading

Posted in Android Examples Code | Tagged , , , , , , | Comments Off on Get Assets folder path and read txt file to string Android example code
4,484 views

Read file from URL

Read file from URL to array of byte and convert to UTF-8 String Android examle source code. URL urlLoc = new URL("http://myweb.com/myfile.html"); URLConnection conexion = urlLoc.openConnection(); conexion.setConnectTimeout(4000); conexion.setReadTimeout(1000); conexion.connect();   // downlod the file InputStream input = new BufferedInputStream(urlLoc .openStream()); … Continue reading

Posted in Android Examples Code | Tagged , , , , , | Comments Off on Read file from URL