Android Open Source - app_syncit File Utils






From Project

Back to project page app_syncit.

License

The source code is released under:

MIT License

If you think the Android project app_syncit 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.feality.app.syncit;
/*from   w  ww . j a  v a  2 s.co  m*/
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;

import java.net.URISyntaxException;

/**
 * Created by Filip on 2014-09-11.
 */
public class FileUtils {
    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.feality.app.syncit.ApplicationTest.java
com.feality.app.syncit.FileUtils.java
com.feality.app.syncit.LaunchActivity.java
com.feality.app.syncit.WifiP2pActionListener.java
com.feality.app.syncit.WifiP2pUiListener.java
com.feality.app.syncit.fragments.DiscoveryFragment.java
com.feality.app.syncit.fragments.MediaFragment.java
com.feality.app.syncit.fragments.SmarterFragment.java
com.feality.app.syncit.net.NetworkActions.java
com.feality.app.syncit.net.NetworkSyncService.java
com.feality.app.syncit.net.PeerToPeerHandler.java
com.todddavies.components.progressbar.ProgressWheel.java