2012

Tutorial

Android Expandable List Example

In this tutorial I will show you how to make a simple Expandable List. 1. Create a new project and call your java class(the one that is generated by Eclipse or other IDE) “MyActivity”. 2. Go to res – layout -main.xml and put the following code: <?xml version=”1.0″ encoding=”utf-8″?> <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:orientation=”vertical” android:layout_width=”fill_parent” android:layout_height=”fill_parent” > […]

, , , ,
Tutorial

Android Database Tutorial

In this tutorial I will show how to use a database in Android by creating the tables and columns using the SQLite Database Browser.1. So the first step is to download the SQLite Database Browser2. Make a new project and name the main java class that generates with the project “MyActivity”. 3. Now you have to go

, , ,
Tutorial

Android TCP Connection Tutorial

In this tutorial we will make a TCP Connection. The server will be written in Java and the client will be written in Android. Actually it will be a very simple messenger client. Note: Now we have an enhanced version of TCP Connection here, but it’s just the code. For more details and explanations you still

, , , , , , , ,
Tutorial

Android ListView with ViewHolder Tutorial

In this tutorial I will show you how to create a simple ListView with a custom ListAdapter. But first, let’s see why to use ListView. Why shouldn’t we use ScrollView instead, regarding that it’s easier to create? Well your questions are good ones :) . The advantage of the ListView is that it uses an

, , , , ,
Snippets, Solutions

Add image to email intent in Android

How to add image to an email intent in Android: // build a email sending intent Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType(“image/png”); // set the email subject emailIntent.putExtra(Intent.EXTRA_SUBJECT, “email subject”); // set the email image path for the attachment emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(“file://” + mEmailImagePath)); // set the body of the email emailIntent.putExtra(Intent.EXTRA_TEXT, “some text message”);

, , , ,
Solutions, Tutorial

How to Add AdMob to Android [Deprecated]

NOTE 1: This tutorial is now deprecated. See this one instead! NOTE 2:  This project is made in Intellij. For those who use Eclipse or other IDE the integration of AdMob library will differ. You can use AdMob lib only on at least Android v3.2 (Api Level 13), so you must compile your project on

, ,
Tutorial

Android LayoutInflater Turorial

In this tutorial I will show you how to use the LayoutInflater in Android.1. Make a new project (I called my project InflaterExample and my main Activity it’s called “MyActivity”) 2. Go to res – layout – main.xml and put an id called “main_layout_id” <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:orientation=”vertical” android:layout_width=”fill_parent” android:layout_height=”fill_parent” android:id=”@+id/main_layout_id”> </LinearLayout> 3. Go to res

,
Tutorial

Android Persist Data Using Shared Preferences

Most of the projects need to persist different data in order to use it in a way or another. So in this tutorial I will show you how to persist your data using Shared Preferences in Android. First you have to know that in Android, if you need to store data you have 4 options to achieve this:

, ,
Snippets, Tutorial

Android: Open the Calculator from Android using Intent

If you make an application and you need to open the calculator that comes with Android you can use the code bellow, but be careful because some Android phones might not have the Calculator installed or the name of the package and class might differ. 1. When you make the new project call your main

, ,
Snippets, Tutorial

Android Vibrate on Click

If you want to make the phone to vibrate when you click on a button from your application: 1. You have to declare in your AndroidManifest.xml the permission: <uses-permission android:name=”android.permission.VIBRATE”/> 2. Now go to the class you want to put the vibration and in onCreate put this code: final Vibrator vibe = (Vibrator) yourActivity.this.getSystemService(Context.VIBRATOR_SERVICE); //replace

, ,
Scroll to Top