Example usage for android.util Log i

List of usage examples for android.util Log i

Introduction

In this page you can find the example usage for android.util Log i.

Prototype

public static int i(String tag, String msg) 

Source Link

Document

Send an #INFO log message.

Usage

From source file:me.willowcheng.makerthings.model.OpenHABWidgetDataSource.java

public void setSourceNode(Node rootNode) {
    Log.i(TAG, "Loading new data");
    if (rootNode == null)
        return;//from  w  ww .  java  2 s. com
    rootWidget = new OpenHABWidget();
    rootWidget.setType("root");
    if (rootNode.hasChildNodes()) {
        NodeList childNodes = rootNode.getChildNodes();
        for (int i = 0; i < childNodes.getLength(); i++) {
            Node childNode = childNodes.item(i);
            if (childNode.getNodeName().equals("widget")) {
                new OpenHABWidget(rootWidget, childNode);
            } else if (childNode.getNodeName().equals("title")) {
                this.setTitle(childNode.getTextContent());
            } else if (childNode.getNodeName().equals("id")) {
                this.setId(childNode.getTextContent());
            } else if (childNode.getNodeName().equals("icon")) {
                this.setIcon(childNode.getTextContent());
            } else if (childNode.getNodeName().equals("link")) {
                this.setLink(childNode.getTextContent());
            }
        }
    }
}

From source file:com.swetha.easypark.EasyParkHttpClient.java

/** 
 * @param url of the website and the post request
 * @return http response in string */
public static String executeHttpPost(String url, ArrayList<NameValuePair> postParameters) throws Exception {

    BufferedReader in = null;/*w  w w  .ja  va 2s . c  om*/

    try {

        HttpClient client = getHttpClient();

        HttpPost request = new HttpPost(url);

        UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(

                postParameters);

        request.setEntity(formEntity);
        Log.i("CustomHttpClient", "before sending request" + request);
        HttpResponse response = client.execute(request);
        Log.i("CustomHttpClient", "after sending request" + response.toString());
        //Log.i("CustomHttpClient", "after sending request response in to string" +response.getEntity().getContent().toString());

        in = new BufferedReader(new InputStreamReader(response.getEntity()

                .getContent()));

        StringBuffer sb = new StringBuffer("");

        String line = "";

        String NL = System.getProperty("line.separator");

        while ((line = in.readLine()) != null) {

            sb.append(line + NL);

        }

        in.close();

        String result = sb.toString();

        return result;

    }

    finally {

        if (in != null) {

            try {

                in.close();

            } catch (IOException e) {

                Log.e("log_tag", "Error converting result " + e.toString());

                e.printStackTrace();

            }

        }
    }

}

From source file:com.notifry.android.C2DMReceiver.java

public void onRegistered(Context context, String registration) throws IOException {
    Log.i("Notifry", "registered and got key: " + registration);

    // Dispatch this to the updater service.
    Intent intentData = new Intent(getBaseContext(), UpdaterService.class);
    intentData.putExtra("type", "registration");
    intentData.putExtra("registration", registration);
    startService(intentData);/*from   w  ww .  ja v a  2s  .  co  m*/

    // Clear any errors we had.
    SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context);
    Editor editor = settings.edit();
    editor.putString("dm_register_error", "");
    editor.commit();

    // Update the home screen.
    Intent updateUIIntent = new Intent(Notifry.UPDATE_INTENT);
    context.sendBroadcast(updateUIIntent);
}

From source file:com.fabula.android.timeline.sync.ServerDownloader.java

/**
 * Method that gets all the {@link Experiences} from the server.
 * Some grinding of the data has to be done in this method, as events are downloaded
 * as {@link BaseEvent}s. This method converts the {@link BaseEvent}s into its right subclass
 * based on the className attribute./*from  ww  w .  ja v  a  2 s  .  c  om*/
 * 
 * @param user
 * @return
 */
protected static Experiences getAllSharedExperiencesFromServer(User user) {

    try {
        Log.i("DOWNLOADER", "Json Parser started.. Getting all Experiences");
        GsonBuilder gsonB = new GsonBuilder();
        gsonB.registerTypeAdapter(EventItem.class, new Deserializers.EventItemDeserializer());
        gsonB.serializeNulls();

        Gson gson = gsonB.create();

        Reader r = new InputStreamReader(getJSONData("/rest/experiences/" + user.getUserName() + "/"));
        Experiences experiences = gson.fromJson(r, Experiences.class);

        if (experiences.getExperiences() != null) {

            for (Experience experience : experiences.getExperiences()) {
                List<BaseEvent> baseEvents = new ArrayList<BaseEvent>();
                if (experience.getEvents() != null) {
                    for (BaseEvent be : experience.getEvents()) {
                        Location location = new Location("");
                        location.setLatitude(be.getLatitude());
                        location.setLongitude(be.getLongitude());
                        if (be.getClassName().equals(Event.class.getSimpleName())) {
                            Event event = new Event(be.getId(), be.getExperienceid(),
                                    new Date(be.getDatetimemillis()), location, be.getUser());
                            event.setEmotionList(be.getEmotionList());
                            event.setEventItems(be.getEventItems());
                            event.setShared(be.isShared());
                            baseEvents.add(event);
                        } else if (be.getClassName().equals(MoodEvent.class.getSimpleName())) {
                            MoodEvent me = new MoodEvent(be.getId(), be.getExperienceid(),
                                    new Date(be.getDatetimemillis()), location,
                                    MoodEnum.getType(be.getMoodX(), be.getMoodY()), be.getUser());
                            me.setShared(true);
                            me.setAverage(be.isAverage());
                            baseEvents.add(me);
                        }
                    }
                }
                experience.setEvents(baseEvents);
            }
        }
        Log.i("DOWNLOADER", "Fetched " + experiences.getExperiences().size() + " experiences");
        return experiences;
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }

}

From source file:com.demo.koolcloud.mvptest.interactors.LoginInteractorImpl.java

@Override
public void login(final String username, final String password, final OnLoginFinishedListener listener) {
    // Mock login. I'm creating a handler to delay the answer a couple of seconds
    new Handler().postDelayed(new Runnable() {
        @Override/*w w w  .j av a 2 s. c o  m*/
        public void run() {
            Log.i("LoginInteractorImpl", "login");
            boolean error = false;
            if (TextUtils.isEmpty(username)) {
                listener.onUsernameError();
                error = true;
            }
            if (TextUtils.isEmpty(password)) {
                listener.onPasswordError();
                error = true;
            }
            if (!error) {
                SmartPosServices service = SmartPosServices.getInstance(App.getContext());
                JSONObject loginResult = service.login("teddy", "123456", "999290053110041");
                Log.d("LoginInteractorImpl", loginResult.toString());

                JSONObject jsonData = JsonUtil.getResponseData(loginResult);
                if (null != jsonData) {
                    int responseCode = jsonData.optInt("responseCode");
                    if (responseCode == 0) {
                        listener.onSuccess();
                    } else {
                        listener.onError();
                        ;
                    }
                }
            }
        }
    }, 500);
}

From source file:ca.ualberta.cs.swapmyride.Misc.SaveUserRunnable.java

public SaveUserRunnable(final User user, final String url) {
    this.user = user;
    this.url = url + "users/" + user.getUserName();
    Log.i("NetworkDataManager", this.url);
}

From source file:io.github.data4all.handler.TagSuggestionHandler.java

/**
 * /*from www . ja v  a 2s .c o m*/
 * @param location
 */
public static void setLocation(Location location) {
    Log.i(TAG, "setLocation: " + location);
    TagSuggestionHandler.location = location;
    final int myId = ++id;
    new Thread(new Runnable() {
        public void run() {
            lastSuggestions = null;
            List<Address> suggestions = getSuggestion();
            if (myId == id) {
                lastSuggestions = suggestions;
                Log.i(TAG, "suggestions set");
            }
        }
    }).start();
}

From source file:se.chalmers.watchme.net.HttpRetriever.java

/**
 * Send a GET request to a URL./*from w w  w  . j av a 2  s .c o m*/
 * 
 * <p>
 * The <code>url</code> parameter must be well formatted, as no validations
 * are made in this method.
 * </p>
 * 
 * @param url
 *            The url
 * @return String with the response on success, otherwise null
 * @throws {@link IOException} if the HTTP connection failed
 * @throws NoEntityException
 *             if no HttpEntity was available in the response
 */
public String get(String url) throws IOException, NoEntityException {

    HttpGet request = new HttpGet(url);

    HttpResponse res = this.client.execute(request);
    final int statusCode = res.getStatusLine().getStatusCode();

    Log.i("Custom", "Retrieving " + url + ", status: " + statusCode);

    // Return null if the status code isn't 200 OK
    if (statusCode != HttpStatus.SC_OK) {
        return null;
    }

    HttpEntity entity = res.getEntity();

    // Return a stringified version of the response
    if (entity != null) {
        return EntityUtils.toString(entity);
    } else {
        throw new NoEntityException("No entity from " + url);
    }
}

From source file:com.distimo.sdk.Utils.java

static String md5(String s) {
    if (Utils.DEBUG) {
        Log.i(TAG, "md5()");
    }/*ww w.  j a va 2  s.  c o  m*/

    String result = "";

    MessageDigest m = null;
    try {
        m = MessageDigest.getInstance("MD5");
        m.update(s.getBytes(), 0, s.length());
        result = byteArrayToHexString(m.digest());
    } catch (final NoSuchAlgorithmException nsae) {
        if (Utils.DEBUG) {
            nsae.printStackTrace();
        }
    }

    return result;
}

From source file:ca.ualberta.cs.swapmyride.Misc.SavePhotoRunnable.java

public SavePhotoRunnable(final Photo photo, final String url) {
    this.photo = photo;
    this.url = url + "photos/" + photo.getUid().getID();
    Log.i("NetworkDataManager", this.url);
}