JPG File Chooser
Main layout: Main code:package com.AndroidCustomDialog;import java.io.File;import java.util.ArrayList;import java.util.List;import android.app.Activity;import android.app.Dialog;import...
View ArticleGets IP addresses of a given host - InetAddress.getAllByName()
java.net.InetAddress is a class of Internet Protocol (IP) address. This can be either an IPv4 address or an IPv6 address, and in practice you'll have an instance of either Inet4Address or Inet6Address...
View ArticleImplement custom dialog to open folder
Custom dialog was implemented to load individual image(jpg). In this article, the custom dialog is used to open folder, instead of individual file. After dismissed, the images(jpg) in the selected...
View ArticleDisplay photos from SD in android.widget.Gallery
The photos in the selected folder will be loaded in a custom adapter to display in Gallery widget.Modify main.xml, to add <Gallery>. Modify AndroidGalleryActivity.java.In order to reduce the...
View ArticleUpdate Gallery photos in background thread
Last article "Display photos from SD in android.widget.Gallery" load Gallery photos in UI thread. As I mentioned in some previous posts, it's not a good practice to perform long time operation in UI...
View ArticleImplement AdapterView.OnItemClickListener for Gallery
To access the data associated with the selected item, call parent.getItemAtPosition(position). package com.AndroidGallery;import java.io.File;import java.io.IOException;import...
View ArticleCustom MapView
It's a simple example of using MapView, with everything implement in main activity.In this article, I'm going to implement a custom MyMapView extends MapView. Most of the routine works will be moved in...
View Articleosmdroid - interact with OpenStreetMap to replace Google Map
osmdroid provides Tools/Views to interact with OpenStreetMap-Data. The OpenStreetMapView is a (almost) full/free replacement for Androids MapView class.To build Android app with osmdroid, your app have...
View ArticleExample of implementing OpenStreetMap on Android using osmdroid
It's time to implement a simple app to display OpenStreetMap on Android using osmdroid.Make sure copy the requested JARs to libs folder, and edit manifest to add the permissionsModify the main layout...
View ArticleDisplay image in WebView
If you are so lazy as me! Display image in WebView is a good choice.Java Code:package com.image.webview;import android.os.Bundle;import android.os.Environment;import android.app.Activity;import...
View ArticleResize bitmap: Bitmap.createScaledBitmap vs BitmapFactory.Options.inSampleSize
In this article, two approach are provided to resize bitmap:- Bitmap.createScaledBitmap- BitmapFactory.Options.inSampleSizeBut...which one is better? In the code, the process time are also provided for...
View Articlestreaming video mediaplayer
My player have individual style. What features does the player have:Nice MediaController. I don’t use MediaController from Android API.New SeekBar styleAnimation for MedeaController. If user don’t...
View ArticleImage Upload on Server
Now in this example I will show you how to send an image file.Java Code:package com.example.imageuploadonserver;import java.io.ByteArrayOutputStream;import java.io.IOException;import...
View ArticleSave and Restore Instance State
The methods onSaveInstanceState(Bundle outState) and onRestoreInstanceState(Bundle savedInstanceState) are the good place to Save and Restore Instance State.onSaveInstanceState (Bundle outState)Called...
View ArticleInsert ImageView dynamically using Java code
Here demonstrate how to create and add ImageView in LinearLayout (inside HorizontalScrollView/ScrollView) dynamically using Java code.package com.example.androidinsertimages;import...
View ArticleAndroid Simple Calendar
In this tutorial, I am implementing the Calendar.Java Code:package com.examples;import java.text.ParseException;import java.text.SimpleDateFormat;import java.util.ArrayList;import...
View ArticleBlocking Incoming call - Android
Step 1:Create Broadcast receiver class for incoming callpackage com.javaorigin.android.sample;import java.lang.reflect.Method;import com.android.internal.telephony.ITelephony;import...
View ArticleAndroid SQLITE query selection example
In this example we are going to learn how to create a SQLite database adapter that will perform the basic operations such as creating the table, upgrading the database as well as providing access to...
View ArticleAndroid ListView Checkbox Example - OnItemClickListener() and OnClickListener()
In this example we are going to place a Checkbox inside the ListView row along with some Text. The concept is the same if you want to place a button or an image or all of them. The first issue that I...
View ArticleHandling Shake Events
Here is my implementation of shake detection for android. package com.android.sensor; import java.util.List; import android.hardware.Sensor; import android.hardware.SensorEvent; import...
View Article