List of usage examples for android.util Log v
public static int v(String tag, String msg)
From source file:mr.robotto.MrRobottoEngine.java
/** * Loads a new scene from stream//from w w w. j a va2 s. c o m * @param inputStream stream containing the scene * @return the loaded scene for chaining */ public MrSceneTree loadSceneTree(InputStream inputStream) { long startTime = System.currentTimeMillis(); MrMrrLoader loader = new MrMrrLoader(inputStream); MrSceneTree tree = null; try { //tree = loader.parse(); //mController = new MrSceneTreeController(tree, new MrSceneTreeRender()); mSceneTree = loader.parse(); initialize(); long stopTime = System.currentTimeMillis(); Log.v("Load Time(ms)", String.valueOf(stopTime - startTime)); return tree; } catch (IOException e) { e.printStackTrace(); } catch (JSONException e) { e.printStackTrace(); } return null; }
From source file:com.achie.tv.ContestantImageGrid.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mContext = this; mImageManager = ImageManager.getInstance(mContext); try {// w w w .j a v a 2 s.co m handleIntent(getIntent()); } catch (final IOException e) { e.printStackTrace(); } catch (final URISyntaxException e) { e.printStackTrace(); } catch (final JSONException e) { e.printStackTrace(); } Bundle extras = getIntent().getExtras(); if (extras != null) { String tvShowString = extras.getString("show", ""); Log.v(tag, "show string " + tvShowString); query = tvShowString; } if (!isSplashShown) { setContentView(R.layout.splash_screen_c); isSplashShown = true; CountDownTimer timer = new CountDownTimer(3000, 1000) { public void onTick(long millisUntilFinished) { } public void onFinish() { initGridView(); } }.start(); } else { initGridView(); } }
From source file:com.klinker.android.twitter.utils.api_helper.TwitterDMPicHelper.java
public Bitmap getDMPicture(String picUrl, Twitter twitter) { try {/*from w w w . j ava2s . co m*/ AccessToken token = twitter.getOAuthAccessToken(); String oauth_token = token.getToken(); String oauth_token_secret = token.getTokenSecret(); // generate authorization header String get_or_post = "GET"; String oauth_signature_method = "HMAC-SHA1"; String uuid_string = UUID.randomUUID().toString(); uuid_string = uuid_string.replaceAll("-", ""); String oauth_nonce = uuid_string; // any relatively random alphanumeric string will work here // get the timestamp Calendar tempcal = Calendar.getInstance(); long ts = tempcal.getTimeInMillis();// get current time in milliseconds String oauth_timestamp = (new Long(ts / 1000)).toString(); // then divide by 1000 to get seconds // the parameter string must be in alphabetical order, "text" parameter added at end String parameter_string = "oauth_consumer_key=" + AppSettings.TWITTER_CONSUMER_KEY + "&oauth_nonce=" + oauth_nonce + "&oauth_signature_method=" + oauth_signature_method + "&oauth_timestamp=" + oauth_timestamp + "&oauth_token=" + encode(oauth_token) + "&oauth_version=1.0"; String twitter_endpoint = picUrl; String twitter_endpoint_host = picUrl.substring(0, picUrl.indexOf("1.1")).replace("https://", "") .replace("/", ""); String twitter_endpoint_path = picUrl.replace("ton.twitter.com", "").replace("https://", ""); String signature_base_string = get_or_post + "&" + encode(twitter_endpoint) + "&" + encode(parameter_string); String oauth_signature = computeSignature(signature_base_string, AppSettings.TWITTER_CONSUMER_SECRET + "&" + encode(oauth_token_secret)); Log.v("talon_dm_image", "endpoint_host: " + twitter_endpoint_host); Log.v("talon_dm_image", "endpoint_path: " + twitter_endpoint_path); String authorization_header_string = "OAuth oauth_consumer_key=\"" + AppSettings.TWITTER_CONSUMER_KEY + "\",oauth_signature_method=\"HMAC-SHA1\",oauth_timestamp=\"" + oauth_timestamp + "\",oauth_nonce=\"" + oauth_nonce + "\",oauth_version=\"1.0\",oauth_signature=\"" + encode(oauth_signature) + "\",oauth_token=\"" + encode(oauth_token) + "\""; HttpParams params = new BasicHttpParams(); HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1); HttpProtocolParams.setContentCharset(params, "UTF-8"); HttpProtocolParams.setUserAgent(params, "HttpCore/1.1"); HttpProtocolParams.setUseExpectContinue(params, false); HttpProcessor httpproc = new ImmutableHttpProcessor(new HttpRequestInterceptor[] { // Required protocol interceptors new RequestContent(), new RequestTargetHost(), // Recommended protocol interceptors new RequestConnControl(), new RequestUserAgent(), new RequestExpectContinue() }); HttpRequestExecutor httpexecutor = new HttpRequestExecutor(); HttpContext context = new BasicHttpContext(null); HttpHost host = new HttpHost(twitter_endpoint_host, 443); DefaultHttpClientConnection conn = new DefaultHttpClientConnection(); context.setAttribute(ExecutionContext.HTTP_CONNECTION, conn); context.setAttribute(ExecutionContext.HTTP_TARGET_HOST, host); SSLContext sslcontext = SSLContext.getInstance("TLS"); sslcontext.init(null, null, null); SSLSocketFactory ssf = sslcontext.getSocketFactory(); Socket socket = ssf.createSocket(); socket.connect(new InetSocketAddress(host.getHostName(), host.getPort()), 0); conn.bind(socket, params); BasicHttpEntityEnclosingRequest request2 = new BasicHttpEntityEnclosingRequest("GET", twitter_endpoint_path); request2.setParams(params); request2.addHeader("Authorization", authorization_header_string); httpexecutor.preProcess(request2, httpproc, context); HttpResponse response2 = httpexecutor.execute(request2, conn, context); response2.setParams(params); httpexecutor.postProcess(response2, httpproc, context); StatusLine statusLine = response2.getStatusLine(); int statusCode = statusLine.getStatusCode(); if (statusCode == 200 || statusCode == 302) { HttpEntity entity = response2.getEntity(); byte[] bytes = EntityUtils.toByteArray(entity); Bitmap bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.length); return bitmap; } else { Log.v("talon_dm_image", statusCode + ""); } conn.close(); } catch (Exception e) { e.printStackTrace(); } return null; }