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:de.jadehs.jadehsnavigator.fragment.VorlesungsplanFragment.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {

    switch (item.getItemId()) {
    case R.id.change_kw_vplan:
        ////  w  w w . j  av a2s.co  m
        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
        builder.setTitle("Kalenderwoche whlen:");

        final String[] strings = new String[52];

        for (int i = 0; i <= 51; i++) {
            strings[i] = "" + (i + 1);
        }
        builder.setSingleChoiceItems(strings, Integer.parseInt(this.weekOfYear) - 1,
                new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        //setWeekOfYear(strings[which]);
                        setCustomVPlanShown(false);
                        //switchVPlanSymbol();
                        if (studiengangID.startsWith("%")) {
                            setCurrentWeekNumber(which + 1);
                            updateVPlan();
                        }
                        dialog.dismiss();
                    }
                }).create();

        builder.show();
        break;
    case R.id.refresh_vplan:
        this.isCustomVPlanShown = false;

        updateVPlan();
        break;

    case R.id.show_custom_vplan:
        try {
            if (!isCustomVPlanShown) {
                this.isCustomVPlanShown = true;
                getCustomVPlan();

                //ListView lv = (ListView) getView().findViewById(R.id.list_studiengang);
                //VPlanAdapter vPlanAdapter = (VPlanAdapter) lv.getAdapter();
            } else {
                this.isCustomVPlanShown = false;
                getVPlanFromDB();
                getActivity().findViewById(R.id.empty_custom_vplan).setVisibility(View.GONE);

                //ListView lv = (ListView) getView().findViewById(R.id.list_studiengang);
                //VPlanAdapter vPlanAdapter = (VPlanAdapter) lv.getAdapter();
            }
            break;
        } catch (Exception ex) {
            Log.wtf(TAG, "Err", ex);
        }
    }
    //switchVPlanSymbol();

    return super.onOptionsItemSelected(item);

}

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

public void runTest(View ignored) {
    try {/*ww w  .  j a  va 2s .c  o  m*/
        setButtonsEnabled(false);
        OASISConnection conn = connection;

        // start resolving
        init0 = conn.resolveConstructor(TestSoda.class);
        init1 = conn.resolveConstructor(TestSoda.class, String.class);

        concat = conn.resolveStatic(String.class, TestSoda.class, "concat", String.class, String.class);

        getState = conn.resolveInstance(String.class, TestSoda.class, "getState");
        swapState = conn.resolveInstance(String.class, TestSoda.class, "swapState", String.class);

        log = conn.resolveInstance(void.class, TestSoda.class, "log", String.class);
        logStatic = conn.resolveStatic(void.class, TestSoda.class, "log", String.class, String.class);

        throwStatic = conn.resolveStatic(String.class, TestSoda.class, "throwStatic", String.class);
        throwInstance = conn.resolveInstance(void.class, TestSoda.class, "throwInstance", String.class);
        sleep = conn.resolveStatic(String.class, TestSoda.class, "sleep", long.class);
        Log.i(TAG, "Done resolving");

        ComponentName cn = new ComponentName(getPackageName(), "testChannel");
        SodaDescriptor sd = logStatic.getDescriptor();
        conn.getRawInterface().subscribeEventChannel(cn, sd);

        Log.i(TAG, "Constructing with init0");
        Sealed<TestSoda> obj1 = init0.call();
        obj1.buildCall(log).arg("obj1").call();

        Log.i(TAG, "Constructing with init1");
        Sealed<TestSoda> obj2 = init1.arg("<foobar>").call();
        Sealed<String> obj2State = getState.arg(obj2).call();
        logStatic.arg("obj2State").arg(obj2State).call();

        Log.i(TAG, "Calling static method");
        Sealed<String> newState = concat.arg("state").arg(obj2State).call();
        logStatic.arg("newState").arg(newState).call();

        Log.i(TAG, "Calling instance with inout");
        Sealed<String> oldState1 = swapState.inOut(obj1).arg(newState).call();
        logStatic.arg("oldState1").arg(oldState1).call();
        obj1.buildCall(log).arg("obj1'").call();

        Log.i(TAG, "Calling instance without inout");
        Sealed<String> oldState2 = swapState.in(obj2).arg(newState).call();
        logStatic.arg("oldState2").arg(oldState2).call();
        obj2.buildCall(log).arg("obj2'").call();

        Log.i(TAG, "Testing exception propagation - static");
        Sealed<String> excStatic = throwStatic.in("static test #1").call();
        Sealed<String> excStatic2 = throwStatic.in("static test #2").call();
        logStatic.arg(excStatic).arg(excStatic2).call();

        Log.i(TAG, "Testing exception propagation - instance");

        obj1.buildCall(throwInstance).arg("instance test - obj1").call();
        obj1.buildCall(log).argNull().call();

        throwInstance.in(obj2).arg("instance test - obj2").call();
        obj2.buildCall(log).argNull().call();

        Log.i(TAG, "Testing async method calls");
        Sealed<String> sleepResult = sleep.arg(15 * 1000L).asAsync().call();
        logStatic.arg("Sleep result").arg(sleepResult).asAsync().call();

        Log.i(TAG, "All done!");

    } catch (Exception e) {
        Log.wtf(TAG, "Exception in post-connect handler", e);
    } finally {
        Log.i(TAG, "Finishing");
        setButtonsEnabled(true);
    }
}

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

public void runTest(View ignored) {
    try {/*w ww  .  j a v  a  2  s .  c o m*/
        setButtonsEnabled(false);
        FlowfenceConnection conn = connection;

        // start resolving
        init0 = conn.resolveConstructor(TestQM.class);
        init1 = conn.resolveConstructor(TestQM.class, String.class);

        concat = conn.resolveStatic(String.class, TestQM.class, "concat", String.class, String.class);

        getState = conn.resolveInstance(String.class, TestQM.class, "getconnecState");
        swapState = conn.resolveInstance(String.class, TestQM.class, "swapState", String.class);

        log = conn.resolveInstance(void.class, TestQM.class, "log", String.class);
        logStatic = conn.resolveStatic(void.class, TestQM.class, "log", String.class, String.class);

        throwStatic = conn.resolveStatic(String.class, TestQM.class, "throwStatic", String.class);
        throwInstance = conn.resolveInstance(void.class, TestQM.class, "throwInstance", String.class);
        sleep = conn.resolveStatic(String.class, TestQM.class, "sleep", long.class);
        Log.i(TAG, "Done resolving");

        ComponentName cn = new ComponentName(getPackageName(), "testChannel");
        QMDescriptor sd = logStatic.getDescriptor();
        conn.getRawInterface().subscribeEventChannel(cn, sd);

        Log.i(TAG, "Constructing with init0");
        Sealed<TestQM> obj1 = init0.call();
        obj1.buildCall(log).arg("obj1").call();

        Log.i(TAG, "Constructing with init1");
        Sealed<TestQM> obj2 = init1.arg("<foobar>").call();
        Sealed<String> obj2State = getState.arg(obj2).call();

        logStatic.arg("obj2State").arg(obj2State).call();

        Log.i(TAG, "Calling static method");
        Sealed<String> newState = concat.arg("state").arg(obj2State).call();
        logStatic.arg("newState").arg(newState).call();

        Log.i(TAG, "Calling instance with inout");
        Sealed<String> oldState1 = swapState.inOut(obj1).arg(newState).call();
        logStatic.arg("oldState1").arg(oldState1).call();
        obj1.buildCall(log).arg("obj1'").call();

        Log.i(TAG, "Calling instance without inout");
        Sealed<String> oldState2 = swapState.in(obj2).arg(newState).call();
        logStatic.arg("oldState2").arg(oldState2).call();
        obj2.buildCall(log).arg("obj2'").call();

        Log.i(TAG, "Testing exception propagation - static");
        Sealed<String> excStatic = throwStatic.in("static test #1").call();
        Sealed<String> excStatic2 = throwStatic.in("static test #2").call();
        logStatic.arg(excStatic).arg(excStatic2).call();

        Log.i(TAG, "Testing exception propagation - instance");

        obj1.buildCall(throwInstance).arg("instance test - obj1").call();
        obj1.buildCall(log).argNull().call();

        throwInstance.in(obj2).arg("instance test - obj2").call();
        obj2.buildCall(log).argNull().call();

        Log.i(TAG, "Testing async method calls");
        Sealed<String> sleepResult = sleep.arg(15 * 1000L).asAsync().call();
        logStatic.arg("Sleep result").arg(sleepResult).asAsync().call();

        Log.i(TAG, "All done!");

    } catch (Exception e) {
        Log.wtf(TAG, "Exception in post-connect handler", e);
    } finally {
        Log.i(TAG, "Finishing");
        setButtonsEnabled(true);
    }
}

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

@Override
public void processFinish(ArrayList<RSSItem> items) {
    try {/* w  ww . j  a  v  a 2  s.c o  m*/
        Collections.sort(items, new Comparator<RSSItem>() {
            @Override
            public int compare(RSSItem lhs, RSSItem rhs) {
                return rhs.getCreated().compareTo(lhs.getCreated());
            }
        });

        getActivity().findViewById(R.id.progressNews).setVisibility(View.GONE);
        mViewPager = (ViewPager) getActivity().findViewById(R.id.viewpager);
        mViewPager.setAdapter(new NewsPagerAdapter(getActivity(), items));
        mSlidingTabLayout = (NewsTabLayout) getActivity().findViewById(R.id.sliding_tabs);
        mSlidingTabLayout.setViewPager(mViewPager);
    } catch (Exception ex) {
        Log.wtf(TAG, "ProcessFinish() failed", ex);
    }
}

From source file:com.eggwall.AdkUnoUsbHostExample.control.AccessoryService.java

/**
 * Handle the request from the UI.  You can modify this method to account for what your UI is asking
 * to do, and translate this into accessory control messages, if needed.
 * @param request integers from the {@link #REQUEST_LED_OFF} or {@link #REQUEST_LED_ON} to control
 *                the LED./*from   w  w  w  .ja  v a2 s .  co m*/
 * @return
 */
public boolean handleRequest(int request) {
    switch (request) {
    case REQUEST_LED_OFF:
        if (mControl != null) {
            mControl.sendMessage(LED_ON);
        }
        break;
    case REQUEST_LED_ON:
        if (mControl != null) {
            mControl.sendMessage(LED_OFF);
        }
        break;
    default:
        Log.wtf(TAG, "Sent the wrong message " + request, new Throwable());
        break;
    }
    return false;
}

From source file:com.android.deskclock.worldclock.CityAndTimeZoneLocator.java

private TZ resolveTimeZone() {
    BufferedReader br = null;/*from  w w w .j  av a  2s .c  om*/
    try {
        HttpClient client = new DefaultHttpClient();
        boolean gps = mLocation.getProvider().compareTo(LocationManager.GPS_PROVIDER) == 0;
        final URI uri = new URI(String.format(TIMEZONE_SERVICE_URI, String.valueOf(mLocation.getLatitude()),
                String.valueOf(mLocation.getLongitude()), String.valueOf(System.currentTimeMillis() / 1000L),
                String.valueOf(gps)));
        HttpGet request = new HttpGet();
        request.setURI(uri);
        HttpResponse response = client.execute(request);
        int status = response.getStatusLine().getStatusCode();
        if (status == HttpStatus.SC_OK) {
            // Read the response into XML
            br = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
            return parseTimeZoneResponse(br);
        }
    } catch (URISyntaxException e) {
        Log.wtf(TAG, "Failed constructing the timezone request URI", e);
    } catch (IOException e) {
        Log.e(TAG, "Failed to retrieve timezone", e);
    } finally {
        if (br != null) {
            try {
                br.close();
            } catch (IOException e) {
                // Ignore
            }
        }
    }
    return null;
}

From source file:com.google.android.gms.common.GooglePlayServicesUtilLight.java

@Deprecated
public static int isGooglePlayServicesAvailable(Context context) {
    if (zzd.zzavq) {
        return 0;
    }//w ww  . j  av  a 2 s .  co m
    PackageManager packageManager = context.getPackageManager();
    try {
        context.getResources().getString(C0158R.string.common_google_play_services_unknown_issue);
    } catch (Throwable th) {
        Log.e("GooglePlayServicesUtil",
                "The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.");
    }
    if (!"com.google.android.gms".equals(context.getPackageName())) {
        zzao(context);
    }
    try {
        PackageInfo packageInfo = packageManager.getPackageInfo("com.google.android.gms", 64);
        GoogleSignatureVerifier instance = GoogleSignatureVerifier.getInstance();
        if (!zzh.zzax(context)) {
            try {
                if (instance.zza(packageManager.getPackageInfo("com.android.vending", 8256),
                        zzcm.zzapU) == null) {
                    Log.w("GooglePlayServicesUtil", "Google Play Store signature invalid.");
                    return 9;
                }
                if (instance.zza(packageInfo, instance
                        .zza(packageManager.getPackageInfo("com.android.vending", 8256), zzcm.zzapU)) == null) {
                    Log.w("GooglePlayServicesUtil", "Google Play services signature invalid.");
                    return 9;
                }
            } catch (NameNotFoundException e) {
                Log.w("GooglePlayServicesUtil", "Google Play Store is neither installed nor updating.");
                return 9;
            }
        } else if (instance.zza(packageInfo, zzcm.zzapU) == null) {
            Log.w("GooglePlayServicesUtil", "Google Play services signature invalid.");
            return 9;
        }
        if (zzk.zzdD(packageInfo.versionCode) < zzk.zzdD(GOOGLE_PLAY_SERVICES_VERSION_CODE)) {
            Log.w("GooglePlayServicesUtil", "Google Play services out of date.  Requires "
                    + GOOGLE_PLAY_SERVICES_VERSION_CODE + " but found " + packageInfo.versionCode);
            return 2;
        }
        ApplicationInfo applicationInfo = packageInfo.applicationInfo;
        if (applicationInfo == null) {
            try {
                applicationInfo = packageManager.getApplicationInfo("com.google.android.gms", 0);
            } catch (Throwable e2) {
                Log.wtf("GooglePlayServicesUtil", "Google Play services missing when getting application info.",
                        e2);
                return 1;
            }
        }
        return !applicationInfo.enabled ? 3 : 0;
    } catch (NameNotFoundException e3) {
        Log.w("GooglePlayServicesUtil", "Google Play services is missing.");
        return 1;
    }
}

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

public void putValue(View ignored) {
    try {//from ww w.j  av  a2 s.co  m
        setButtonsEnabled(false);

        if (putValueSoda == null) {
            putValueSoda = connection.resolveStatic(void.class, KeyValueTest.class, "setValue", String.class,
                    boolean.class);
        }

        putValueSoda.arg(kvsValueField.getText().toString()).arg(shouldTaintBox.isChecked()).call();

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

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

public String loadJSONFromAsset() {
    String json;//from w w  w.  j a v  a2  s .c  o m
    try {
        InputStream is = getActivity().getAssets().open("origins.json");
        int size = is.available();
        byte[] buffer = new byte[size];
        is.read(buffer);
        is.close();
        json = new String(buffer, "UTF-8");
    } catch (IOException ex) {
        Log.wtf("JSON", "ERR", ex);
        return null;
    }
    return json;
}

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

public void putValue(View ignored) {
    try {/*  w w w .  ja v  a2s .  c om*/
        setButtonsEnabled(false);

        if (putValueQM == null) {
            putValueQM = connection.resolveStatic(void.class, KeyValueTest.class, "setValue", String.class,
                    boolean.class);
        }

        putValueQM.arg(kvsValueField.getText().toString()).arg(shouldTaintBox.isChecked()).call();

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