List of usage examples for android.util Log w
public static int w(String tag, Throwable tr)
From source file:org.ounl.lifelonglearninghub.learntracker.gis.ou.db.ws.ActivityWSDeleteAsyncTask.java
public int deleteActivities(long lCheckIn, String sUserId) { // e.g. query // https://lifelong-learning-hub.appspot.com/_ah/api/activityendpoint/v1/activity/checkin/{activity_date_checkin}/user/{user_id} // e.g. query // https://lifelong-learning-hub.appspot.com/_ah/api/activityendpoint/v1/activity/checkin/867232233232/user/Bernd InputStream is = null;/*from w w w .ja v a2s.c o m*/ String url = Session.getSingleInstance().getWSPath() + "/_ah/api/activityendpoint/v1/activity/checkin/" + lCheckIn + "/user/" + sUserId; try { Log.d(CLASSNAME, " Querying to backend deleteActivities check in:" + lCheckIn + " user:" + sUserId); HttpClient httpclient = new DefaultHttpClient(); HttpDelete httpdelete = new HttpDelete(url); HttpResponse response = httpclient.execute(httpdelete); // HttpGet httpget = new HttpGet(url); // HttpResponse response = httpclient.execute(httpget); final int statusCode = response.getStatusLine().getStatusCode(); if (statusCode != HttpStatus.SC_OK) { Log.w(getClass().getSimpleName(), "Error " + statusCode + " for URL " + url); return 0; } HttpEntity entity = response.getEntity(); is = entity.getContent(); Log.d(CLASSNAME, "deleteActivities returns [" + is.toString() + "]"); } catch (Exception e) { Log.e(CLASSNAME, "Error in http connection " + e.toString()); } // TODO this method should return the numer of items deleted in backend // Issue 15 // https://code.google.com/p/lifelong-learning-hub/issues/detail?id=15 return 1; }
From source file:org.ounl.lifelonglearninghub.learntracker.gis.ou.db.ws.ActivityCourseWSGetAsyncTask.java
public List<ActivityDO> listActivities(String sCourseId) { // https://lifelong-learning-hub.appspot.com/_ah/api/activityendpoint/v1/activity/course/N35231 // listActivityCourse method in backend InputStream is = null;//ww w.j ava 2 s .co m String url = Session.getSingleInstance().getWSPath() + "/_ah/api/activityendpoint/v1/activity/course/" + sCourseId; try { Log.d(CLASSNAME, " Querying to backend listActivities for course:" + sCourseId); HttpClient httpclient = new DefaultHttpClient(); HttpGet httpget = new HttpGet(url); HttpResponse response = httpclient.execute(httpget); final int statusCode = response.getStatusLine().getStatusCode(); if (statusCode != HttpStatus.SC_OK) { Log.w(getClass().getSimpleName(), "Error " + statusCode + " for URL " + url); return null; } HttpEntity entity = response.getEntity(); is = entity.getContent(); } catch (Exception e) { Log.e(CLASSNAME, "Error in http connection " + e.toString()); } Reader reader = new InputStreamReader(is); Gson gson = new Gson(); ActivityDOList r = gson.fromJson(reader, ActivityDOList.class); List<ActivityDO> activities = r.activities; return activities; }
From source file:com.socialize.util.ImageUtils.java
private InputStream retrieveStream(Uri url) { String path = url == null ? null : url.getPath(); if (path == null) { Log.w(getClass().getSimpleName(), "Error in received url: it's null => " + url); return null; } else {/* w w w . j av a 2 s . c o m*/ Log.w(getClass().getSimpleName(), "Path to the picture received => " + path); } DefaultHttpClient client = new DefaultHttpClient(); HttpGet httpRequest = new HttpGet(path); try { HttpResponse httpResponse = client.execute(httpRequest); final int statusCode = httpResponse.getStatusLine().getStatusCode(); if (statusCode != HttpStatus.SC_OK) { Log.w(getClass().getSimpleName(), "Error => " + statusCode + " => for URL " + url); return null; } HttpEntity httpEntity = httpResponse.getEntity(); return httpEntity.getContent(); } catch (IOException e) { httpRequest.abort(); Log.w(getClass().getSimpleName(), "Error for URL =>" + url, e); } return null; }
From source file:com.fine47.http.AbstractResponseWrapper.java
@Override public void onCancel() { if (ActivityHttpClient.isDebugging()) { Log.w(ActivityHttpClient.LOG_TAG, "Request cancelled for URL: " + request.url); }/*from w ww. j a v a 2s. c o m*/ }
From source file:org.mythtv.service.myth.v25.HostHelperV25.java
public List<String> process(final Context context, final LocationProfile locationProfile) { Log.v(TAG, "process : enter"); if (!NetworkHelper.getInstance().isMasterBackendConnected(context, locationProfile)) { Log.w(TAG, "process : Master Backend '" + locationProfile.getHostname() + "' is unreachable"); return null; }// ww w . j a v a2 s. c om mMythServicesTemplate = (MythServicesTemplate) MythAccessFactory.getServiceTemplateApiByVersion(mApiVersion, locationProfile.getUrl()); if (null == mMythServicesTemplate) { Log.w(TAG, "process : Master Backend '" + locationProfile.getHostname() + "' is unreachable"); return null; } List<String> hosts = null; try { hosts = downloadHosts(locationProfile); } catch (Exception e) { Log.e(TAG, "process : error", e); hosts = null; } Log.v(TAG, "process : exit"); return hosts; }
From source file:com.layer.atlas.cells.GeoCell.java
@Override public View onBind(final ViewGroup cellContainer) { ViewGroup cellRoot = (ViewGroup) Tools.findChildById(cellContainer, R.id.atlas_view_messages_cell_geo); if (cellRoot == null) { cellRoot = (ViewGroup) LayoutInflater.from(cellContainer.getContext()) .inflate(R.layout.atlas_view_messages_cell_geo, cellContainer, false); if (debug) Log.w(TAG, "geo.onBind() inflated geo cell"); }// w w w. j a va 2 s .c o m ImageView geoImageMy = (ImageView) cellRoot.findViewById(R.id.atlas_view_messages_cell_geo_image_my); ImageView geoImageTheir = (ImageView) cellRoot.findViewById(R.id.atlas_view_messages_cell_geo_image_their); View containerMy = cellRoot.findViewById(R.id.atlas_view_messages_cell_geo_container_my); View containerTheir = cellRoot.findViewById(R.id.atlas_view_messages_cell_geo_container_their); boolean myMessage = messagesList.getLayerClient().getAuthenticatedUserId() .equals(messagePart.getMessage().getSender().getUserId()); if (myMessage) { containerMy.setVisibility(View.VISIBLE); containerTheir.setVisibility(View.GONE); } else { containerMy.setVisibility(View.GONE); containerTheir.setVisibility(View.VISIBLE); } ImageView geoImage = myMessage ? geoImageMy : geoImageTheir; ShapedFrameLayout cellCustom = (ShapedFrameLayout) (myMessage ? containerMy : containerTheir); Object imageId = messagePart.getId(); Bitmap bmp = (Bitmap) Atlas.imageLoader.getImageFromCache(imageId); if (bmp != null) { if (debug) Log.d(TAG, "geo.onBind() bitmap: " + bmp.getWidth() + "x" + bmp.getHeight()); geoImage.setImageBitmap(bmp); } else { if (debug) Log.d(TAG, "geo.onBind() spec: " + spec); geoImage.setImageDrawable(Tools.EMPTY_DRAWABLE); // schedule image File tileFile = getTileFile(cellContainer.getContext()); if (tileFile.exists()) { if (debug) Log.d(TAG, "geo.onBind() decodeImage: " + tileFile); // request decoding spec = Atlas.imageLoader.requestImage(imageId, new Atlas.FileStreamProvider(tileFile), (int) Tools.getPxFromDp(150, cellContainer.getContext()), (int) Tools.getPxFromDp(150, cellContainer.getContext()), false, this); } else { int width = 300; int height = 300; int zoom = 16; final String url = new StringBuilder().append("https://maps.googleapis.com/maps/api/staticmap?") .append("format=png32&").append("center=").append(lat).append(",").append(lon).append("&") .append("zoom=").append(zoom).append("&").append("size=").append(width).append("x") .append(height).append("&").append("maptype=roadmap&").append("markers=color:red%7C") .append(lat).append(",").append(lon).toString(); Atlas.downloadQueue.schedule(url, tileFile, this); if (debug) Log.d(TAG, "geo.onBind() show stub and download image: " + tileFile); } } // clustering cellCustom.setCornerRadiusDp(16, 16, 16, 16); if (AtlasMessagesList.CLUSTERED_BUBBLES) { if (myMessage) { if (this.clusterHeadItemId == this.clusterItemId && !this.clusterTail) { cellCustom.setCornerRadiusDp(16, 16, 2, 16); } else if (this.clusterTail && this.clusterHeadItemId != this.clusterItemId) { cellCustom.setCornerRadiusDp(16, 2, 16, 16); } else if (this.clusterHeadItemId != this.clusterItemId && !this.clusterTail) { cellCustom.setCornerRadiusDp(16, 2, 2, 16); } } else { if (this.clusterHeadItemId == this.clusterItemId && !this.clusterTail) { cellCustom.setCornerRadiusDp(16, 16, 16, 2); } else if (this.clusterTail && this.clusterHeadItemId != this.clusterItemId) { cellCustom.setCornerRadiusDp(2, 16, 16, 16); } else if (this.clusterHeadItemId != this.clusterItemId && !this.clusterTail) { cellCustom.setCornerRadiusDp(2, 16, 16, 2); } } } return cellRoot; }
From source file:com.lightbox.android.webservices.processors.JacksonProcessor.java
public T parse(Class<T> parsedClass, InputStream source, boolean useNamingStrategy) throws ParsingException { T parsedObject = null;/*ww w . j a va 2 s. co m*/ try { ObjectMapper objectMapper = useNamingStrategy ? sObjectMapper : sObjectMapperWithoutNamingStrategy; parsedObject = objectMapper.readValue(source, parsedClass); } catch (JsonParseException e) { Log.w(TAG, e); throw new ParsingException(e); } catch (JsonMappingException e) { Log.w(TAG, e); throw new ParsingException(e); } catch (IOException e) { Log.w(TAG, e); throw new ParsingException(e); } return parsedObject; }
From source file:org.mythtv.service.myth.v25.StorageGroupHelperV25.java
public List<StorageGroupDirectory> process(final Context context, final LocationProfile locationProfile, String storageGroupName) { Log.v(TAG, "process : enter"); if (!NetworkHelper.getInstance().isMasterBackendConnected(context, locationProfile)) { Log.w(TAG, "process : Master Backend '" + locationProfile.getHostname() + "' is unreachable"); return null; }//from w w w. j a v a 2s .co m mMythServicesTemplate = (MythServicesTemplate) MythAccessFactory.getServiceTemplateApiByVersion(mApiVersion, locationProfile.getUrl()); List<StorageGroupDirectory> storageGroupDirectories = null; try { storageGroupDirectories = downloadStorageGroups(locationProfile, storageGroupName); } catch (Exception e) { Log.e(TAG, "process : error", e); storageGroupDirectories = null; } Log.v(TAG, "process : exit"); return storageGroupDirectories; }
From source file:com.funzio.pure2D.ui.UIManager.java
public void setContext(final Context context) { Log.w(TAG, "setContext(): " + context); mContext = context;// ww w . j av a 2s. c om if (context != null) { mResources = context.getResources(); mPackageName = context.getApplicationContext().getPackageName(); } else { mTextureManager = null; } }
From source file:org.umit.icm.mobile.connectivity.ServiceHTTP.java
/** * Returns a an HTTP Response String.// w w w.j a v a 2 s . c om * * @return String * @see HttpClient */ @Override public String connect() { HttpClient httpClient = new DefaultHttpClient(); HttpGet httpGet = new HttpGet(getServiceURL()); try { HttpResponse httpResponse = httpClient.execute(httpGet); StatusLine statusLine = httpResponse.getStatusLine(); if (statusLine.getStatusCode() != 200) { return "blocked"; } HttpEntity httpEntity = httpResponse.getEntity(); InputStream inputStream = httpEntity.getContent(); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); int bytes = 0; byte[] buffer = new byte[1024]; while ((bytes = inputStream.read(buffer)) != -1) { byteArrayOutputStream.write(buffer, 0, bytes); } if (new String(byteArrayOutputStream.toByteArray()) != null) return "normal"; else return "blocked"; } catch (IOException e) { Log.w("ServiceHTTPException: ", e.getLocalizedMessage()); return "blocked"; } }