Skip to content
Snippets Groups Projects
Commit 0d756864 authored by MAUGEZ Emeline's avatar MAUGEZ Emeline
Browse files

On remet tout dans le bon ordre

parent 6b6f381d
No related branches found
No related tags found
No related merge requests found
......@@ -86,21 +86,18 @@ public class AdminMajListIngredientActivity extends Activity {
}
public void receiveNewData(String msg){
public void receiveNewData(){
//Contient id_ingredient, id_bec, nom_ingrédient
Ingredients.getInstance().MiseAJour(msg);
fillListViewIngredients(AdminMajListIngredientActivity.this, mListView, Ingredients.getInstance().ings);
IngredientArrayAdapter adapter = (IngredientArrayAdapter)(mListView.getAdapter());
adapter.notifyDataSetChanged();
Log.d("Ingredients", msg);
}
private BroadcastReceiver broadcastReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
Log.d("Receive something", "receive");
String msg = intent.getStringExtra("message");
receiveNewData(msg);
receiveNewData();
}
};
......
package com.example.robotise.model;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import com.example.robotise.ble.DeviceControl;
......@@ -34,7 +36,7 @@ public class Ingredients {
* Permet de parser les données
* @param msg
*/
public void MiseAJour(String msg){
public void MiseAJour(String msg, Context ctxt){
//Contient id_ingredient, id_bec, nom_ingrédient
Log.d("Recette", "debut maj");
String[] listeIngredients = msg.split("/");
......@@ -52,6 +54,9 @@ public class Ingredients {
}
//Pour mettre à jour si elle existe déjà la page de la liste des ingrédients
Intent signalIntent = new Intent("Update Ingredients");
ctxt.sendBroadcast(signalIntent);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment