Communauté française android news, news du Web et bien d'autres domaines

telephones, smart phones android, programmation et applications, news twitter facebook

Projet android par etapes : Applications EarthQuake

By • nov 22nd, 2009 • Category: Tutorials

Les grandes etapes de projets:

  1. Demarrer un projet adroid, creer des classes
  2. Utiliser un adpater pour afficher des infos dans une Lsitview
  3. effectuer  la mise a jour via un site web
  4. Transfomer l’application en service

1) Etape 1

On suppose que la création d’un projet ne vous pose pas de problemes et dans ce cas on attaque directment le code :

Ceci est une simple classe qui contient des informations relatives a claque tremblement de Terre: ces infos seront affichees dans une ListView

package com.almassa.Earthquake;
import java.text.SimpleDateFormat;
import java.util.Date;
 
import android.location.Location;
 
/***
 * class sued to store all information about an earhquake
 * @author adam
 *
 */
 
public class Quake {
 
	private Date mDate;
	private String mDetails;
	private Location mLocation;
	private double mMagnitude;
	private String mLink;
 
	// Getters
 
	public Date getDate(){ return mDate;}
	public String getDetails(){return mDetails;}
	public Location getLocation(){return mLocation;}
	public double getMagnitude(){return mMagnitude;}
	public String getLink(){return mLink;}
 
	// Constructor
	public Quake(Date date, String details, Location location, double magnitude, String link){
		mDate = date;
		mDetails = details;
		mLocation = location;
		mMagnitude = magnitude;
		mLink = link;
	}
 
	// tostirng method
	@Override
	public String toString(){
		SimpleDateFormat sd = new SimpleDateFormat("HH:mm");
		String dateformat = sd.format(mDate);
		return dateformat+" : "+ mMagnitude+" "+mDetails;
	}
}

A voir aussi:

  1. Earthquake suite du projet android
  2. Suite projet Erathquake : les preferences
  3. Services sous android Leçon 1
  4. ABI Research: le marché des applications d’iphone sur le point de sombrer, Android sur la route du profit

is
Email this author | All posts by

Comments are closed.