Projet android par etapes : Applications EarthQuake
By admin • nov 22nd, 2009 • Category: TutorialsLes grandes etapes de projets:
- Demarrer un projet adroid, creer des classes
- Utiliser un adpater pour afficher des infos dans une Lsitview
- effectuer la mise a jour via un site web
- 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:
admin is
Email this author | All posts by admin
