Android Internal Storage: Read and Write text file example

Android Internal Storage :

In Android you can also save files (text file etc) directly on the device’s internal storage. By default,Saving and Loading Files to the internal storage are private to your application and different applications will not access them (nor can the user). once the user uninstalls this application, these files will automatically remove.

android read and write text file example

In Android data storage, It’s good practice to use Shared Preferences or a database to store your application data, but there are still times once you’ll need to use files directly rather than rely on Android’s managed mechanisms.

Sometime want to save data which have not be…

Read More . . .

Android Custom Listview with Image and Text using ArrayAdapter

Custom Listview with Image and Text :

The standard ListView only displays a list of items. while it may suffice when you simply need to show a list of text, it’s not enough for more refined applications. in this example, you’ll see how you’ll be able to customise the ListView so that you’ll be able to show pictures, multiple lines of text, and more.

custom listview image text

A. First Learn How to Display Image in ListView :

1. The first thing you’ll learn in this example is how to show a picture next…

Read More . . .

Android Gallery View – Displaying a List of Images

Android Gallery View :

In your application if you want display a series of images to the user, you can make use of the Gallery.The Gallery is a view that shows items (such as images) in a center-locked, horizontal scrolling list.

android Gallery View example 2

How to Create Android Gallery View:

  • Gallery is used to show Views in a horizontal list, and user will select a view , User selected view will be shown in center of the Horizontal list
  • The items of Gallery are get from an Adapter, just like ListView, in which ListView items are get from an Adapter.
  • We need to make an Adapter class that extends BaseAdapter class and override  getView() method.
  • getView() method known as…

    Read More . . .

Android Toast – Creating a Android Custom Toast

Toast in Android :

Toast is transient notifications that stay visible for less than a few seconds before fading out. Toast don’t take focus and its not a modal , so that they don’t interrupt the application.You can also use it for debugging purpose. A toast provides simple feedback about an operation in a small popup.

android-custom-toast-example

Toasts are excellent for informing your users of events without forcing them to open an Activity or browse a Notification. they provide a perfect mechanism for alerting users to events occurring in background Services without interrupting foreground applications. Generally, your application should show Toasts only if one of its Activities is active.

Creating Simple (Default) Android Toast :

The Toast…

Read More . . .

Android Data Storage Options – SharedPreferences Tutorial

SharedPreferences in Android :

Android provides the SharedPreferences object to assist you save simple application information. using the SharedPreferences object, you’ll save the data you want through the use of key/value pairs — specify a key for the data you want to save, then both it and its value are going to be saved automatically to an XML file.

Android SharedPreferences example

its very useful when storing UI state, user preferences, or application settings, you want a light-weight mechanism to store a known set of values. Shared Preferences allow you to save groups of name/value pairs of primitive data as named preferences.

Creating and saving Shared Preferences :

Using the SharedPreferences class, you’ll create named…

Read More . . .