List of usage examples for android.util Log i
public static int i(String tag, String msg)
From source file:ca.tbcn.greenp.GreenParkingApp.java
/** * Load carparks by reading JSON, then populating carparks * /*from www. java2s. co m*/ * @param context * @return */ private static void loadCarparks(Context context) { Log.i(TAG, "Loading JSON"); // Get the JSON JSONObject json = GreenParkingApp.getCarparksJson(context); Log.i(TAG, "Populating carparksArray"); // Parse the JSON carparks = new ArrayList<Carpark>(); if (json != null) { try { JSONArray carparksJson = json.getJSONArray("carparks"); for (int i = 0; i < carparksJson.length(); i++) { JSONObject carpark = carparksJson.getJSONObject(i); carparks.add(Carpark.fromJSON(carpark)); } } catch (JSONException e) { e.printStackTrace(); } } Log.i(TAG, "Done populating carparks"); }
From source file:Main.java
/** * decide use XLOG or android default log * @param tag log tag//from w w w . j av a 2 s. co m * @param msg log info message * @return log level */ public static int i(String tag, String msg) { return /*XLOG_ON ? Xlog.i(tag, msg) : */Log.i(tag, msg); }
From source file:com.vic.rxnetsdk.RxSubscriber.java
@Override public void onCompleted() { Log.i(TAG, "onCompleted()"); }
From source file:Main.java
public static void logInfo(String clase, String method, String texto) { if (INFO)/*from w w w . java 2 s.c om*/ Log.i(clase + " :: " + String.valueOf(method), String.valueOf(texto)); }
From source file:com.jaguarlandrover.auto.remote.vehicleentry.LockActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.i(TAG, "onCreate() Activity"); handleExtra(getIntent());/*from www .ja v a 2 s . c om*/ keyCheck = new Handler(); request = new Handler(); guestServiceCheck = new Handler(); setContentView(R.layout.activity_lock); lock_fragment = (LockActivityFragment) getFragmentManager().findFragmentById(R.id.fragmentlock); startRepeatingTask(); }
From source file:com.bjorsond.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./* w ww . ja va2 s. com*/ * * @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:org.zywx.wbpalmstar.engine.eservice.EServiceTest.java
public static void test() { String realyPath = "http://localhost:8000/other.QDV"; HttpRequestBase mHhttpRequest = new HttpGet(realyPath); mHhttpRequest.addHeader("range", "bytes=34199-"); BasicHttpParams bparams = new BasicHttpParams(); HttpConnectionParams.setConnectionTimeout(bparams, 20000); HttpConnectionParams.setSoTimeout(bparams, 20000); HttpConnectionParams.setSocketBufferSize(bparams, 8 * 1024); HttpClientParams.setRedirecting(bparams, true); DefaultHttpClient mDefaultHttpClient = new DefaultHttpClient(bparams); HttpResponse response = null;//from www.j a va 2 s . co m try { response = mDefaultHttpClient.execute(mHhttpRequest); int responseCode = response.getStatusLine().getStatusCode(); byte[] arrayOfByte = null; HttpEntity httpEntity = response.getEntity(); if (responseCode == 200 || responseCode == 206) { arrayOfByte = toByteArray(httpEntity); String m = new String(arrayOfByte, "UTF-8"); Log.i("ldx", "" + m.length()); Log.i("ldx", m); return; } } catch (Exception e) { e.printStackTrace(); } }
From source file:Main.java
/** * Creates the Uri string with embedded expansion codes. * * @param uri to be encoded// ww w . j ava 2s . c o m * @return the Uri string with expansion codes. */ public static byte[] encodeUri(String uri) { if (uri == null || uri.length() == 0) { Log.i(TAG, "null or empty uri"); return new byte[0]; } ByteBuffer bb = ByteBuffer.allocate(uri.length()); // UUIDs are ordered as byte array, which means most significant first bb.order(ByteOrder.BIG_ENDIAN); int position = 0; // Add the byte code for the scheme or return null if none Byte schemeCode = encodeUriScheme(uri); if (schemeCode == null) { Log.i(TAG, "null scheme code"); return null; } String scheme = URI_SCHEMES.get(schemeCode); bb.put(schemeCode); position += scheme.length(); if (URLUtil.isNetworkUrl(scheme)) { Log.i(TAG, "is network URL"); return encodeUrl(uri, position, bb); } else if ("urn:uuid:".equals(scheme)) { Log.i(TAG, "is UUID"); return encodeUrnUuid(uri, position, bb); } return null; }
From source file:com.nullwire.trace.ExceptionHandler.java
/** * Register handler for unhandled exceptions. * @param app /*w ww . j a v a2 s . com*/ * @param han */ public static boolean register(Context ctx, Handler han) { Log.i(TAG, "Registering default exceptions handler: " + G.URL); s_han = han; s_ctx = ctx; Log.i(TAG, "Registering default exceptions handler"); // Get information about the Package PackageManager pm = s_ctx.getPackageManager(); try { PackageInfo pi; // Version pi = pm.getPackageInfo(s_ctx.getPackageName(), 0); G.APP_VERSION = pi.versionName; // Package name G.APP_PACKAGE = pi.packageName; // Files dir for storing the stack traces G.FILES_PATH = s_ctx.getFilesDir().getAbsolutePath(); // Device model G.PHONE_MODEL = android.os.Build.MODEL; // Android version G.ANDROID_VERSION = android.os.Build.VERSION.RELEASE; } catch (NameNotFoundException e) { e.printStackTrace(); } Log.i(TAG, "TRACE_VERSION: " + G.TraceVersion); Log.d(TAG, "APP_VERSION: " + G.APP_VERSION); Log.d(TAG, "APP_PACKAGE: " + G.APP_PACKAGE); Log.d(TAG, "FILES_PATH: " + G.FILES_PATH); Log.d(TAG, "URL: " + G.URL); boolean stackTracesFound = false; // We'll return true if any stack traces were found if (searchForStackTraces().length > 0) { stackTracesFound = true; } //it sends report new Thread() { @Override public void run() { s_han.post(new Runnable() { @Override public void run() { String[] list = searchForStackTraces(); if (list != null && list.length > 0) { AppHelper.showExceptionDialog(s_ctx); } } }); // First of all transmit any stack traces that may be lying around UncaughtExceptionHandler currentHandler = Thread.getDefaultUncaughtExceptionHandler(); if (currentHandler != null) { Log.d(TAG, "current handler class=" + currentHandler.getClass().getName()); } // don't register again if already registered if (!(currentHandler instanceof DefaultExceptionHandler)) { // Register default exceptions handler Thread.setDefaultUncaughtExceptionHandler(new DefaultExceptionHandler(currentHandler)); } } }.start(); return stackTracesFound; }
From source file:com.bellman.bible.android.Bible.java
public void initAll(Application application) { this.application = application; Log.i(TAG, "OS:" + System.getProperty("os.name") + " ver " + System.getProperty("os.version")); Log.i(TAG, "Java:" + System.getProperty("java.vendor") + " ver " + System.getProperty("java.version")); Log.i(TAG, "Java home:" + System.getProperty("java.home")); Log.i(TAG,//from ww w .jav a2s. com "User dir:" + System.getProperty("user.dir") + " Timezone:" + System.getProperty("user.timezone")); // fix for null context class loader (http://code.google.com/p/android/issues/detail?id=5697) // this affected jsword dynamic classloading Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); installJSwordErrorReportListener(); // initialise link to Android progress control display in Notification bar ProgressNotificationManager.getInstance().initialise(); Locale locale = Locale.getDefault(); Log.i(TAG, "Locale language:" + locale.getLanguage() + " Variant:" + locale.getDisplayName()); // various initialisations required every time at app startup Initialisation.getInstance().initialiseEventually(); }