Example usage for android.util Log wtf

List of usage examples for android.util Log wtf

Introduction

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

Prototype

public static int wtf(String tag, String msg, Throwable tr) 

Source Link

Document

What a Terrible Failure: Report an exception that should never happen.

Usage

From source file:com.example.android.network.sync.basicsyncadapter.SyncAdapter.java

/**
 * Called by the Android system in response to a request to run the sync adapter. The work
 * required to read data from the network, parse it, and store it in the content provider is
 * done here. Extending AbstractThreadedSyncAdapter ensures that all methods within SyncAdapter
 * run on a background thread. For this reason, blocking I/O and other long-running tasks can be
 * run <em>in situ</em>, and you don't have to set up a separate thread for them.
 .
 *
 * <p>This is where we actually perform any work required to perform a sync.
 * {@link AbstractThreadedSyncAdapter} guarantees that this will be called on a non-UI thread,
 * so it is safe to peform blocking I/O here.
 *
 * <p>The syncResult argument allows you to pass information back to the method that triggered
 * the sync.//from ww w.  j  a va 2 s.  c  om
 */
@Override
public void onPerformSync(Account account, Bundle extras, String authority, ContentProviderClient provider,
        SyncResult syncResult) {
    Log.i(TAG, "Beginning network synchronization");
    try {
        final URL location = new URL(FEED_URL);
        InputStream stream = null;

        try {
            Log.i(TAG, "Streaming data from network: " + location);
            downloadAllObjectsForRegisteredModels(syncResult);
            //stream = downloadUrl(location);
            //updateLocalFeedData(stream, syncResult);
            // Makes sure that the InputStream is closed after the app is
            // finished using it.
        } finally {
            if (stream != null) {
                stream.close();
            }
        }
    }

    catch (InvocationTargetException e) {

    }

    catch (IllegalAccessException e) {

    }

    catch (MalformedURLException e) {
        Log.wtf(TAG, "Feed URL is malformed", e);
        syncResult.stats.numParseExceptions++;
        return;
    } catch (IOException e) {
        Log.e(TAG, "Error reading from network: " + e.toString());
        syncResult.stats.numIoExceptions++;
        return;
    } /*catch (XmlPullParserException e) {
      Log.e(TAG, "Error parsing feed: " + e.toString());
      syncResult.stats.numParseExceptions++;
      return;
      } catch (ParseException e) {
      Log.e(TAG, "Error parsing feed: " + e.toString());
      syncResult.stats.numParseExceptions++;
      return;
      } catch (RemoteException e) {
      Log.e(TAG, "Error updating database: " + e.toString());
      syncResult.databaseError = true;
      return;
      } catch (OperationApplicationException e) {
      Log.e(TAG, "Error updating database: " + e.toString());
      syncResult.databaseError = true;
      return;
      }*/
    Log.i(TAG, "Network synchronization complete");
}

From source file:edu.umich.oasis.testapp.TestActivity.java

public void toastValue(View ignored) {
    try {/*  ww w  . j av  a  2s  . c om*/
        setButtonsEnabled(false);

        if (toastValueSoda == null) {
            toastValueSoda = connection.resolveStatic(void.class, KeyValueTest.class, "toastValue");
        }

        toastValueSoda.call();
    } catch (Exception e) {
        Log.wtf(TAG, "Exception in toastValue()", e);
    } finally {
        Log.i(TAG, "Finishing");
        setButtonsEnabled(true);
    }
}

From source file:de.jadehs.jadehsnavigator.fragment.VorlesungsplanFragment.java

@Override
public void onResume() {
    super.onResume();
    try {//  w  ww. ja  v a2s.c om
        SharedPreferences sharedPreferences = getActivity().getSharedPreferences("JHSNAV_PREFS",
                Context.MODE_PRIVATE);
        this.studiengangID = sharedPreferences.getString("StudiengangID", "");
        Log.i("STUDIENGANG", studiengangID);
        this.preferences = new Preferences(getActivity().getApplicationContext());

        setCurrentWeekNumber();

        if (studiengangID.startsWith("%")) {
            //getVPlanFromDB(); prefer_vplan
            if (this.preferences.getBoolean("prefer_vplan", true)) {
                this.isCustomVPlanShown = true;
                getCustomVPlan();
            } else {
                this.isCustomVPlanShown = false;
                getVPlanFromDB();
            }
        } else {
            getActivity().findViewById(R.id.progressVPlan).setVisibility(View.GONE);
            getActivity().findViewById(R.id.empty_sg).setVisibility(View.VISIBLE);
        }
    } catch (Exception ex) {
        Log.wtf("VPlan", "Err", ex);
    }

    if (!this.preferences.getBoolean("vplan_instructions_read", false)) {

        try {
            this.preferences.save("vplan_instructions_read", true);
            AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());

            builder.setMessage(
                    "Durch einen langen Klick fgst du eine Vorlesung deinem eigenen Vorlesungsplan hinzu.")
                    .setPositiveButton("OK", new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                            dialog.dismiss();
                        }
                    });

            AlertDialog dialog = builder.create();
            dialog.show();
        } catch (Exception ex) {
            Log.wtf("EXXX", "EX", ex);
        }
    }
}

From source file:de.jadehs.jadehsnavigator.fragment.MensaplanFragment.java

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    updateMensaplan(false);//from  ww  w  . j  av  a  2 s  .c o m
    if (!preferences.getBoolean("readInstruction", false)) {
        try {
            this.builder = new AlertDialog.Builder(getActivity());
            // don't show this dialog again
            preferences.save("readInstruction", true);
            String instructionMsg = String.format(
                    getActivity().getResources().getString(R.string.mensaplan_belehrung),
                    preferences.getLocation());

            builder.setTitle(getActivity().getResources().getString(R.string.mensaplan_belehrung_title));
            builder.setMessage(instructionMsg)
                    // Positiv-Button wird deklariert
                    .setPositiveButton(
                            getActivity().getResources().getString(R.string.mensaplan_belehrung_positivebutton),
                            new DialogInterface.OnClickListener() {
                                @Override
                                public void onClick(final DialogInterface dialog, final int id) {
                                    dialog.dismiss();
                                }
                            });

            mensaplanFirstTime = false;

            alert = builder.create();

            alert.setCanceledOnTouchOutside(false);
            alert.show();
        } catch (Exception ex) {
            Log.wtf("EXXX", "EX", ex);
        }
    }

}

From source file:edu.umich.flowfence.testapp.TestActivity.java

public void toastValue(View ignored) {
    try {/*  w  w  w.ja va 2 s.  c o m*/
        setButtonsEnabled(false);

        if (toastValueQM == null) {
            toastValueQM = connection.resolveStatic(void.class, KeyValueTest.class, "toastValue");
        }

        toastValueQM.call();
    } catch (Exception e) {
        Log.wtf(TAG, "Exception in toastValue()", e);
    } finally {
        Log.i(TAG, "Finishing");
        setButtonsEnabled(true);
    }
}

From source file:edu.umich.oasis.testapp.TestActivity.java

public void pushValue(View ignored) {
    try {//from  www.  j av a 2 s. c om
        setButtonsEnabled(false);

        if (pushValueSoda == null) {
            pushValueSoda = connection.resolveStatic(void.class, KeyValueTest.class, "pushValue");
        }

        pushValueSoda.call();
    } catch (Exception e) {
        Log.wtf(TAG, "Exception in pushValue()", e);
    } finally {
        Log.i(TAG, "Finishing");
        setButtonsEnabled(true);
    }
}

From source file:edu.umich.flowfence.testapp.TestActivity.java

public void pushValue(View ignored) {
    try {/*from w  w  w.  ja va2  s .  c om*/
        setButtonsEnabled(false);

        if (pushValueQM == null) {
            pushValueQM = connection.resolveStatic(void.class, KeyValueTest.class, "pushValue");
        }

        pushValueQM.call();
    } catch (Exception e) {
        Log.wtf(TAG, "Exception in pushValue()", e);
    } finally {
        Log.i(TAG, "Finishing");
        setButtonsEnabled(true);
    }
}

From source file:edu.umich.oasis.testapp.TestActivity.java

public void toastECU(View ignored) {
    try {/*ww w  .j a  v  a2  s.  c o  m*/
        setButtonsEnabled(false);

        if (toastECUSoda == null) {
            toastECUSoda = connection.resolveStatic(void.class, GMTest.class, "toastValue");
        }

        toastECUSoda.call();
    } catch (Exception e) {
        Log.wtf(TAG, "Exception in toastECU()", e);
    } finally {
        Log.i(TAG, "Finishing");
        setButtonsEnabled(true);
    }
}

From source file:com.github.notizklotz.derbunddownloader.download.IssueDownloadService.java

private boolean waitForWifiConnection() {
    boolean connected = false;
    if (wifiManager != null) {
        //WIFI_MODE_FULL was not enough on Xperia Tablet Z Android 4.2 to reconnect to the AP if Wifi was enabled but connection
        //was lost
        myWifiLock = wifiManager.createWifiLock(WifiManager.WIFI_MODE_FULL_HIGH_PERF, "IssueDownloadWifilock");
        myWifiLock.setReferenceCounted(false);
        myWifiLock.acquire();//from   ww w  . j  a  va  2  s.c o m

        //Wait for Wifi coming up
        long firstCheckMillis = System.currentTimeMillis();
        if (!wifiManager.isWifiEnabled()) {
            notifyUser(getText(R.string.download_connection_failed),
                    getText(R.string.download_connection_failed_no_wifi_text), R.drawable.ic_stat_newspaper);
        } else {
            do {
                NetworkInfo networkInfo = connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
                assert networkInfo != null;
                connected = networkInfo.isConnected();

                if (!connected) {
                    Log.d(LOG_TAG, "Wifi connection is not yet ready. Wait and recheck");

                    if (System.currentTimeMillis() - firstCheckMillis > WIFI_CHECK_MAX_MILLIS) {
                        break;
                    }

                    try {
                        Thread.sleep(WIFI_RECHECK_WAIT_MILLIS);
                    } catch (InterruptedException e) {
                        Log.wtf(LOG_TAG, "Interrupted while waiting for Wifi connection", e);
                    }
                }
            } while (!connected);
        }
    }
    return connected;
}

From source file:edu.umich.flowfence.testapp.TestActivity.java

public void toastECU(View ignored) {
    try {//from   w w  w  . j  a  v a 2s.c o m
        setButtonsEnabled(false);

        if (toastECUQM == null) {
            toastECUQM = connection.resolveStatic(void.class, GMTest.class, "toastValue");
        }

        toastECUQM.call();
    } catch (Exception e) {
        Log.wtf(TAG, "Exception in toastECU()", e);
    } finally {
        Log.i(TAG, "Finishing");
        setButtonsEnabled(true);
    }
}