Example usage for android.util Log v

List of usage examples for android.util Log v

Introduction

In this page you can find the example usage for android.util Log v.

Prototype

public static int v(String tag, String msg) 

Source Link

Document

Send a #VERBOSE log message.

Usage

From source file:com.rfo.basic.Web.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    Log.v(LOGTAG, "onCreate");
    super.onCreate(savedInstanceState);
    ContextManager cm = Basic.getContextManager();
    cm.registerContext(ContextManager.ACTIVITY_WEB, this);
    cm.setCurrent(ContextManager.ACTIVITY_WEB);

    setContentView(R.layout.web);/*from  ww  w. j  a  v  a 2  s. co m*/
    View v = findViewById(R.id.web_engine);

    Intent intent = getIntent();
    int showStatusBar = intent.getIntExtra(EXTRA_SHOW_STATUSBAR, 0);
    int orientation = intent.getIntExtra(EXTRA_ORIENTATION, -1);

    showStatusBar = (showStatusBar == 0) ? WindowManager.LayoutParams.FLAG_FULLSCREEN // do not show status bar
            : WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN; // show status bar
    getWindow().setFlags(showStatusBar, showStatusBar);

    setOrientation(orientation);

    engine = (WebView) v;

    WebSettings webSettings = engine.getSettings();
    webSettings.setJavaScriptEnabled(true);
    webSettings.setBuiltInZoomControls(true);
    webSettings.setSupportZoom(true);
    webSettings.setAppCacheEnabled(true);
    webSettings.setDatabaseEnabled(true);
    webSettings.setDomStorageEnabled(true);
    webSettings.setAllowFileAccess(true);
    webSettings.setGeolocationEnabled(true);
    webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE);

    engine.addJavascriptInterface(new JavaScriptInterface(), "Android");

    engine.setWebViewClient(new MyWebViewClient());

    aWebView = new TheWebView(this);

    engine.setWebChromeClient(new WebChromeClient() {
        @Override
        public boolean onJsAlert(WebView view, String url, String message, JsResult result) {
            //Required functionality here
            return super.onJsAlert(view, url, message, result);
        }
    });

}

From source file:com.meetingninja.csse.user.ProfileFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    pageView = inflater.inflate(R.layout.fragment_profile, container, false);
    setupViews(pageView);//from www  .  j  a  v  a  2 s  .c  o  m
    session = SessionManager.getInstance();

    Bundle extras = getArguments();
    displayedUser = new User();

    if (extras != null && extras.containsKey(Keys.User.PARCEL)) {

        displayedUser = ((UserParcel) extras.getParcelable(Keys.User.PARCEL)).getUser();
        try {
            System.out.println(JsonUtils.getObjectMapper().writeValueAsString(displayedUser));
        } catch (JsonProcessingException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    } else {
        Log.v(TAG, "Displaying Current User");
        displayedUser.setID(session.getUserID());
    }
    if (extras != null && extras.containsKey("notMine")) {
        menu = R.menu.menu_profile;
    } else {
        menu = R.menu.menu_view_profile;
    }
    setHasOptionsMenu(true);
    fetchUserInfo(displayedUser.getID());

    return pageView;

}

From source file:com.lge.friendsCamera.CaptureIntervalActivity.java

@Override
protected void onResume() {
    super.onResume();
    Log.v(TAG, TAG + " onResume");
    if (!WifiReceiver.isConnected()) {
        ((CaptureIntervalActivity) mContext).finish();
    }// w  ww . ja v  a  2s. c om
}

From source file:ch.ethz.dcg.pancho3.view.youtube.Query.java

public String getVideosFromYouTubeServer() throws Exception {
    String urlStr = getQueryURL();
    Log.v(TAG, urlStr);
    InputStream is = null;/* ww w.  j  ava2  s .c o  m*/
    StringBuilder contents = new StringBuilder();

    try {
        is = getVideosInputStreamFromUrl(urlStr);
        BufferedReader bufread = new BufferedReader(new InputStreamReader(is));
        try {
            String url = null;
            while ((url = bufread.readLine()) != null) {
                contents.append(url);
                contents.append(System.getProperty("url.separator"));
            }
        } finally {
            bufread.close();
        }
    } catch (Exception ex) {
        Log.w(TAG, ex);
    }

    return contents.toString();

}

From source file:co.uk.gauntface.cordova.plugin.nativegplussignin.CordovaGPlusOauthPlugin.java

@Override
public boolean execute(String action, JSONArray args, final CallbackContext callbackContext)
        throws JSONException {
    Log.v(C.TAG, "CordovaGPlusOauthPlugin: execute() action = " + action);
    if (action.equals("loginGPlus")) {
        this.cordova.getThreadPool().execute(new Runnable() {
            @Override//from  w w w.  jav a 2  s .  co m
            public void run() {
                mCallbackContext = callbackContext;
                CordovaGPlusOauthPlugin.this.cordova.setActivityResultCallback(CordovaGPlusOauthPlugin.this);

                if (!getPlusClient().isConnected()) {
                    Log.v(C.TAG, "CordovaGPlusOauthPlugin: Signing into G+");
                    getPlusClient().connect();
                } else {
                    Log.v(C.TAG, "CordovaGPlusOauthPlugin: Already connected to G+");
                    new IDTokenFetcher(CordovaGPlusOauthPlugin.this.cordova.getActivity(), mCallbackContext)
                            .execute(mPlusClient.getAccountName());
                }
            }
        });

    }

    return true;
}

From source file:com.vladstirbu.cordova.Gamepad.java

/**
 * @param cordova The context of the main Activity.
 * @param webView The associated CordovaWebView.
 *///from  w ww .ja  v  a2  s  .  co m
@Override
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
    super.initialize(cordova, webView);

    this.map.put("KEYCODE_BUTTON_A", 0);
    this.map.put("KEYCODE_BUTTON_B", 1);
    this.map.put("KEYCODE_BUTTON_Y", 3);
    this.map.put("KEYCODE_BUTTON_X", 2);
    this.map.put("KEYCODE_BUTTON_L1", 4);
    this.map.put("KEYCODE_BUTTON_R1", 5);
    this.map.put("KEYCODE_BUTTON_L2", 6);
    this.map.put("KEYCODE_BUTTON_R2", 7);
    this.map.put("KEYCODE_SPACE", 8);
    this.map.put("KEYCODE_SELECT", 8);
    this.map.put("KEYCODE_ENTER", 9);
    this.map.put("KEYCODE_START", 9);
    this.map.put("KEYCODE_BUTTON_THUMBL", 10);
    this.map.put("KEYCODE_BUTTON_THUMBR", 11);
    this.map.put("KEYCODE_DPAD_UP", 12);
    this.map.put("KEYCODE_DPAD_DOWN", 13);
    this.map.put("KEYCODE_DPAD_LEFT", 14);
    this.map.put("KEYCODE_DPAD_RIGHT", 15);
    this.map.put("KEYCODE_BACK", 16);
    this.map.put("KEYCODE_BUTTON_MODE", 16);

    this.webView.setFocusable(true);
    this.webView.setFocusableInTouchMode(true);
    this.webView.requestFocus();

    this.webView.setOnKeyListener(new OnKeyListener() {

        @Override
        public boolean onKey(View v, int keyCode, KeyEvent event) {
            //Log.v("Keyboards", String.valueOf(InputDevice.getDeviceIds().length));
            //Log.v("Input", InputDevice.getDevice(1).getName());
            //Log.v("Input", String.valueOf(InputDevice.getDevice(1).getSources()));

            //Log.v("Device id", String.valueOf(event.getDeviceId()));
            //Log.v("Source id", String.valueOf(event.getSource()));
            //Log.v("Input device", String.valueOf(InputDevice.getDevice(event.getDeviceId()).getName()));
            Log.v("KEY", String.valueOf(event.getScanCode()));
            Log.v("KEY", KeyEvent.keyCodeToString(keyCode));
            //Log.v("GamePad", String.valueOf(KeyEvent.isGamepadButton(keyCode)));

            String jsStr = jsString(keyCode, event);
            if (!jsStr.isEmpty()) {
                self.webView.sendJavascript(jsStr);
            }
            return true;
        }
    });
    this.webView.setOnGenericMotionListener(new OnGenericMotionListener() {
        public boolean onGenericMotion(View v, MotionEvent event) {
            if (event.isFromSource(InputDevice.SOURCE_CLASS_JOYSTICK)) {
                if (event.getAction() == MotionEvent.ACTION_MOVE) {
                    // process the joystick movement...
                    JSONObject data = new JSONObject();
                    JSONArray axes = new JSONArray();
                    try {
                        axes.put(event.getAxisValue(MotionEvent.AXIS_X));
                        axes.put(event.getAxisValue(MotionEvent.AXIS_Y));
                        axes.put(event.getAxisValue(MotionEvent.AXIS_Z));
                        axes.put(event.getAxisValue(MotionEvent.AXIS_RZ));
                        data.put("deviceId", event.getDeviceId());
                        data.put("axes", axes);
                    } catch (JSONException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
                    self.webView.sendJavascript(
                            "cordova.fireWindowEvent('GamepadMotion', " + data.toString() + ");");

                    data = new JSONObject();
                    try {
                        data.put("deviceId", event.getDeviceId());
                        data.put("button", 6);
                        data.put("value", event.getAxisValue(MotionEvent.AXIS_LTRIGGER));
                    } catch (JSONException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
                    self.webView.sendJavascript(
                            "cordova.fireWindowEvent('GamepadMotion', " + data.toString() + ");");

                    data = new JSONObject();
                    try {
                        data.put("deviceId", event.getDeviceId());
                        data.put("button", 7);
                        data.put("value", event.getAxisValue(MotionEvent.AXIS_RTRIGGER));
                    } catch (JSONException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
                    self.webView.sendJavascript(
                            "cordova.fireWindowEvent('GamepadMotion', " + data.toString() + ");");

                    float hatX = event.getAxisValue(MotionEvent.AXIS_HAT_X);
                    float hatY = event.getAxisValue(MotionEvent.AXIS_HAT_Y);
                    try {
                        data = new JSONObject();
                        data.put("deviceId", event.getDeviceId());
                        data.put("button", 14);
                        data.put("value", hatX < 0.0f);
                        self.webView.sendJavascript(
                                "cordova.fireWindowEvent('GamepadMotion', " + data.toString() + ");");
                        data = new JSONObject();
                        data.put("deviceId", event.getDeviceId());
                        data.put("button", 15);
                        data.put("value", hatX > 0.0f);
                        self.webView.sendJavascript(
                                "cordova.fireWindowEvent('GamepadMotion', " + data.toString() + ");");
                    } catch (JSONException e) {
                    }
                    try {
                        data = new JSONObject();
                        data.put("deviceId", event.getDeviceId());
                        data.put("button", 12);
                        data.put("value", hatY < 0.0f);
                        self.webView.sendJavascript(
                                "cordova.fireWindowEvent('GamepadMotion', " + data.toString() + ");");
                        data = new JSONObject();
                        data.put("deviceId", event.getDeviceId());
                        data.put("button", 13);
                        data.put("value", hatY > 0.0f);
                        self.webView.sendJavascript(
                                "cordova.fireWindowEvent('GamepadMotion', " + data.toString() + ");");
                    } catch (JSONException e) {
                    }
                }
                Log.v("MOTION", event.toString());
                return true;
            }
            return false;
        }
    });

    Log.v("GamepadButtons", "initialized");
}

From source file:com.alphabetbloc.accessmrs.services.SyncAdapter.java

@Override
public void onPerformSync(Account account, Bundle extras, String authority, ContentProviderClient provider,
        final SyncResult syncResult) {

    long before = System.currentTimeMillis();
    if (App.DEBUG)
        Log.v(TAG, "Sync Requested... asking user.");
    Thread.currentThread().setName(TAG);

    mSyncManager = new SyncManager(mContext);

    // ask user to sync
    int count = 0;
    while (!SyncManager.sStartSync.get() && !SyncManager.sCancelSync.get() && count < 20) {
        android.os.SystemClock.sleep(1000);
        count++;/* w  w  w  . ja v  a 2  s  .  c o m*/
        if (App.DEBUG)
            Log.v(TAG, "Waiting for User with count=" + count);
    }

    // sync
    if (!SyncManager.sCancelSync.get()) {
        if (App.DEBUG)
            Log.v(TAG, "Starting an actual sync");
        // Inform Activity
        Intent broadcast = new Intent(SyncManager.SYNC_MESSAGE);
        broadcast.putExtra(SyncManager.START_NEW_SYNC, true);
        LocalBroadcastManager.getInstance(mContext).sendBroadcast(broadcast);

        // Start the Sync
        performSync(syncResult);
    } else {
        if (App.DEBUG)
            Log.v(TAG, "User cancelled the sync");
    }

    SyncManager.sEndSync.set(true);
    SyncManager.sStartSync.set(false);
    SyncManager.sCancelSync.set(false);

    if (App.DEBUG)
        Log.v(TAG, "sync is now ending");
    if (App.DEBUG)
        Log.v("SYNC BENCHMARK",
                "Total Sync Time: \n" + sTimeLog.format(new Date(System.currentTimeMillis() - before)));
}

From source file:org.cm.podd.report.util.RequestDataUtil.java

public static ResponseObject post(String path, String query, String json, String token) {
    JSONObject jsonObj = null;/*from  www. j a v a  2s  .  c  om*/
    int statusCode = 0;

    //SharedPreferences settings = PoddApplication.getAppContext().getSharedPreferences("PoddPrefsFile", 0);
    String serverUrl = settings.getString("serverUrl", BuildConfig.SERVER_URL);
    String reqUrl = "";

    if (path.contains("http://") || path.contains("https://")) {
        reqUrl = String.format("%s%s", path, query == null ? "" : "?" + query);
    } else {
        reqUrl = String.format("%s%s%s", serverUrl, path, query == null ? "" : "?" + query);
    }

    Log.i(TAG, "submit url=" + reqUrl);
    Log.i(TAG, "post data=" + json);

    HttpParams params = new BasicHttpParams();
    params.setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_1);
    HttpClient client = new DefaultHttpClient(params);

    try {
        HttpPost post = new HttpPost(reqUrl);
        post.setHeader("Content-Type", "application/json");
        if (token != null) {
            post.setHeader("Authorization", "Token " + token);
        }
        post.setEntity(new StringEntity(json, HTTP.UTF_8));

        HttpResponse response;
        response = client.execute(post);
        HttpEntity entity = response.getEntity();

        // Detect server complaints
        statusCode = response.getStatusLine().getStatusCode();
        Log.v(TAG, "status code=" + statusCode);

        if (statusCode == HttpURLConnection.HTTP_OK || statusCode == HttpURLConnection.HTTP_CREATED
                || statusCode == HttpURLConnection.HTTP_BAD_REQUEST) {
            InputStream in = entity.getContent();
            String resp = FileUtil.convertInputStreamToString(in);

            jsonObj = new JSONObject(resp);
            entity.consumeContent();
        }

    } catch (ClientProtocolException e) {
        Log.e(TAG, "error post data", e);
    } catch (IOException e) {
        Log.e(TAG, "Can't connect server", e);
    } catch (JSONException e) {
        Log.e(TAG, "error convert json", e);
    } finally {
        client.getConnectionManager().shutdown();
    }
    return new ResponseObject(statusCode, jsonObj);
}

From source file:com.diona.fileReader.CipherUtil.java

public void initialize(CordovaInterface cordova, CordovaWebView webView) {
    super.initialize(cordova, webView);
    Log.v(TAG, "Init File Reader plugin");
}

From source file:org.vuphone.assassins.android.http.HTTPGetter.java

private static HashMap<String, Double> handleGameAreaResponse(HttpGet get) {

    HttpResponse resp;/*from   w ww .  j  a va  2  s  .co m*/

    // Execute the get
    try {
        resp = c.execute(get);
    } catch (ClientProtocolException e1) {
        e1.printStackTrace();
        Log.e(VUphone.tag, pre + "HTTP error while executing post");
        return null;
    } catch (SocketException se) {
        // If we have no Internet connection, we don't want to wipe the
        // existing list of land mines by returning null.
        Log.e(VUphone.tag, pre + "SocketException: Invalid Internet " + "Connection");
        se.printStackTrace();
        return null;
    } catch (IOException e1) {
        e1.printStackTrace();
        Log.e(VUphone.tag, pre + "HTTP error in server response");
        return null;
    } catch (Exception e) {
        Log.e(VUphone.tag, pre + "An unknown exception was thrown");
        e.printStackTrace();
        return null;
    }

    Log.i(VUphone.tag, pre + "HTTP operation complete. Processing response.");

    // Convert Response Entity to usable format
    ByteArrayOutputStream bao = new ByteArrayOutputStream();
    try {
        resp.getEntity().writeTo(bao);
        Log.v(VUphone.tag, pre + "Http response: " + bao);
    } catch (IOException e) {
        e.printStackTrace();
        Log.e(VUphone.tag, pre + "Unable to write response to byte[]");
        return null;
    }

    if (bao.size() == 0) {
        Log.w(VUphone.tag,
                pre + "Response was completely empty, " + "are you sure you are using the "
                        + "same version client and server? " + "At the least, there should have "
                        + "been empty XML here");
    }

    HashMap<String, Double> data = new HashMap<String, Double>();

    String response = bao.toString();
    String[] vals = response.split("&");
    for (int i = 0; i < vals.length; i++) {
        String[] val = vals[i].split("=");
        data.put(val[0], Double.valueOf(val[1]));
    }

    return data;
}