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:fr.enst.igr201.kanmogne.iconvert.ConvertTabFragment.java

private double queryCurrencyTable(Uri uri) {
    Log.wtf(TAG, "URI : -> " + CurrencyContract.Currency.getCurrencyNameFromURI(uri));

    double rate = 0.0;

    String[] projection = { CurrencyContract.Currency.COLUMN_RATE };
    String selection = String.format("%s.%s = ?", CurrencyContract.Currency.TABLE_CURRENCY,
            CurrencyContract.Currency.COLUMN_NAME);

    // Log.wtf(TAG, "getNameFromURI : -> " + CurrencyContract.Currency.getCurrencyNameFromURI(uri));

    String[] selectionArgs = { CurrencyContract.Currency.getCurrencyNameFromURI(uri) };
    Cursor cursor = mResolver.query(uri, projection, selection, selectionArgs, null);
    try {/*  w  w  w .  j av a 2 s. com*/
        if (cursor.moveToFirst()) {
            int rateIndex = cursor.getColumnIndex(CurrencyContract.Currency.COLUMN_RATE);
            rate = cursor.getDouble(rateIndex);
        }
    } finally {
        cursor.close();
    }
    // Log.wtf(TAG, "Rate : -->>" + rate);
    return rate;
}

From source file:conexionSiabra.ConexionSiabra.java

public boolean check() {
    boolean result = false;
    Pair<String, String> elemento = new Pair<String, String>("", "");
    if (!db.exiteOauth()) {
        Log.wtf("Token", "No existe");
        result = false;//from  ww  w. j a v a  2 s .c  o  m
    } else {
        JSONObject jsonObject = oauth.peticionGet(elemento, url_check);
        if (jsonObject.has("Exito")) {
            result = true;
        } else if (jsonObject.has("detail")) {
            Log.wtf("Token", "Caducado");
            db.eraseOauth();
            result = false;
        } else if (jsonObject.has("Error")) {
            Log.wtf("Conexion", "Fallo");
            result = false;
        }
    }
    return result;
}

From source file:com.privacity.BuscarPerfilActivity.java

public void enviarCodigo(View view) {
    EditText txtv = (EditText) findViewById(R.id.editEnviarCodigo);
    String codigo = txtv.getText().toString();
    JSONObject jsonObject = com.getPerfil(codigo);

    if (!jsonObject.has("Error") && !jsonObject.has("detail")) {
        try {/*from  ww  w. j ava2s.  c om*/
            Intent intent = new Intent(this, PerfilActivity.class);
            intent.putExtra("descripcion", jsonObject.getString("descripcion"));
            intent.putExtra("permisos", jsonObject.getString("permisos"));
            Log.wtf("PERMISOS", jsonObject.getString("permisos"));
            intent.putExtra("usuario", jsonObject.getString("usuario"));
            intent.putExtra("codigo", codigo);
            intent.putExtra("agregado", jsonObject.getString("agregado"));
            startActivity(intent);
        } catch (JSONException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            Log.wtf("Error", e);
        }
    } //IF
    else {
        Dialog dialogoError = new Dialog(this);
        try {
            String error = jsonObject.getString("Error");
            dialogoError.setTitle(error);
        } catch (JSONException e) {
            // TODO Auto-generated catch block
            dialogoError.setTitle(R.string.Upps);
            e.printStackTrace();
        }
        dialogoError.show();
    }

}

From source file:org.jivesoftware.spark.util.DummySSLSocketFactory.java

public DummySSLSocketFactory(Context context, String chatEventString) {

    mContext = context;/* w w w . j  a  va2  s.c  om*/
    mChatEventString = chatEventString;

    try {
        SSLContext sslcontent = SSLContext.getInstance("TLS");
        sslcontent.init(null, // KeyManager not required
                new TrustManager[] { new DummyTrustManager() }, new java.security.SecureRandom());
        factory = sslcontent.getSocketFactory();
    } catch (NoSuchAlgorithmException | KeyManagementException e) {
        Log.wtf("F1 :" + getClass().getName(), e);
    }
}

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

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    Log.wtf(TAG, "View created!");
    super.onViewCreated(view, savedInstanceState);

    /* Set up a Refreshlistener on the swipelayout*/
    swipeLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override//from w  ww.  j a  v  a 2 s  .c  o m
        public void onRefresh() {
            updateInfoSys(true);
        }
    });

    initializeInfoSys();
}

From source file:com.privacity.ListaPerfilActivity.java

@Override
protected void onResume() {
    super.onResume();

    Eventos = new ArrayList<HashMap<String, String>>();
    com = new ConexionSiabra(this);
    JSONObject jsonObject = com.getListaPerfiles();

    String[] perfiles = this.getIntent().getStringArrayExtra("perfiles");
    String[] perfilesCodigo = this.getIntent().getStringArrayExtra("perfilesCodigo");

    if (!jsonObject.has("Error") && !jsonObject.has("detail")) {
        try {//  w w  w  .j  ava2s . co  m
            perfiles = new String[jsonObject.length()];
            perfilesCodigo = new String[jsonObject.length()];
            for (int i = 0; i < jsonObject.length(); i++) {
                JSONArray array = jsonObject.getJSONArray(String.valueOf(i));
                perfiles[i] = array.getString(0);
                perfilesCodigo[i] = array.getString(1);
            }
        } catch (JSONException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            Log.wtf("Error", e);
        }

        for (int i = 0; i < perfiles.length; i++) {
            HashMap<String, String> datosEvento = new HashMap<String, String>();
            datosEvento.put("username", perfiles[i]);
            datosEvento.put("codigo", perfilesCodigo[i]);
            Eventos.add(datosEvento);
        }

    } // IF no hay error
    else {
        Dialog dialogo = new Dialog(this);
        dialogo.setTitle(getResources().getString(R.string.errorDeConexion));
        dialogo.show();
    }

    // PINTA TODAS LAS FILAS
    SimpleAdapter ListadoAdapter = new SimpleAdapter(this, Eventos, R.layout.row, from, to);
    setListAdapter(ListadoAdapter);
}

From source file:com.thelastcrusade.soundstream.util.MusicListAdapter.java

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    View element = convertView;/*w w w  .  ja v  a2 s  .c o m*/

    if (element == null) {
        LayoutInflater inflater = (LayoutInflater) this.mContext
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        element = inflater.inflate(R.layout.song_item, null);
    }

    View userColor = (View) element.findViewById(R.id.user_color);
    TextView title = (TextView) element.findViewById(R.id.title);
    TextView album = (TextView) element.findViewById(R.id.album);
    TextView artist = (TextView) element.findViewById(R.id.artist);
    ImageButton addButton = (ImageButton) element.findViewById(R.id.btn_add_to_playlist);

    String macAddress = metadataList.get(position).getMacAddress();

    User user = users.getUserByMACAddress(macAddress);
    if (user != null) {
        userColor.setBackgroundColor(user.getColor());
    } else {
        Log.wtf(TAG, "User with mac address " + macAddress + " not found.  Using default color.");
        userColor.setBackgroundColor(mContext.getResources().getColor(R.color.transparent));
    }

    //set the default sizes
    userColor.setMinimumHeight((int) mContext.getResources().getDimension(R.dimen.song_height));
    title.setSingleLine(true);
    artist.setSingleLine(true);
    album.setSingleLine(true);

    addButton.setTag(position);
    addButton.setContentDescription(
            ContentDescriptionUtils.addToPlaylistAppendSongTitle(metadataList.get(position)));

    title.setText(metadataList.get(position).getTitle());
    artist.setText(metadataList.get(position).getArtist());
    album.setText(metadataList.get(position).getAlbum());

    artist.setMaxWidth(parent.getWidth() / 2);
    /*
    final GestureDetectorCompat songGesture = new GestureDetectorCompat(mContext, new SongGestureListener(element));
    element.setOnTouchListener(new View.OnTouchListener() {       
    @Override
    public boolean onTouch(View v, MotionEvent event) {
      return songGesture.onTouchEvent(event);
    }
    });*/
    return element;
}

From source file:com.arthackday.killerapp.GCMIntentService.java

@Override
protected void onRegistered(Context ctxt, String regId) {
    Log.i(getClass().getSimpleName(), "onRegistered: " + regId);

    URL url;/*from   w  w  w  .  j av a  2s. c o  m*/
    try {
        url = new URL(String.format(GCM_URL, this.getPackageName(), regId));

        // --This code works for updating a record from the feed--
        HttpPut httpPut = new HttpPut(url.toString());

        // Send request to WCF service
        DefaultHttpClient httpClient = new DefaultHttpClient();

        HttpResponse response = httpClient.execute(httpPut);
        HttpEntity entity1 = response.getEntity();

        if (entity1 != null && (response.getStatusLine().getStatusCode() == 201
                || response.getStatusLine().getStatusCode() == 200)) {
            // --just so that you can view the response, this is optional--
            int sc = response.getStatusLine().getStatusCode();
            String sl = response.getStatusLine().getReasonPhrase();
        } else {
            int sc = response.getStatusLine().getStatusCode();
            String sl = response.getStatusLine().getReasonPhrase();
        }

    } catch (MalformedURLException e) {
        Log.wtf("ArtHackDay", "failure");
    } catch (ClientProtocolException e) {
        Log.wtf("ArtHackDay", "failure");
    } catch (IOException e) {
        Log.wtf("ArtHackDay", "failure");
    }
}

From source file:com.hmsoft.libcommon.gopro.GoProController.java

private HttpURLConnection getHttpURLConnection(String urlStr) {
    URL url;//from  w  w w. j  a v a2  s  . co  m
    try {
        url = new URL(urlStr);
    } catch (MalformedURLException e) {
        Log.wtf(TAG, e);
        return null;
    }

    HttpURLConnection urlConnection;
    try {
        urlConnection = (HttpURLConnection) url.openConnection();
    } catch (IOException e) {
        Logger.error(TAG, "Can't connect to camera.", e);
        return null;
    }

    if (BuildConfig.DEBUG)
        Logger.debug(TAG, "Connected to URL: %s", urlStr);

    urlConnection.setConnectTimeout(5000);
    urlConnection.setReadTimeout(10000);

    return urlConnection;
}

From source file:com.fortysevendeg.lab.WeatherTask.java

/**
 * Performs work in the background invoking the weather remote service and parses the xml results into temp values
 * @param strings the place params to search form
 * @return the temperature in celsius//from w  w  w  .j a  va2  s  .com
 */
@Override
protected final Integer doInBackground(String... strings) {
    int temp = ERROR;
    try {
        String xml = fetchWeatherData(strings[0]);
        if (xml != null) {
            XPathFactory factory = XPathFactory.newInstance();
            XPath xpath = factory.newXPath();
            XPathExpression expr = xpath.compile(context.getString(R.string.xpath_weather_service_temperature));
            Object result = expr.evaluate(new InputSource(new StringReader(xml)), XPathConstants.NODESET);
            NodeList nodes = (NodeList) result;
            if (nodes.getLength() > 0) {
                temp = Integer.valueOf(nodes.item(0).getAttributes().getNamedItem("data").getNodeValue());
            }
        }
    } catch (XPathExpressionException e) {
        Log.wtf(WeatherTask.class.toString(), e);
    } catch (IOException e) {
        Log.wtf(WeatherTask.class.toString(), e);
    }
    return temp;
}