List of usage examples for android.util Log wtf
public static int wtf(String tag, String msg, Throwable tr)
From source file:org.level28.android.moca.ui.faq.FaqFragment.java
@Override public Loader<List<FaqEntry>> onCreateLoader(int id, Bundle args) { return new AsyncLoader<List<FaqEntry>>(getActivity()) { @Override// ww w . j a v a2 s. c o m public List<FaqEntry> loadInBackground() { if (BuildConfig.DEBUG) { Log.v(LOG_TAG, "loadInBackground+"); } FaqDeserializer jsonLoader = new FaqDeserializer(); List<FaqEntry> entries = Collections.emptyList(); InputStream in = null; try { in = getContext().getResources().openRawResource(R.raw.faq); entries = jsonLoader.fromInputStream(in); } catch (NotFoundException e) { // WTF? Log.wtf(LOG_TAG, "Raw JSON resource for FAQ not found", e); } catch (JsonDeserializerException e) { Log.e(LOG_TAG, "Internal Jackson error", e); } finally { if (in != null) { try { in.close(); } catch (IOException e) { // Swallow the I/O exception } } } if (BuildConfig.DEBUG) { Log.v(LOG_TAG, "loadInBackground-"); } return entries; } }; }
From source file:edu.stanford.mobisocial.dungbeetle.group_providers.GroupProviders.java
public static void runBackgroundGroupTask(long key, Runnable task) { synchronized (g_group_tasks) { for (Iterator<TaskEntry> i = g_group_tasks.iterator(); i.hasNext();) { TaskEntry t = i.next();//from w w w . j av a 2 s . com if (t.key == key) { i.remove(); } } g_group_tasks.add(new TaskEntry(key, task)); if (g_group_thread == null) { g_group_thread = new Thread("Group Worker Thread") { @Override public void run() { for (;;) { TaskEntry entry; synchronized (g_group_tasks) { if (g_group_tasks.size() == 0) { //we're done so we need a new thread for the next task g_group_thread = null; break; } entry = g_group_tasks.remove(); } try { entry.runnable.run(); } catch (Throwable t) { Log.wtf(TAG, "uncaught exception in group task", t); } } } }; g_group_thread.start(); } } }
From source file:de.jadehs.jadehsnavigator.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); /***** DATABSE SANITY CHECK ****/ try {/*www .j ava 2 s .co m*/ DBHelper dbHelper = new DBHelper(getApplicationContext()); dbHelper.getWritableDatabase(); } catch (Exception ex) { Log.wtf(TAG, "Err", ex); } /**** START GCM INIT ****/ //@todo: Wird vorerst nicht implementiert, da nicht essentiell und kein Server bereitsteht.. /* registrationBroadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { Preferences preferences = new Preferences(getApplicationContext()); Toast.makeText(getApplicationContext(), "DEBUG: Broadcast erhalten", Toast.LENGTH_LONG).show(); } }; */ /*** END GCM INIT ***/ mTitle = mDrawerTitle = getTitle(); navMenuTitles = getResources().getStringArray(R.array.nav_drawer_items); navMenuIcons = getResources().obtainTypedArray(R.array.nav_drawer_icons); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerList = (ListView) findViewById(R.id.list_slidermenu); navDrawerItems = new ArrayList<NavDrawerItem>(); //navDrawerItems.add(new NavDrawerItem(navMenuTitles[0], navMenuIcons.getResourceId(0, -1))); //home navDrawerItems.add(new NavDrawerItem(navMenuTitles[0], navMenuIcons.getResourceId(0, -1))); //neuigkeiten navDrawerItems.add(new NavDrawerItem(navMenuTitles[1], navMenuIcons.getResourceId(1, -1))); //infosys navDrawerItems.add(new NavDrawerItem(navMenuTitles[2], navMenuIcons.getResourceId(2, -1))); //vorlesungsplan navDrawerItems.add(new NavDrawerItem(navMenuTitles[3], navMenuIcons.getResourceId(3, -1))); //mensaplan navDrawerItems.add(new NavDrawerItem(navMenuTitles[4], navMenuIcons.getResourceId(4, -1))); //lageplan navDrawerItems.add(new NavDrawerItem(navMenuTitles[5], navMenuIcons.getResourceId(5, -1))); //about navDrawerItems.add(new NavDrawerItem(navMenuTitles[6], navMenuIcons.getResourceId(6, -1))); //settings navMenuIcons.recycle(); mDrawerList.setOnItemClickListener(new SlideMenuClickListener()); adapter = new NavDrawerListAdapter(getApplicationContext(), navDrawerItems); mDrawerList.setAdapter(adapter); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeButtonEnabled(true); mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.string.navigation_drawer_open, R.string.navigation_drawer_close) { public void onDrawerClosed(View view) { getSupportActionBar().setTitle(mTitle); invalidateOptionsMenu(); } public void onDrawerOpened(View drawerView) { getSupportActionBar().setTitle(mDrawerTitle); invalidateOptionsMenu(); } }; mDrawerLayout.setDrawerListener(mDrawerToggle); Preferences preferences = new Preferences(this); if (savedInstanceState == null) { //displayView(1); int index = Integer.parseInt(preferences.get("IndexPreference_list", "1")); displayView(index); } /* * @todo: Gehrt zu Google Cloud Messages. Vorerst ausgeschaltet. if (checkPlayServices()){ // Starte Registration.. Intent intent = new Intent(this, RegistrationIntentService.class); startService(intent); } */ /***** START FIRST TIME SETUP ****/ if (!preferences.getBoolean("setupDone", false)) { Log.wtf(TAG, "Setup is not yet done"); // show the user that there is a drawer menu mDrawerLayout.openDrawer(Gravity.LEFT); // don't show this dialog again and set the flag to remind of feedback preferences.save("setupDone", true); preferences.save("feedbackReminderSeen", false); final AlertDialog.Builder builder = new AlertDialog.Builder(getApplicationContext()); builder.setMessage(getApplicationContext().getString(R.string.alert_firsttimesetup)).setCancelable(true) .setPositiveButton(getApplicationContext().getString(R.string.positive), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { try { Intent intent = new Intent(MainActivity.this, SettingsActivity.class); startActivity(intent); } catch (Exception ex) { Log.wtf(TAG, "Preference Activity failed", ex); } } }) .setNegativeButton(getApplicationContext().getString(R.string.negative), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); final AlertDialog alert = builder.create(); alert.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT); alert.show(); } else if (preferences.getBoolean("setupDone", false) && !preferences.getBoolean("feedbackReminderSeen", false)) { // remind to leave feedback preferences.save("feedbackReminderSeen", true); final AlertDialog.Builder builder = new AlertDialog.Builder(getApplicationContext()); builder.setMessage(getApplicationContext().getString(R.string.alert_feedbackreminder)) .setCancelable(true).setPositiveButton(getApplicationContext().getString(R.string.positive), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { try { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + getPackageName()))); } catch (Exception ex) { Log.wtf(TAG, "Store Activity failed", ex); } } }) .setNegativeButton(getApplicationContext().getString(R.string.negative), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); final AlertDialog alert = builder.create(); alert.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT); alert.show(); } else { // we already showed the reminder Log.wtf(TAG, "Setup is already done. Business as usual"); } /**** END FIRST TIME SETUP ****/ }
From source file:com.appsimobile.appsii.module.weather.loader.YahooWeatherApiClient.java
private static String buildWeatherQueryUrl(CircularArray<String> woeids, String unit) { // http://developer.yahoo.com/weather/ String endPoint = "https://query.yahooapis.com/v1/public/yql?format=json&q="; String query = "select * from weather.forecast where woeid in (%s) and u=\"%s\""; String param = ArrayUtils.join(", ", woeids); String queryString = String.format(Locale.ROOT, query, param, unit); if (BuildConfig.DEBUG) Log.d("YahooWeatherApiClient", "yql query: " + queryString); try {/* w w w . j a va2 s . co m*/ queryString = URLEncoder.encode(queryString, "UTF-8"); } catch (UnsupportedEncodingException e) { Log.wtf("YahooWeatherApiClient", "error encoding url", e); } return endPoint + queryString; }
From source file:org.level28.android.moca.ui.twitter.TwitterFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Assemble the final search url StringBuilder sb = new StringBuilder(API_BASE_URL); String encodedQuery = null;/*www .j a v a 2 s .c o m*/ try { encodedQuery = URLEncoder.encode(TWITTER_QUERY, "UTF-8"); } catch (UnsupportedEncodingException e) { // WTF?!?!?! Log.wtf(LOG_TAG, "Twitter search query encoding failed", e); } if (encodedQuery != null) { TWITTER_SEARCH_URL = sb.append(encodedQuery).toString(); } else { TWITTER_SEARCH_URL = ""; } }
From source file:com.snicesoft.basekit.LogKit.java
public static void wtf(String content, Throwable tr) { if (!allowWtf) return;//from w w w. j a va2s .c o m StackTraceElement caller = getCallerStackTraceElement(); String tag = generateTag(caller); Log.wtf(tag, content, tr); }
From source file:org.catnut.fragment.OAuthFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // set actionbar mActionBar = getActivity().getActionBar(); setHasOptionsMenu(true);//w ww. jav a 2s .c o m // set the auth webview mWebView = new WebView(getActivity()); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); mWebView.setLayoutParams(params); mWebView.setWebViewClient(new WebViewClient() { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { if (!url.startsWith(Manifest.AUTH_REDIRECT_URI)) { return false; } String code = Uri.parse(url).getQueryParameter("code"); Log.d(TAG, "the auth code is " + code); String accessTokenUri = Manifest.getAccessTokenUri(code); mProgressDialog = ProgressDialog.show(getActivity(), null, getString(R.string.authing_hint), true, false); mRequestQueue.add(new JsonObjectRequest(Request.Method.POST, accessTokenUri, null, new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject response) { Log.i(TAG, "auth success with result: " + response.toString()); mApp.saveAccessToken(response); Toast.makeText(getActivity(), getString(R.string.auth_success), Toast.LENGTH_SHORT) .show(); // fetch user' s profile mRequestQueue.add( new CatnutRequest(getActivity(), UserAPI.profile(mApp.getAccessToken().uid), new UserProcessor.UserProfileProcessor(), new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject response) { mProgressDialog.dismiss(); mApp.getPreferences().edit() .putString(User.screen_name, response.optString(User.screen_name)) .commit(); Intent intent = new Intent(getActivity(), MainActivity.class); startActivity(intent); } }, null // should not happen! )); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { Log.wtf(TAG, "auth fail!", error); WeiboAPIError e = WeiboAPIError.fromVolleyError(error); new AlertDialog.Builder(getActivity()) .setMessage(getString(R.string.auth_fail_with_reason, e.error)) .setNegativeButton(android.R.string.ok, null).show(); } })).setTag(TAG); return true; } }); }
From source file:com.google.android.gms.common.zze.java
@Deprecated public static int isGooglePlayServicesAvailable(Context context) { if (zzd.zzakE) { return GOOGLE_PLAY_SERVICES_VERSION_CODE; }//from www . j a v a2 s.c om PackageManager packageManager = context.getPackageManager(); try { context.getResources().getString(C0434R.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 (!GOOGLE_PLAY_SERVICES_PACKAGE.equals(context.getPackageName())) { zzan(context); } try { PackageInfo packageInfo = packageManager.getPackageInfo(GOOGLE_PLAY_SERVICES_PACKAGE, 64); zzf zzoO = zzf.zzoO(); if (!zzmu.zzaw(context)) { try { if (zzoO.zza(packageManager.getPackageInfo(GOOGLE_PLAY_STORE_PACKAGE, 8256), zzd.zzafK) == null) { Log.w("GooglePlayServicesUtil", "Google Play Store signature invalid."); return 9; } if (zzoO.zza(packageInfo, zzoO.zza( packageManager.getPackageInfo(GOOGLE_PLAY_STORE_PACKAGE, 8256), zzd.zzafK)) == 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 (zzoO.zza(packageInfo, zzd.zzafK) == null) { Log.w("GooglePlayServicesUtil", "Google Play services signature invalid."); return 9; } if (zzmx.zzco(packageInfo.versionCode) < zzmx.zzco(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(GOOGLE_PLAY_SERVICES_PACKAGE, GOOGLE_PLAY_SERVICES_VERSION_CODE); } catch (Throwable e2) { Log.wtf("GooglePlayServicesUtil", "Google Play services missing when getting application info.", e2); return 1; } } return !applicationInfo.enabled ? 3 : GOOGLE_PLAY_SERVICES_VERSION_CODE; } catch (NameNotFoundException e3) { Log.w("GooglePlayServicesUtil", "Google Play services is missing."); return 1; } }
From source file:com.ptts.sync.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./* w w w . j a v a2 s . c o m*/ */ @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); 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 (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 (JSONException 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; } catch (Throwable t) { Log.i(TAG, "thrown error"); } Log.i(TAG, "Network synchronization complete"); }
From source file:com.silentcircle.contacts.utils.HelpUtils.java
/** * Adds two query parameters into the Uri, namely the language code and the version code * of the app's package as gotten via the context. * @return the uri with added query parameters */// ww w . j a va 2 s .co m private static Uri uriWithAddedParameters(Context context, Uri baseUri) { Uri.Builder builder = baseUri.buildUpon(); // Add in the preferred language builder.appendQueryParameter(PARAM_LANGUAGE_CODE, Locale.getDefault().toString()); // Add in the package version code if (sCachedVersionCode == null) { // There is no cached version code, so try to get it from the package manager. try { // cache the version code PackageInfo info = context.getPackageManager().getPackageInfo(context.getPackageName(), 0); sCachedVersionCode = Integer.toString(info.versionCode); // append the version code to the uri builder.appendQueryParameter(PARAM_VERSION, sCachedVersionCode); } catch (NameNotFoundException e) { // Cannot find the package name, so don't add in the version parameter // This shouldn't happen. Log.wtf(TAG, "Invalid package name for context", e); } } else { builder.appendQueryParameter(PARAM_VERSION, sCachedVersionCode); } // Build the full uri and return it return builder.build(); }