Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //File Name : ServiceTask.java
- package com.mycompany.myapp.services;
- /**
- *
- *@author
- */
- public class ServiceTask {
- //creer une variable pour le resultat d'ajout
- public boolean resultOK;
- //Creer la methode addTask
- public boolean addTask(Task t) {
- String url = Statics.BASE_URL+"/tasks/"+t.getName()+"/"+t.getStatus();
- ConnectionRequest req = new ConnectionRequest(url);
- req.addResponseListener(new ActionListeneer<NetworkEvent>() {
- @Override
- public void actionPerformed(NetworkEvent evt) {
- //ajouter une action à la reception de la reponse
- //verifier le status de la reponse
- resultOK = req.getResponseCode() == 200; //code HTTP 200 OK
- }
- });
- NetworkManager.getInstance().addToQueueAndWait(req);
- return resultOK;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment