Android Open Source - dv-quiz dv Utils






From Project

Back to project page dv-quiz.

License

The source code is released under:

Apache License

If you think the Android project dv-quiz listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.dvorakdev.lib;
//  w  w  w .  java  2s.c  o m
import java.net.URISyntaxException;

import android.content.Context;
import android.database.Cursor;
import android.net.Uri;

public class dvUtils {
  
  /*
   * Author: http://stackoverflow.com/users/377260/paul-burke
   */
  public static String getPath(Context context, Uri uri) throws URISyntaxException {
      if ("content".equalsIgnoreCase(uri.getScheme())) {
          String[] projection = { "_data" };
          Cursor cursor = null;

          try {
              cursor = context.getContentResolver().query(uri, projection, null, null, null);
              int column_index = cursor.getColumnIndexOrThrow("_data");
              if (cursor.moveToFirst()) {
                  return cursor.getString(column_index);
              }
          } catch (Exception e) {
              // Eat it
          }
      }
      else if ("file".equalsIgnoreCase(uri.getScheme())) {
          return uri.getPath();
      }

      return null;
  }
}




Java Source Code List

com.dvorakdev.dvquiz.AboutActivity.java
com.dvorakdev.dvquiz.CategoryFormActivity.java
com.dvorakdev.dvquiz.MainActivity.java
com.dvorakdev.dvquiz.QuizActivity.java
com.dvorakdev.dvquiz.QuizFormActivity.java
com.dvorakdev.dvquiz.QuizResultActivity.java
com.dvorakdev.dvquiz.context.dvQuizContext.java
com.dvorakdev.dvquiz.model.Answer.java
com.dvorakdev.dvquiz.model.Category.java
com.dvorakdev.dvquiz.model.Question.java
com.dvorakdev.dvquiz.model.Quiz.java
com.dvorakdev.dvquiz.reference.dvQuizReference.java
com.dvorakdev.lib.dvExpandableListAdapter.java
com.dvorakdev.lib.dvFileDialog.java
com.dvorakdev.lib.dvObjectRadioButton.java
com.dvorakdev.lib.dvUtils.java