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.quarterfull.newsAndroid.services.OwnCloudSyncService.java

@Override
public boolean onUnbind(Intent intent) {
    //Destroy service if no sync is running
    if (!syncRunning) {
        Log.v(TAG, "Stopping service because of inactivity");
        stopSelf();//  www  .j a  va2s .  c  o  m
    }

    return super.onUnbind(intent);
}

From source file:org.mythtv.service.myth.v25.HostHelperV25.java

private List<String> downloadHosts(final LocationProfile locationProfile)
        throws MythServiceApiRuntimeException, RemoteException, OperationApplicationException {
    Log.v(TAG, "downloadHosts : enter");

    List<String> hosts = null;

    ResponseEntity<org.mythtv.services.api.ArrayOfString> responseEntity = mMythServicesTemplate
            .mythOperations().getHosts(ETagInfo.createEmptyETag());

    if (responseEntity.getStatusCode().equals(HttpStatus.OK)) {

        org.mythtv.services.api.ArrayOfString hostList = responseEntity.getBody();

        if (null != hostList.getValue() && hostList.getValue().length > 0) {
            hosts = load(hostList);//  ww  w .j  av  a 2s.c  o m
        }

    }

    Log.v(TAG, "downloadHosts : exit");
    return hosts;
}

From source file:de.skubware.opentraining.activity.settings.sync.WgerImageDownloader.java

/**
 * Download the missing images from wger. If an image already exists Open
 * Training assumes that the exercise is duplicate and will remove it from
 * the download list./*  www .j a v  a 2  s .  c  om*/
 */
public ArrayList<ExerciseType> downloadImages(List<ExerciseType.Builder> exerciseBuilderList)
        throws IOException, JSONException {
    ArrayList<ExerciseType> newExerciseList = new ArrayList<ExerciseType>();

    // add label to be able to break/continue from inner loop
    outerloop: for (ExerciseType.Builder exBuilder : exerciseBuilderList) {
        List<File> newImagePathList = new ArrayList<File>();
        Map<File, License> newImageLicenseMap = new HashMap<File, License>();

        ExerciseType ex = exBuilder.build();
        for (File img : ex.getImagePaths()) {
            String imageAsJSON = mClient.get(img.getPath() + "/");

            // get image name
            JSONObject imageJSONObject = new JSONObject(imageAsJSON);
            String imageDownloadPath = imageJSONObject.getString("image");

            // parse JSON and get license
            SparseArray<LicenseType> licenseSparseArray = WgerJSONParser.parseLicenses(mLicenseJSONString);

            int licenseNumber = WgerJSONParser.getLastNumberOfJson(imageJSONObject.getString("license"));
            LicenseType licenseType = licenseSparseArray.get(licenseNumber);
            String author = imageJSONObject.getString("license_author");
            Log.v(TAG, "license=" + licenseType.toString() + " license_author=" + author);

            License license = new License(licenseType, author);
            //String licensePath = imageJSONObject.getString("license");

            // skip exercise (and image download) if there's already one with the same name
            DataHelper dataHelper = new DataHelper(mContext);
            String imageName = (new File(imageDownloadPath)).getName();
            if (dataHelper.drawableExist(imageName)) {
                Log.d(TAG,
                        "There's already an image with the same name as: " + imageDownloadPath
                                + ". The exercise: " + ex.getLocalizedName()
                                + " is propably duplicate, it will not be added.");
                continue outerloop;
            } else {
                // only download image if its name is unique
                imageName = downloadImageToSyncedImagesFolder(imageDownloadPath); // imageName may change!
            }

            // add image name + license to list/map
            File imageFile = new File(imageName);
            newImagePathList.add(imageFile);
            newImageLicenseMap.put(imageFile, license);
        }
        // set collected values for builder, add new object to exercise list
        exBuilder.imagePath(newImagePathList);
        exBuilder.imageLicenseMap(newImageLicenseMap);

        newExerciseList.add(exBuilder.build());

    }
    return newExerciseList;
}

From source file:edu.mines.letschat.MainActivity.java

@Override
public void onNewIntent(Intent intent) {
    super.onNewIntent(intent);
    Log.v(TAG, "In on new intent");
    Bundle extras = intent.getExtras();//  w  w  w . j ava 2s .  c om
    if (extras != null) {
        string = extras.getString(EXTRA_NOTIFICATION_RETRIEVE);
        if (string != null) {
            //            users.clear();
            //            new GetUsers(new OnTaskCompleted() {
            //               @Override
            //               public void onTaskCompleted() {
            Intent tent = new Intent(MainActivity.this, MessageActivity.class);
            tent.putExtra(MainActivity.EXTRA_DEVICE_ID, string);
            tent.putExtra(MainActivity.EXTRA_SENDER_ID, regid);
            for (Entry<String, String> entry : map.entrySet()) {
                if (string.equals(entry.getValue())) {
                    String username = entry.getKey();
                    Log.v(TAG, username);
                    tent.putExtra(MainActivity.EXTRA_USER_NAME, username);
                }
            }
            startActivity(tent);
            //               }
            //            }).execute();
        }
    }
}

From source file:edu.csh.coursebrowser.DepartmentActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_departments);
    // Show the Up button in the action bar.
    // getActionBar().setDisplayHomeAsUpEnabled(false);
    this.getActionBar().setHomeButtonEnabled(true);
    final Bundle b = this.getIntent().getExtras();
    map_item = new HashMap<String, Department>();
    map = new ArrayList<String>();
    Bundle args = this.getIntent().getExtras();
    this.setTitle(args.getCharSequence("from"));
    try {//from   w ww .j a v a 2  s . com
        JSONObject jso = new JSONObject(args.get("args").toString());
        JSONArray jsa = new JSONArray(jso.getString("departments"));
        ListView lv = (ListView) this.findViewById(R.id.department_list);
        ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, map);
        for (int i = 0; i < jsa.length(); ++i) {
            String s = jsa.getString(i);
            JSONObject obj = new JSONObject(s);
            Department dept = new Department(obj.getString("title"), obj.getString("id"),
                    obj.getString("code"));
            addItem(dept);
            Log.v("Added", dept.toString());
        }
        lv.setAdapter(adapter);
        lv.setOnItemClickListener(new OnItemClickListener() {

            @Override
            public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
                String s = ((TextView) arg1).getText().toString();
                final Department department = map_item.get(s);
                new AsyncTask<String, String, String>() {
                    ProgressDialog p;

                    protected void onPreExecute() {
                        p = new ProgressDialog(DepartmentActivity.this);
                        p.setTitle("Fetching Info");
                        p.setMessage("Contacting Server...");
                        p.setCancelable(false);
                        p.show();
                    }

                    protected String doInBackground(String... dep) {
                        String params = "action=getCourses&department=" + dep[0] + "&quarter="
                                + b.getString("qCode");
                        Log.v("Params", params);
                        URL url;
                        String back = "";
                        try {
                            url = new URL("http://iota.csh.rit" + ".edu/schedule/js/browseAjax" + ".php");

                            URLConnection conn = url.openConnection();
                            conn.setDoOutput(true);
                            OutputStreamWriter writer = new OutputStreamWriter(conn.getOutputStream());
                            writer.write(params);
                            writer.flush();
                            String line;
                            BufferedReader reader = new BufferedReader(
                                    new InputStreamReader(conn.getInputStream()));

                            while ((line = reader.readLine()) != null) {
                                Log.v("Back:", line);
                                back += line;
                            }
                            writer.close();
                            reader.close();
                        } catch (MalformedURLException e) {
                            // TODO Auto-generated catch block
                            e.printStackTrace();
                            return null;
                        } catch (IOException e) {
                            // TODO Auto-generated catch block
                            e.printStackTrace();
                            p.dismiss();
                            return null;
                        }
                        return back;
                    }

                    protected void onPostExecute(String s) {
                        if (s == null || s == "") {
                            new AlertError(DepartmentActivity.this, "IO Error!").show();
                            return;
                        }

                        try {
                            JSONObject jso = new JSONObject(s);
                            JSONArray jsa = new JSONArray(jso.getString("courses"));
                        } catch (JSONException e) {
                            e.printStackTrace();
                            new AlertError(DepartmentActivity.this, "Invalid JSON From Server").show();
                            p.dismiss();
                            return;
                        }
                        Intent intent = new Intent(DepartmentActivity.this, CourseActivity.class);
                        intent.putExtra("title", department.title);
                        intent.putExtra("id", department.id);
                        intent.putExtra("code", department.code);
                        intent.putExtra("args", s);
                        startActivity(intent);
                        p.dismiss();
                    }
                }.execute(department.id);
            }

        });

    } catch (JSONException e) {
        // TODO Auto-generated catch block
        new AlertError(this, "Invalid JSON");
        e.printStackTrace();
    }

}

From source file:com.digicorp.plugin.sqlitePlugin.SQLitePlugin.java

/**
 * Executes the request and returns PluginResult.
 *
 * @param action//from w w w .  j a v  a 2s.co  m
 *            The action to execute.
 *
 * @param args
 *            JSONArry of arguments for the plugin.
 *
 * @param cbc
 *            Callback context from Cordova API (not used here)
 *
 */
@Override
public boolean execute(String action, JSONArray args, CallbackContext cbc) {
    try {
        if (action.equals("open")) {
            JSONObject o = args.getJSONObject(0);
            String dbname = o.getString("name");

            this.openDatabase(dbname, null);
        } else if (action.equals("close")) {
            this.closeDatabase(args.getString(0));
        } else if (action.equals("executePragmaStatement")) {
            String dbName = args.getString(0);
            String query = args.getString(1);

            Cursor myCursor = this.getDatabase(dbName).rawQuery(query, null);
            this.processPragmaResults(myCursor, id);
        } else if (action.equals("executeSqlBatch")) {
            String[] queries = null;
            String[] queryIDs = null;
            String trans_id = null;
            JSONObject a = null;
            JSONArray jsonArr = null;
            int paramLen = 0;
            JSONArray[] jsonparams = null;

            String dbName = args.getString(0);
            JSONArray txargs = args.getJSONArray(1);

            if (txargs.isNull(0)) {
                queries = new String[0];
            } else {
                int len = txargs.length();
                queries = new String[len];
                queryIDs = new String[len];
                jsonparams = new JSONArray[len];

                for (int i = 0; i < len; i++) {
                    a = txargs.getJSONObject(i);
                    queries[i] = a.getString("query");
                    queryIDs[i] = a.getString("query_id");
                    trans_id = a.getString("trans_id");
                    jsonArr = a.getJSONArray("params");
                    paramLen = jsonArr.length();
                    jsonparams[i] = jsonArr;
                }
            }
            if (trans_id != null)
                this.executeSqlBatch(dbName, queries, jsonparams, queryIDs, trans_id);
            else
                Log.v("error", "null trans_id");
        }

        return true;
    } catch (JSONException e) {
        // TODO: signal JSON problem to JS

        return false;
    }
}

From source file:cn.xiongyihui.wificar.Car.java

public void run() {
    Looper.prepare();//from   www .j  ava  2  s . co m

    mHandler = new Handler() {
        public void handleMessage(Message msg) {
            String url = "http://" + mIp + "/cgi-bin/serial?" + (String) msg.obj;
            URI uri = URI.create(url);

            HttpResponse httpResponse;
            DefaultHttpClient httpClient = new DefaultHttpClient();
            try {
                httpResponse = httpClient.execute(new HttpGet(uri));
            } catch (IOException e) {
                Log.v(TAG, "Unable to connect to car.");

                mState = STATE_UNCONNECTED;

                return;
            }

            char get;
            try {
                get = (char) httpResponse.getEntity().getContent().read();
            } catch (IOException e) {
                Log.v(TAG, "Unkown situation when connecting car.");

                mState = STATE_UNKOWN;
                return;
            }

            mState = mCommandList.indexOf(Character.toString(get));
        }
    };

    changeTo(STATE_STOP);

    Looper.loop();
}

From source file:at.pardus.android.browser.PardusMessageChecker.java

/**
 * Tries to get the msgFrame via an HTTP GET request, parses it for new
 * messages/logs and displays the result.
 * /*from  w w  w  .j  a  v a  2  s. c  om*/
 * Does not need to be run on the UI thread.
 */
public void check() {
    if (universe == null) {
        return;
    }
    if (PardusConstants.DEBUG) {
        Log.v(this.getClass().getSimpleName(), "Checking for new messages/logs");
    }
    InputStreamReader reader = null;
    try {
        HttpResponse response = httpClient.execute(httpGet);
        HttpEntity entity = response.getEntity();
        if (entity == null) {
            Log.w(this.getClass().getSimpleName(), "Could not check for messages (error in response)");
            return;
        }
        reader = new InputStreamReader(entity.getContent());
        StringBuilder sb = new StringBuilder();
        char[] buffer = new char[2048];
        int i = 0;
        while ((i = reader.read(buffer, 0, buffer.length)) >= 0) {
            if (i > 0) {
                sb.append(buffer, 0, i);
            }
        }
        String responseStr = sb.toString();
        parseResponse(responseStr);
    } catch (ClientProtocolException e) {
        Log.e(this.getClass().getSimpleName(), "Could not check for messages (error in protocol)", e);
    } catch (IOException e) {
        Log.w(this.getClass().getSimpleName(), "Could not check for messages (error reading response)", e);
    } catch (Exception e) {
        Log.e(this.getClass().getSimpleName(), "Could not check for messages (unknown error)", e);
    } finally {
        if (reader != null) {
            try {
                reader.close();
            } catch (IOException e) {

            }
        }
    }
}

From source file:net.evecom.androidecssp.activity.TaskListActivity.java

/**
 * //ww w .j a v a  2s .  c  o m
 */
private void initlist() {
    new Thread(new Runnable() {
        @Override
        public void run() {
            Message message = new Message();

            try {
                HashMap<String, String> hashMap = new HashMap<String, String>();
                hashMap.put("eventId", eventInfo.get("id").toString());
                hashMap.put("projectId", projectInfo.get("id").toString());
                System.out.println(hashMap.values().toArray().toString());
                resutArray = connServerForResultPost(
                        "jfs/ecssp/mobile/taskresponseCtr/getTaskByEventIdAndProjectId", hashMap);
            } catch (ClientProtocolException e) {
                message.what = MESSAGETYPE_02;
                Log.e("mars", e.getMessage());
            } catch (IOException e) {
                message.what = MESSAGETYPE_02;
                Log.e("mars", e.getMessage());
            }
            if (resutArray.length() > 0) {
                try {
                    taskInfos = getObjsInfo(resutArray);
                    if (null == taskInfos) {
                        message.what = MESSAGETYPE_02;
                    } else {
                        message.what = MESSAGETYPE_01;
                    }
                } catch (JSONException e) {
                    message.what = MESSAGETYPE_02;
                    Log.e("mars", e.getMessage());
                }
            } else {
                message.what = MESSAGETYPE_02;
            }
            Log.v("mars", resutArray);
            eventListHandler.sendMessage(message);

        }
    }).start();

}

From source file:net.evecom.androidecssp.activity.event.EventListActivity.java

/**
 * /* www .j ava2s  .  c  om*/
 */
private void initlist() {
    new Thread(new Runnable() {
        @Override
        public void run() {
            Message message = new Message();

            try {
                HashMap<String, String> entityMap = new HashMap<String, String>();
                entityMap.put("pagesize", HttpUtil.getPageSize(instance));
                if (!ifqueryallevents) {
                    String deptid = ShareUtil.getString(instance, "PASSNAME", "orgid", "");
                    entityMap.put("deptid", deptid);
                }
                resutArray = connServerForResultPost("jfs/ecssp/mobile/eventCtr/getEnentList", entityMap);
            } catch (ClientProtocolException e) {
                message.what = MESSAGETYPE_02;
                Log.e("mars", e.getMessage());
            } catch (IOException e) {
                message.what = MESSAGETYPE_02;
                Log.e("mars", e.getMessage());
            }
            if (resutArray.length() > 0) {
                try {
                    eventInfos = getObjsInfo(resutArray);
                    if (null == eventInfos) {
                        message.what = MESSAGETYPE_02;
                    } else {
                        message.what = MESSAGETYPE_01;
                    }
                } catch (JSONException e) {
                    message.what = MESSAGETYPE_02;
                    Log.e("mars", e.getMessage());
                }
            } else {
                message.what = MESSAGETYPE_02;
            }
            Log.v("mars", resutArray);
            eventListHandler.sendMessage(message);

        }
    }).start();

}