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, Throwable tr) 

Source Link

Document

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

Usage

From source file:com.code19.library.L.java

private static void printSub(int type, String tag, String sub) {
    if (tag == null) {
        tag = TAG;//  www .  j  ava  2  s. c o m
    }
    switch (type) {
    case VERBOSE:
        Log.v(tag, sub);
        break;
    case DEBUG:
        Log.d(tag, sub);
        break;
    case INFO:
        Log.i(tag, sub);
        break;
    case WARN:
        Log.w(tag, sub);
        break;
    case ERROR:
        Log.e(tag, sub);
        break;
    case ASSERT:
        Log.wtf(tag, sub);
        break;
    }
}

From source file:com.example.common.utils.L.java

private static void printSub(int type, String tag, String sub) {
    if (tag == null) {
        tag = TAG;//from w  w  w.j av a 2s.  c  o  m
    }
    printLine(tag, true);
    switch (type) {
    case VERBOSE:
        Log.v(tag, sub);
        break;
    case DEBUG:
        Log.d(tag, sub);
        break;
    case INFO:
        Log.i(tag, sub);
        break;
    case WARN:
        Log.w(tag, sub);
        break;
    case ERROR:
        Log.e(tag, sub);
        break;
    case ASSERT:
        Log.wtf(tag, sub);
        break;
    }
    printLine(tag, false);
}

From source file:com.roque.rueda.cashflows.fragments.AccountListFragment.java

/**
 * Handles the event when this fragment gets attached.
 * @param activity             Parent activity that is used to contain this fragment.
 *//*from w  w w.j  av  a2s  .  c  o  m*/
@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);

    // Activity that contain this fragment should implement ListItemClickNotification.
    if (!(activity instanceof ListItemClickNotification)) {
        Log.wtf(TAG, "== onAttach(). The parent activity must implement ListItemClickNotification. ==");
        throw new IllegalStateException("The parent activity must implement ListItemClickNotification.");
    }

    careTaker = (ListItemClickNotification) activity;
}

From source file:de.elanev.studip.android.app.frontend.planer.PlannerFragment.java

private void requestEvents() {
    JacksonRequest<Events> eventsJacksonRequest = new JacksonRequest<Events>(mEventsRoute, Events.class, null,
            new Response.Listener<Events>() {
                public void onResponse(Events response) {
                    new CourseInfoLoadTask(getActivity()).execute(response);
                }// w ww .  ja  v  a2s  . c o m

            }, new Response.ErrorListener() {
                public void onErrorResponse(VolleyError error) {
                    if (getActivity() != null && error != null && error.getMessage() != null) {
                        Log.wtf(TAG, error.getMessage());
                        mSwipeRefreshLayoutListView.setRefreshing(false);
                        Toast.makeText(getActivity(), R.string.sync_error_default, Toast.LENGTH_LONG).show();
                    }
                }
            }

            , Request.Method.GET);

    DefaultRetryPolicy retryPolicy = new DefaultRetryPolicy(30000, DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
            DefaultRetryPolicy.DEFAULT_BACKOFF_MULT);

    eventsJacksonRequest.setRetryPolicy(retryPolicy);
    eventsJacksonRequest.setPriority(Request.Priority.IMMEDIATE);

    try {
        OAuthConnector.with(mServer).sign(eventsJacksonRequest);
        StudIPApplication.getInstance().addToRequestQueue(eventsJacksonRequest, TAG);
        mSwipeRefreshLayoutListView.setRefreshing(true);
        Log.i(TAG, "Getting new events");
    } catch (OAuthExpectationFailedException e) {
        e.printStackTrace();
    } catch (OAuthCommunicationException e) {
        e.printStackTrace();
    } catch (OAuthMessageSignerException e) {
        e.printStackTrace();
    } catch (OAuthNotAuthorizedException e) {
        StuffUtil.startSignInActivity(mContext);
    }
}

From source file:com.google.android.apps.forscience.whistlepunk.EditNoteDialog.java

@Override
public AlertDialog onCreateDialog(Bundle savedInstanceState) {
    mLabel = getArguments().getParcelable(KEY_SAVED_LABEL);
    String timeText = getArguments().getString(KEY_SAVED_TIME_TEXT, "");
    String timeTextContentDescription = getArguments().getString(KEY_SAVED_TIME_TEXT_DESCRIPTION);
    mTimestamp = getArguments().getLong(KEY_SAVED_TIMESTAMP);
    try {/*from  www .  j  a  va  2 s  .  com*/
        mSelectedValue = GoosciLabelValue.LabelValue.parseFrom(getArguments().getByteArray(KEY_SELECTED_VALUE));
    } catch (InvalidProtocolBufferNanoException ex) {
        Log.wtf(TAG, "Couldn't parse label value");
    }
    AlertDialog.Builder alertDialog = new AlertDialog.Builder(getActivity());

    LinearLayout rootView = (LinearLayout) LayoutInflater.from(getActivity())
            .inflate(R.layout.run_review_label_edit, null);
    alertDialog.setView(rootView);

    ImageView imageView = (ImageView) rootView.findViewById(R.id.picture_note_preview_image);
    final EditText editText = (EditText) rootView.findViewById(R.id.edit_note_text);
    TextView autoTextView = (TextView) rootView.findViewById(R.id.auto_note_text);

    // Use mSelectedValue to load content, because the user may have changed the value since
    // it was stored in the label. Note that picture labels can't be edited at this time,
    // but in the future this will apply to picture labels as well.
    if (mLabel instanceof PictureLabel) {
        imageView.setVisibility(View.VISIBLE);
        autoTextView.setVisibility(View.GONE);
        editText.setText(PictureLabel.getCaption(mSelectedValue));
        editText.setHint(R.string.picture_note_caption_hint);
        Glide.with(getActivity()).load(PictureLabel.getFilePath(mSelectedValue)).into(imageView);
        imageView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                PictureUtils.launchExternalViewer(getActivity(), (PictureLabel.getFilePath(mSelectedValue)));
            }
        });
    } else if (mLabel instanceof TextLabel) {
        imageView.setVisibility(View.GONE);
        autoTextView.setVisibility(View.GONE);
        editText.setText(TextLabel.getText(mSelectedValue));
    } else if (mLabel instanceof SensorTriggerLabel) {
        imageView.setVisibility(View.GONE);
        autoTextView.setVisibility(View.VISIBLE);
        editText.setText(SensorTriggerLabel.getCustomText(mSelectedValue));
        String autoText = SensorTriggerLabel.getAutogenText(mSelectedValue);
        TriggerHelper.populateAutoTextViews(autoTextView, autoText, R.drawable.ic_label_black_24dp,
                getResources());
    }

    alertDialog.setPositiveButton(R.string.action_save, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            mLabel.setTimestamp(mTimestamp);
            if (mLabel instanceof TextLabel) {
                ((TextLabel) mLabel).setText(editText.getText().toString());
            } else if (mLabel instanceof PictureLabel) {
                ((PictureLabel) mLabel).setCaption(editText.getText().toString());
            } else if (mLabel instanceof SensorTriggerLabel) {
                ((SensorTriggerLabel) mLabel).setCustomText(editText.getText().toString());
            }
            getDataController().editLabel(mLabel,
                    ((EditNoteDialogListener) getParentFragment()).onLabelEdit(mLabel));
        }
    });
    alertDialog.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.cancel();
        }
    });
    alertDialog.setCancelable(true);

    TextView timeTextView = (TextView) rootView.findViewById(R.id.edit_note_time);
    timeTextView.setText(timeText);
    timeTextView.setContentDescription(timeTextContentDescription);
    if (labelBelongsToRun() && mLabel.canEditTimestamp()) {
        timeTextView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                GoosciLabelValue.LabelValue value = new GoosciLabelValue.LabelValue();
                if (mLabel instanceof PictureLabel) {
                    // Captions can be edited, but the picture path cannot be edited at this
                    // time.
                    PictureLabel.populateStorageValue(value, ((PictureLabel) mLabel).getFilePath(),
                            editText.getText().toString());
                    ((EditNoteDialogListener) getParentFragment()).onEditNoteTimestampClicked(mLabel, value,
                            mTimestamp);
                } else if (mLabel instanceof TextLabel) {
                    TextLabel.populateStorageValue(value, editText.getText().toString());
                    ((EditNoteDialogListener) getParentFragment()).onEditNoteTimestampClicked(mLabel, value,
                            mTimestamp);
                }
            }
        });
    } else if (labelBelongsToRun()) {
        Drawable lockDrawable = getResources().getDrawable(R.drawable.ic_lock_black_18dp);
        DrawableCompat.setTint(lockDrawable, getResources().getColor(R.color.text_color_light_grey));
        // There is already a start drawable. Use it again.
        Drawable[] drawables = timeTextView.getCompoundDrawablesRelative();
        timeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(drawables[0], null, lockDrawable, null);
    }

    AlertDialog dialog = alertDialog.create();
    if (mLabel instanceof TextLabel || mLabel instanceof SensorTriggerLabel) {
        dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
    }
    return dialog;
}

From source file:de.damdi.fitness.activity.manage_workouts.RenameWorkoutDialogFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    LayoutInflater inflater = LayoutInflater.from(getActivity());
    final View v = inflater.inflate(R.layout.fragment_dialog_rename_workout, null);

    // show old name
    final EditText edittext_workout_name = (EditText) v.findViewById(R.id.edittext_workout_name);
    edittext_workout_name.setText(mWorkout.getName());

    return new AlertDialog.Builder(getActivity()).setTitle(mWorkout.getName()).setView(v).setCancelable(true)
            .setPositiveButton(getString(R.string.save), new DialogInterface.OnClickListener() {
                @Override/*from   w w w  . ja  v a  2s.  c  o  m*/
                public void onClick(DialogInterface dialog, int which) {
                    String enterendName = edittext_workout_name.getText().toString();

                    // check if name is valid(not empty, not used)
                    if (enterendName.equals("")) {
                        Toast.makeText(getActivity(), getString(R.string.workout_name_cannot_be_empty),
                                Toast.LENGTH_LONG).show();
                        return;
                    }

                    if (fileAlreadyExists(enterendName)) {
                        Toast.makeText(getActivity(), getString(R.string.workout_already_exists),
                                Toast.LENGTH_LONG).show();
                        return;
                    }

                    // delete old Workout
                    IDataProvider dataProvider = new DataProvider(getActivity());
                    dataProvider.deleteWorkout(mWorkout);

                    mWorkout.setName(enterendName);

                    // save new Workout
                    boolean success = dataProvider.saveWorkout(mWorkout);
                    if (!success) {
                        Log.wtf(TAG,
                                "Error during saving workout. Old workout was lost. This should never happen.");
                        Toast.makeText(getActivity(), getString(R.string.error_during_saving),
                                Toast.LENGTH_LONG).show();
                        return;
                    }

                    // finally update GUI
                    TextView textview_workout_name = (TextView) getActivity()
                            .findViewById(R.id.textview_workout_name);
                    textview_workout_name.setText(enterendName);

                    // update Workout in Activity
                    if (getActivity() instanceof WorkoutListActivity) {
                        ((WorkoutListActivity) getActivity()).onWorkoutChanged(mWorkout);
                    } else {
                        // was launched by WorkoutDetailActivity
                        // so set result to update WorkoutListActivity later
                        Intent i = new Intent();
                        i.putExtra(WorkoutListActivity.ARG_WORKOUT, mWorkout);
                        getActivity().setResult(Activity.RESULT_OK, i);
                    }

                    dialog.dismiss();
                }
            }).setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                }
            }).create();
}

From source file:de.damdi.fitness.activity.MainActivity.java

private void setUpNavigation() {
    FancyCoverFlow mFancyCoverFlow = (FancyCoverFlow) this.findViewById(R.id.fancyCoverFlow);

    mFancyCoverFlow.setAdapter(new NavigationGalleryAdapter(this));
    mFancyCoverFlow.setUnselectedAlpha(0.5f);
    mFancyCoverFlow.setUnselectedSaturation(0.0f);
    mFancyCoverFlow.setUnselectedScale(0.2f);
    mFancyCoverFlow.setMaxRotation(35);//  w  w  w.j a  v  a2  s. com
    mFancyCoverFlow.setScaleDownGravity(0.0f);
    mFancyCoverFlow.setActionDistance(FancyCoverFlow.ACTION_DISTANCE_AUTO);

    mFancyCoverFlow.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            switch (position) {
            case 0:
                showSelectWorkoutDialog();
                break;
            case 1:
                startActivity(new Intent(MainActivity.this, TimerActivity.class));
                break;
            case 2:
                startActivity(new Intent(MainActivity.this, ExerciseTypeListActivity.class));
                break;
            case 3:
                startActivity(new Intent(MainActivity.this, WorkoutListActivity.class));
                break;
            case 4:
                startActivity(new Intent(MainActivity.this, SettingsActivity.class));
                break;
            default:
                Log.wtf(TAG, "This item should not exist.");
            }
        }
    });
}

From source file:org.couchbase.health.PoolHealthReader.java

/**
 * Download the bootstrap document and locate the URL where we can find
 * information about the desired pool./*w  ww. j av a2  s  . co  m*/
 * 
 * @throws IOException
 *             if an error occurs while we're trying to send / receive data
 *             on the network.
 */
private void bootstrap() throws IOException {
    Log.d("org.couchbase.health", "Download bootstrap URL: " + bootstrapUrl.toExternalForm());
    String json = spider.download(bootstrapUrl);

    try {
        JSONObject root = (JSONObject) (new JSONTokener(json)).nextValue();
        JSONArray pools = root.getJSONArray("pools");
        for (int ii = 0; ii < pools.length(); ++ii) {
            JSONObject obj = pools.optJSONObject(ii);
            if (poolName.equalsIgnoreCase(obj.getString("name"))) {
                // So this is it!!
                String uri = obj.getString("uri");
                if (uri.startsWith("/")) {
                    poolUrl = new URL(bootstrapUrl.getProtocol(), bootstrapUrl.getHost(),
                            bootstrapUrl.getPort(), uri);

                } else {
                    poolUrl = new URL(uri);
                }
                break;
            }
        }
    } catch (JSONException e) {
        Log.wtf("Failed to decode JSON response", e);
        throw new IOException("Invalid response");
    }
    if (poolUrl == null) {
        throw new FileNotFoundException("pool not found");
    }
}

From source file:com.snicesoft.basekit.LogKit.java

public static void wtf(Throwable tr) {
    if (!allowWtf)
        return;//from www .java 2 s .co m
    StackTraceElement caller = getCallerStackTraceElement();
    String tag = generateTag(caller);
    Log.wtf(tag, tr);
}

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

/**
 * Updates the view for this fragment if a internet connection is available
 *
 * @param isSwipeRefresh/* w w  w  .  ja  v  a2 s  .c om*/
 */
public void updateInfoSys(boolean isSwipeRefresh) {
    Log.wtf(TAG, "Starting updateInfoSys");
    this.preferences = new Preferences(getActivity().getApplicationContext());

    TextView txtLastUpdate = (TextView) getActivity().findViewById(R.id.txtLastUpdate);
    ConnectivityManager cm = (ConnectivityManager) getActivity().getSystemService(Context.CONNECTIVITY_SERVICE);
    NetworkInfo activeNetwork = cm.getActiveNetworkInfo();

    boolean isConnected = activeNetwork != null && activeNetwork.isConnectedOrConnecting();
    if (isConnected) {
        try {
            /* launches an asynchronus task that will fetch all infosys items for the current department */
            this.asyncTask = new ParseInfoSysTask(getActivity(), this.preferences.getInfoSysURL(),
                    this.preferences.getFB(), isSwipeRefresh);
            this.asyncTask.delegate = this;
            this.asyncTask.execute();
        } catch (Exception ex) {
            Log.wtf(TAG, "INTERNET LOAD", ex);
        }
    } else {
        txtLastUpdate.setText("Um neue Eintrge abzurufen, bitte Internetverbindung herstellen");

        swipeLayout.setRefreshing(false);
    }
}