Hardware components | ||||||
![]() |
| × | 1 | |||
![]() |
| × | 1 | |||
| × | 1 | ||||
| × | 4 | ||||
| × | 1 | ||||
Software apps and online services | ||||||
![]() |
| |||||
![]() |
| |||||
![]() |
|
A new year ! Lots of people takes somes news resolutions. One of them is to do sports. But few people keep their promises on the long term. So we decided to create something new, something who can help people enjoy their activities in weights rooms.
Loads cells
You can see in this picture, how the loads cells sensors are fixed and how we create a scale.

Android Sporfico App - Home page
JavaUse Sporfico app to see the evolution of your performances. Never be disappointed to see no results. With application you can have acess to informations concerning your last exercices at the gym: series, repetitions, weights used. Here is the code of the home page of the application
package com.example.viken.sporfico;
import android.app.Activity;
import android.os.Bundle;
import android.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import java.text.SimpleDateFormat;
public class Accueil extends Fragment {
private Button Go;
private TextView affluence;
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final View root = inflater.inflate(R.layout.fragment_accueil, container, false);
affluence = (TextView) root.findViewById(R.id.affluence);
Thread t = new Thread() {
@Override
public void run() {
try {
while (!isInterrupted()) {
Thread.sleep(100);
if(getActivity() == null)
return;
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
TextView tdate = (TextView) root.findViewById(R.id.date);
long date = System.currentTimeMillis();
SimpleDateFormat sdf = new SimpleDateFormat(" dd MMM yyyy");
String dateString = sdf.format(date);
tdate.setText(dateString);
}
});
}
} catch (InterruptedException e) {
}
}
};
t.start();
String msg_affluence = "Affluence = 52 personnes"; // Valeur d'affleuence rcuprer depuis la base de donne
affluence.setText(msg_affluence);
Go = (Button) root.findViewById(R.id.go_btn);
Go.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
mListener.enter_page();
}
});
return root;
}
public interface Fragment_Accueil {
// TODO: Update argument type and name
void enter_page();
}
private Fragment_Accueil mListener;
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
if (activity instanceof Fragment_Accueil) {
mListener = (Fragment_Accueil) activity;
} else {
throw new RuntimeException(activity.toString()
+ " must implement OnFragmentInteractionListener");
}
}
}
package com.example.viken.sporfico;
import android.os.Parcel;
import android.os.Parcelable;
/**
* Created by viken on 12/02/2018.
*/
public class Serie implements Parcelable {
private String id ;
private String rev ;
private String poids ;
private String repetition ;
private String userId ;
private String machineId ;
private String date ;
public Serie (String id, String rev , String poids, String repetition, String userId , String machineId, String date ){
this.id = id ;
this.rev = rev ;
this.poids = poids ;
this.repetition = repetition;
this.userId = userId ;
this.machineId = machineId ;
this.date = date ;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getRev() {
return rev;
}
public void setRev(String rev) {
this.rev = rev;
}
public String getPoids() {
return poids;
}
public void setPoids(String poids) {
this.poids = poids;
}
public String getRepetition() {
return repetition;
}
public void setRepetition(String repetition) {
this.repetition = repetition;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getMachineId() {
return machineId;
}
public void setMachineId(String machineId) {
this.machineId = machineId;
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
@Override
public String toString() {
return "Serie{" +
"_id='" + id + '\'' +
", rev='" + rev + '\'' +
", poids='" + poids + '\'' +
", repetition='" + repetition + '\'' +
", userId='" + userId + '\'' +
", machineId='" + machineId + '\'' +
", date='" + date + '\'' +
'}';
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(id);
dest.writeString(rev);
dest.writeString(poids);
dest.writeString(repetition);
dest.writeString(userId);
dest.writeString(machineId);
dest.writeString(date);
}
public static final Parcelable.Creator<Serie> CREATOR = new Parcelable.Creator<Serie>()
{
@Override
public Serie createFromParcel(Parcel source)
{
return new Serie(source);
}
@Override
public Serie[] newArray(int size)
{
return new Serie[size];
}
};
public Serie(Parcel in) {
this.id = in.readString();
this.rev = in.readString();
this.poids = in.readString();
this.repetition = in.readString();
this.userId = in.readString();
this.machineId = in.readString();
this.date = in.readString();
}
}
package com.example.viken.sporfico;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.app.Fragment;
import android.support.v7.widget.CardView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.GridLayout;
import android.widget.ListView;
import java.util.LinkedList;
import java.util.List;
public class Sport extends Fragment {
GridLayout mainGrid;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {
View root = inflater.inflate(R.layout.fragment_sport, container, false);
mainGrid = (GridLayout) root.findViewById(R.id.mainGrid);
setSingleEvent(mainGrid);
return root;
}
public void setSingleEvent(GridLayout mainGrid) {
for(int i=0;i<mainGrid.getChildCount();i++){
CardView cardView = (CardView)mainGrid.getChildAt(i);
cardView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mListener.enter_seance();
}
});
}
}
public void date_page(){
mListener.enter_seance();
}
public interface listFragmentListener {
void affiche();
void enter_seance();
}
listFragmentListener mListener;
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
try {
mListener = (Sport.listFragmentListener) activity;
} catch (ClassCastException e) {
// The activity doesn't implement the interface, throw exception
throw new ClassCastException(activity.toString() + " must implement NoticeDialogListener");
}
}
}
package com.example.viken.sporfico;
import android.os.Parcel;
import android.os.Parcelable;
public class Utilisateur implements Parcelable {
private String id;
private String rev;
private String nom;
private String prenom;
private String mdp;
public Utilisateur(String id, String rev, String nom, String prenom, String mdp) {
this.id = id;
this.rev = rev;
this.nom = nom;
this.prenom = prenom;
this.mdp = mdp;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getRev() {
return rev;
}
public void setRev(String rev) {
this.rev = rev;
}
public String getNom() {
return nom;
}
public void setNom(String nom) {
this.nom = nom;
}
public String getPrenom() {
return prenom;
}
public void setPrenom(String prenom) {
this.prenom = prenom;
}
public String getMdp() {
return mdp;
}
public void setMdp(String mdp) {
this.mdp = mdp;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(id);
dest.writeString(rev);
dest.writeString(nom);
dest.writeString(prenom);
dest.writeString(mdp);
}
public static final Parcelable.Creator<Utilisateur> CREATOR = new Parcelable.Creator<Utilisateur>()
{
@Override
public Utilisateur createFromParcel(Parcel source)
{
return new Utilisateur(source);
}
@Override
public Utilisateur[] newArray(int size)
{
return new Utilisateur[size];
}
};
public Utilisateur(Parcel in) {
this.id = in.readString();
this.rev = in.readString();
this.nom = in.readString();
this.prenom = in.readString();
this.mdp = in.readString();
}
}
package com.example.viken.sporfico;
import android.app.Fragment;
import android.app.FragmentTransaction;
import android.content.Intent;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
import org.json.JSONArray;
import org.json.JSONException;
import java.util.ArrayList;
public class MainActivity extends AppCompatActivity implements Login.Fragment_Connection, Sport.listFragmentListener, Accueil.Fragment_Accueil, Seance.listFragmentSeance{
// String server_url_user = "http://sporfico.eu-gb.mybluemix.net/get_user";
String server_url_serie = "http://sporfico.eu-gb.mybluemix.net/get_serie";
//String server_url_machine = "http://sporfico.eu-gb.mybluemix.net/get_machine";
//Utilisateur[] utilisateurs ;
Serie[] series ;
//Machine[] machines ;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final RequestQueue requestQueue = Volley.newRequestQueue(MainActivity.this);
//firstCall(requestQueue);
//secondCall(requestQueue);
//thirdCall(requestQueue);
/*SharedPreferences m = PreferenceManager.getDefaultSharedPreferences(this);
String mResponse = m.getString("Response", "");
utilisateurs = createUsers(mResponse);
Log.i("ICI -> utilisateurs", utilisateurs[0].toString());*/
/*SharedPreferences m2 = PreferenceManager.getDefaultSharedPreferences(this);
String mResponse2 = m2.getString("Response", "");
series = createSeries(mResponse2);
Log.i("ICI -> series", series[0].toString());*/
/*SharedPreferences m3 = PreferenceManager.getDefaultSharedPreferences(this);
String mResponse3 = m3.getString("Response", "");
machines = createMachines(mResponse3);*/
FragmentTransaction transaction = getFragmentManager().beginTransaction();
Login login = new Login();
/* Bundle bundle = new Bundle() ;
bundle.putParcelableArray("users",utilisateurs);
login.setArguments(bundle);*/
transaction.replace(R.id.frame, login);
transaction.addToBackStack(null);
transaction.commit();
}
/*private void sharedResponse1(String response) {
SharedPreferences m = PreferenceManager.getDefaultSharedPreferences(this);
SharedPreferences.Editor editor = m.edit();
editor.putString("Response", response);
editor.commit();
}*/
private void sharedResponse2(String response) {
SharedPreferences m = PreferenceManager.getDefaultSharedPreferences(this);
SharedPreferences.Editor editor = m.edit();
editor.putString("Response2", response);
editor.commit();
}
/*private void sharedResponse3(String response) {
SharedPreferences m = PreferenceManager.getDefaultSharedPreferences(this);
SharedPreferences.Editor editor = m.edit();
editor.putString("Response3", response);
editor.commit();
}*/
/*public void firstCall(final RequestQueue requestQueue){
StringRequest stringRequest = new StringRequest(Request.Method.GET, server_url_user, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
sharedResponse1(response);
requestQueue.stop();
} ;
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
error.printStackTrace();
requestQueue.stop();
}
});
requestQueue.add(stringRequest);
}*/
public void secondCall(final RequestQueue requestQueue){
StringRequest stringRequest = new StringRequest(Request.Method.GET, server_url_serie, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
sharedResponse2(response);
requestQueue.stop();
}
;
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
error.printStackTrace();
requestQueue.stop();
}
});
requestQueue.add(stringRequest);
}
/*
public void thirdCall(final RequestQueue requestQueue){
StringRequest stringRequest = new StringRequest(Request.Method.GET, server_url_machine, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
sharedResponse3(response);
requestQueue.stop();
}
;
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
//txtResponse.setText("First Error");
error.printStackTrace();
requestQueue.stop();
}
});
requestQueue.add(stringRequest);
}*/
@Override
public void validate(){
FragmentTransaction transaction = getFragmentManager().beginTransaction();
transaction.replace(R.id.frame, new Accueil());
transaction.addToBackStack(null);
transaction.commit();
}
public void enter_page(){
FragmentTransaction transaction = getFragmentManager().beginTransaction();
transaction.replace(R.id.frame, new Sport());
transaction.addToBackStack(null);
transaction.commit();
}
@Override
public void affiche() {
}
/*A modifier*/
public void enter_seance(){
final RequestQueue requestQueue = Volley.newRequestQueue(MainActivity.this);
secondCall(requestQueue);
SharedPreferences m2 = PreferenceManager.getDefaultSharedPreferences(this);
String mResponse2 = m2.getString("Response", "");
series = createSeries(mResponse2);
// Log.i("ICI -> series", series[0].toString());
FragmentTransaction transaction1 = getFragmentManager().beginTransaction();
Seance seance = new Seance();
Bundle bundle1 = new Bundle() ;
bundle1.putParcelableArray("series",series);
seance.setArguments(bundle1);
transaction1.replace(R.id.frame, seance);
transaction1.addToBackStack(null);
transaction1.commit();
}
public Serie[] createSeries(String response) {
Serie[] series = {};
JSONArray tab = null;
try {
tab = new JSONArray(response);
series = new Serie[tab.length()];
for (int i = 0; i < tab.length(); i++) {
String id = tab.getJSONObject(i).optString ("_id");
String _rev = tab.getJSONObject(i).optString ("_rev");
String poids = tab.getJSONObject(i).optString ("poids");
String repetitions = tab.getJSONObject(i).optString ("repetitions");
String user_id = tab.getJSONObject(i).optString ("user_id");
String machine_id = tab.getJSONObject(i).optString ("machine_id");
String date = tab.getJSONObject(i).optString ("date");
series[i] = new Serie(id,_rev,poids,repetitions,user_id,machine_id,date) ;
Log.i("series", series[i].toString()); }
} catch (JSONException e) {
e.printStackTrace();
}
return series ;
}
/* public Machine[] createMachines(String response) {
Machine[] machines = {};
JSONArray tab = null;
try {
tab = new JSONArray(response);
machines = new Machine[tab.length()];
for (int i = 0; i < tab.length(); i++) {
String id = tab.getJSONObject(i).optString ("_id");
String _rev = tab.getJSONObject(i).optString ("_rev");
String idMachine = tab.getJSONObject(i).optString ("idMachine");
String nom_machine = tab.getJSONObject(i).optString ("nom_machine");
machines[i] = new Machine(id,_rev,idMachine, nom_machine) ;
Log.i("machines", machines[i].toString()); }
} catch (JSONException e) {
e.printStackTrace();
}
return machines ;
}
/*public Utilisateur[] createUsers(String response) {
Utilisateur[] utilisateurs = {};
JSONArray tab = null;
try {
tab = new JSONArray(response);
utilisateurs = new Utilisateur[tab.length()];
for (int i = 0; i < tab.length(); i++) {
String id = tab.getJSONObject(i).optString ("_id");
String _rev = tab.getJSONObject(i).optString ("_rev");
String nom = tab.getJSONObject(i).optString ("nom");
String prenom = tab.getJSONObject(i).optString ("prenom");
String mdp = tab.getJSONObject(i).optString ("mdp");
utilisateurs[i] = new Utilisateur(id,_rev,nom, prenom, mdp) ;
Log.i("utilisateurs", utilisateurs[i].toString()); }
} catch (JSONException e) {
e.printStackTrace();
}
return utilisateurs ;
}*/
public void affiche_seance() {
enter_seance();
}
}
#include <SoftwareSerial.h>
#include <SeeedRFID.h>
#include <ESP8266HTTPClient.h>
#include <ESP8266WiFi.h>
#include <ArduinoJson.h>
#define RFID_RX_PIN D7
#define RFID_TX_PIN 12
const int irPin = D1;
int irState = 0;
int detect_t=0;
int detect_t_1=0;
int id_user;
int cpt_badge=0;
int repetition=0;
int serie=0;
int poids=50;
int etat =0;
SeeedRFID RFID(RFID_RX_PIN, RFID_TX_PIN);
int return_badge=0;
void setup() {
Serial.begin(57600);
Serial.println("RFID Test..");
pinMode(irPin, INPUT);
WiFi.begin("Xperia XA_407b", "Makyuusen3"); //WiFi connection
while (WiFi.status() != WL_CONNECTED) { //Wait for the WiFI connection completion
delay(500);
Serial.println("Waiting for connection");}
}
//------------- BADGE --------------------
void badge_on(){
if(RFID.isAvailable()){
if((RFID.cardNumber())==(id_user)) {
cpt_badge=0;
Serial.println("Badge off");
return_badge=0; return ;
}
if((cpt_badge%2)==0) {
cpt_badge=1;
id_user=RFID.cardNumber();
Serial.println("Badge on");
Serial.println(id_user);
return_badge=1; return ;
}
else{
Serial.println("Machine occupe");
/*return_badge=0;*/ return ;
}
}
}
//------------- REPETITION --------------------
void incre_repetition(){
repetition++;
}
//------------- SERIE --------------------
void new_serie(){
serie++;
}
//------------- RESET SERIE --------------------
void reset_serie(){
// serie=0;
repetition=0;
irState = 0;
detect_t=0;
detect_t_1=0;
id_user=0;
}
//------------- INFRAROUGE --------------------
int detect_infrarouge(){
irState= digitalRead(irPin);
//if(irState == LOW)
//return 1;
//else
//return 0;
detect_t_1=detect_t;
if (irState == LOW)
detect_t=1;
else
detect_t=0;
if((detect_t==1)&&(detect_t_1==0))
return 1;
else
return 0;
}
//---------------sendtram---------------------
/*void send_tram_serie(){
Serial.println( serie );
Serial.println("poids = 50");
Serial.println(repetition );
Serial.println( id_user );
Serial.println(" machine = 1, date = test");
}*/
void send_tram_serie(){
if(WiFi.status()== WL_CONNECTED){ //Check WiFi connection status
HTTPClient http; //Declare object of class HTTPClient
http.begin("http://sporfico.eu-gb.mybluemix.net/serie"); //Specify request destination
http.addHeader("Content-Type", "application/json"); //Specify content-type header
String payload = "{";
// payload += "\"_id\":";
// payload += serie;
payload += "\"poids\":";
payload += poids;
payload += ", \"repetitions\":";
payload += repetition;
payload += ", \"user_id\":";
payload += id_user;
payload += ", \"machine_id\":"; //pour l'instant 1 seule adapter
payload += 1;
payload += ", \"date\":\"test\"";
payload += "}";
Serial.print("Sending payload: ");
Serial.println(payload);
int httpCode = http.POST(payload); //Send the request
payload = http.getString(); //Get the response payload
Serial.println(httpCode); //Print HTTP return code
Serial.println(payload);
}
}
//------------ AUTOMATE ----------------------
void loop() {
//if(detect_infrarouge())
switch (etat) {
case 0 :
// Serial.println("case 0: Attente Utilisateur");
badge_on();
if(return_badge)
etat = 1;
break;
case 1:
//Serial.println("case 1");
//get_poids_max();
//get_user();
//send_heure_co();
etat = 2;
break;
case 2:
//Serial.println("case 2");
if(detect_infrarouge())
etat = 3;
badge_on();
if(!return_badge)
etat=6;
break;
case 3:
//Serial.println("case 3");
//get_poids_restant();
//calcul_poids_utilise();
new_serie();
etat=4;
break;
case 4:
Serial.println("Case 4: Repetition");
incre_repetition();
etat=5;
break;
case 5:
// Serial.println("case 5");
if(detect_infrarouge()){
etat=4;}
badge_on();
if(!return_badge)
etat=6;
break;
case 6:
Serial.println("case 6: Envoie trame vers Base de donne...");
send_tram_serie();
// badge_on();
// if(return_badge)
//etat=2;
//else{
//send_heure_deco();
reset_serie();
etat=0;
//}
break;
}
}
package com.example.viken.sporfico;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.nfc.Tag;
import android.os.Bundle;
import android.app.Fragment;
import android.os.Parcelable;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import com.android.volley.RequestQueue;
import com.android.volley.toolbox.Volley;
import java.util.ArrayList;
import java.util.List;
import static android.content.ContentValues.TAG;
public class Login extends Fragment {
EditText username;
EditText password;
Button loginButton;
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View root = inflater.inflate(R.layout.fragment_login, container, false);
username = (EditText) root.findViewById(R.id.etUsername);
password = (EditText) root.findViewById(R.id.etPassword);
loginButton = (Button) root.findViewById(R.id.bLogin);
//Log.i("IIIIIIIIIIIIIIIIIIIIIIIIIII", name.toString());
/* Intent intent = getActivity().getIntent();
Bundle simBundle = intent.getExtras();
Utilisateur[] users = (Utilisateur[]) simBundle.get("users") ;*/
//Parcelable[] users = intent.getParcelableExtra("users");
//Log.i("IIIIIIIIIIIIIIIIIIIIIIIIIII", list.toString());
loginButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
//login();
//Bundle bundle = getArguments() ;
//Utilisateur[] users = (Utilisateur[]) bundle.getParcelableArray("users");
final String uname = username.getText().toString();
final String upwd = password.getText().toString();
//for(int i = 0 ; i < users.length ; i++){
/* if (uname.equals(users[i].getNom()) && upwd.equals(users[i].getMdp())){
login();
}*/
if((uname.equals("Admin")) && (upwd.equals("1234"))){
login();
}
//}
}
});
return root;
}
public void login() {
// Required empty public constructor
//loginButton.setEnabled(false);
//final String uname = username.getText().toString();
//final String upwd = password.getText().toString();
//if (uname.equals("Admin") && upwd.equals("1234"))
Frag1.validate();
}
public interface Fragment_Connection {
void validate();
}
Fragment_Connection Frag1;
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
try {
Frag1 = (Fragment_Connection) activity;
}
catch (ClassCastException e) {
throw new ClassCastException(activity.toString() + " must implement NoticeDialogListener");
}
}
}
package com.example.viken.sporfico;
import android.os.Parcel;
import android.os.Parcelable;
/**
* Created by viken on 02/02/2018.
*/
public class Machine implements Parcelable {
private String id;
private String rev;
private String idMachine;
private String nom_machine;
public Machine(String id, String rev, String idMachine, String nom_machine) {
this.id = id;
this.rev = rev;
this.idMachine = idMachine;
this.nom_machine = nom_machine;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getRev() {
return rev;
}
public void setRev(String rev) {
this.rev = rev;
}
public String getIdMachine() {
return idMachine;
}
public void setIdMachine(String idMachine) {
this.idMachine = idMachine;
}
public String getNom_machine() {
return nom_machine;
}
public void setNom_machine(String nom_machine) {
this.nom_machine = nom_machine;
}
@Override
public String toString() {
return "Machine{" +
"id='" + id + '\'' +
", rev='" + rev + '\'' +
", idMachine='" + idMachine + '\'' +
", nom_machine='" + nom_machine + '\'' +
'}';
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(id);
dest.writeString(rev);
dest.writeString(idMachine);
dest.writeString(nom_machine);
}
public static final Parcelable.Creator<Machine> CREATOR = new Parcelable.Creator<Machine>()
{
@Override
public Machine createFromParcel(Parcel source)
{
return new Machine(source);
}
@Override
public Machine[] newArray(int size)
{
return new Machine[size];
}
};
public Machine(Parcel in) {
this.id = in.readString();
this.rev = in.readString();
this.idMachine = in.readString();
this.nom_machine = in.readString();
}
}
package com.example.viken.sporfico;
import android.app.Activity;
import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import android.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;
public class Seance extends Fragment {
TextView seance;
TextView serie;
TextView repetition;
TextView poids;
public Seance() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// Inflate the layout for this fragment
View root = inflater.inflate(R.layout.fragment_seance, container, false);
/* seance = (TextView) root.findViewById(R.id.Seance);
serie = (TextView) root.findViewById(R.id.Serie);
repetition = (TextView) root.findViewById(R.id.Repetition);
poids = (TextView) root.findViewById(R.id.Poids);
Bundle bundle = getArguments() ;
Serie[] series = (Serie[]) bundle.getParcelableArray("series");
String inter_seance = new String(series[1].getRev());
String inter_serie = new String(series[1].getId());
String inter_repetition = new String(series[1].getRepetition());
String inter_poids = new String(series[1].getPoids());
Log.i("!!!!!!!!!!!!!!!!!!!!series", inter_repetition.toString());
seance.setText(inter_seance);
serie.setText(inter_serie);
repetition.setText(inter_repetition);
poids.setText(inter_poids);*/
return root;
}
public interface listFragmentSeance {
void affiche_seance();
}
listFragmentSeance Seance1;
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
try {
Seance1 = (listFragmentSeance) activity;
}
catch(ClassCastException e){
throw new RuntimeException(activity.toString() + " must implement OnFragmentInteractionListener");
}
}
}
Comments