List of usage examples for android.net Uri getPath
@Nullable public abstract String getPath();
From source file:com.amaze.filemanager.fragments.ZipViewer.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); Sp = PreferenceManager.getDefaultSharedPreferences(getActivity()); s = getArguments().getString("path"); Uri uri = Uri.parse(s); f = new File(uri.getPath()); mToolbarContainer = getActivity().findViewById(R.id.lin); mToolbarContainer.setOnTouchListener(new View.OnTouchListener() { @Override// www .j a va2 s. c o m public boolean onTouch(View view, MotionEvent motionEvent) { if (stopAnims) { if ((!rarAdapter.stoppedAnimation)) { stopAnim(); } rarAdapter.stoppedAnimation = true; } stopAnims = false; return false; } }); hidemode = Sp.getInt("hidemode", 0); listView.setVisibility(View.VISIBLE); mLayoutManager = new LinearLayoutManager(getActivity()); listView.setLayoutManager(mLayoutManager); res = getResources(); mainActivity.supportInvalidateOptionsMenu(); if (mainActivity.theme1 == 1) rootView.setBackgroundColor(getResources().getColor(R.color.holo_dark_background)); else listView.setBackgroundColor(getResources().getColor(android.R.color.background_light)); gobackitem = Sp.getBoolean("goBack_checkbox", false); coloriseIcons = Sp.getBoolean("coloriseIcons", true); Calendar calendar = Calendar.getInstance(); showSize = Sp.getBoolean("showFileSize", false); showLastModified = Sp.getBoolean("showLastModified", true); showDividers = Sp.getBoolean("showDividers", true); year = ("" + calendar.get(Calendar.YEAR)).substring(2, 4); skin = PreferenceUtils.getPrimaryColorString(Sp); iconskin = PreferenceUtils.getFolderColorString(Sp); mainActivity.findViewById(R.id.buttonbarframe).setBackgroundColor(Color.parseColor(skin)); files = new ArrayList<>(); if (savedInstanceState == null && f != null) { if (f.getPath().endsWith(".rar")) { openmode = 1; SetupRar(null); } else { openmode = 0; SetupZip(null); } } else { f = new File(savedInstanceState.getString("file")); s = savedInstanceState.getString("uri"); uri = Uri.parse(s); f = new File(uri.getPath()); if (f.getPath().endsWith(".rar")) { openmode = 1; SetupRar(savedInstanceState); } else { openmode = 0; SetupZip(savedInstanceState); } } String fileName = null; try { if (uri.getScheme().equals("file")) { fileName = uri.getLastPathSegment(); } else { Cursor cursor = null; try { cursor = getActivity().getContentResolver().query(uri, new String[] { MediaStore.Images.ImageColumns.DISPLAY_NAME }, null, null, null); if (cursor != null && cursor.moveToFirst()) { fileName = cursor .getString(cursor.getColumnIndex(MediaStore.Images.ImageColumns.DISPLAY_NAME)); } } finally { if (cursor != null) { cursor.close(); } } } } catch (Exception e) { e.printStackTrace(); } if (fileName == null || fileName.trim().length() == 0) fileName = f.getName(); try { mainActivity.setActionBarTitle(fileName); } catch (Exception e) { mainActivity.setActionBarTitle(getResources().getString(R.string.zip_viewer)); } mainActivity.supportInvalidateOptionsMenu(); mToolbarHeight = getToolbarHeight(getActivity()); paddingTop = (mToolbarHeight) + dpToPx(72); mToolbarContainer.getViewTreeObserver() .addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { paddingTop = mToolbarContainer.getHeight(); mToolbarHeight = mainActivity.toolbar.getHeight(); if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN) { mToolbarContainer.getViewTreeObserver().removeOnGlobalLayoutListener(this); } else { mToolbarContainer.getViewTreeObserver().removeGlobalOnLayoutListener(this); } } }); }
From source file:com.flym.dennikn.fragment.EntryFragment.java
public void setData(Uri uri) { mCurrentPagerPos = -1;/*from w ww. ja v a 2 s . c o m*/ mBaseUri = FeedData.EntryColumns.PARENT_URI(uri.getPath()); try { mInitialEntryId = Long.parseLong(uri.getLastPathSegment()); } catch (Exception unused) { mInitialEntryId = -1; } if (mBaseUri != null) { Bundle b = getActivity().getIntent().getExtras(); String whereClause = FeedData.shouldShowReadEntries(mBaseUri) || (b != null && b.getBoolean(Constants.INTENT_FROM_WIDGET, false)) ? null : EntryColumns.WHERE_UNREAD; String entriesOrder = PrefUtils.getBoolean(PrefUtils.DISPLAY_OLDEST_FIRST, false) ? Constants.DB_ASC : Constants.DB_DESC; // Load the entriesIds list. Should be in a loader... but I was too lazy to do so Cursor entriesCursor = MainApplication.getContext().getContentResolver().query(mBaseUri, EntryColumns.PROJECTION_ID, whereClause, null, EntryColumns.DATE + entriesOrder); if (entriesCursor != null && entriesCursor.getCount() > 0) { mEntriesIds = new long[entriesCursor.getCount()]; int i = 0; while (entriesCursor.moveToNext()) { mEntriesIds[i] = entriesCursor.getLong(0); if (mEntriesIds[i] == mInitialEntryId) { mCurrentPagerPos = i; // To immediately display the good entry } i++; } entriesCursor.close(); } } else { mEntriesIds = null; } mEntryPagerAdapter.notifyDataSetChanged(); if (mCurrentPagerPos != -1) { mEntryPager.setCurrentItem(mCurrentPagerPos); } }
From source file:com.igniva.filemanager.fragments.ZipViewer.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); Sp = PreferenceManager.getDefaultSharedPreferences(getActivity()); s = getArguments().getString("path"); Uri uri = Uri.parse(s); f = new File(uri.getPath()); mToolbarContainer = getActivity().findViewById(R.id.lin); mToolbarContainer.setOnTouchListener(new View.OnTouchListener() { @Override// ww w. ja v a 2s .co m public boolean onTouch(View view, MotionEvent motionEvent) { if (stopAnims) { if ((!rarAdapter.stoppedAnimation)) { stopAnim(); } rarAdapter.stoppedAnimation = true; } stopAnims = false; return false; } }); hidemode = Sp.getInt("hidemode", 0); listView.setVisibility(View.VISIBLE); mLayoutManager = new LinearLayoutManager(getActivity()); listView.setLayoutManager(mLayoutManager); res = getResources(); mainActivity.supportInvalidateOptionsMenu(); if (mainActivity.theme1 == 1) rootView.setBackgroundColor(getResources().getColor(R.color.holo_dark_background)); else listView.setBackgroundColor(getResources().getColor(android.R.color.background_light)); gobackitem = Sp.getBoolean("goBack_checkbox", false); coloriseIcons = Sp.getBoolean("coloriseIcons", true); Calendar calendar = Calendar.getInstance(); showSize = Sp.getBoolean("showFileSize", false); showLastModified = Sp.getBoolean("showLastModified", true); showDividers = Sp.getBoolean("showDividers", true); year = ("" + calendar.get(Calendar.YEAR)).substring(2, 4); skin = PreferenceUtils.getPrimaryColorString(Sp); accentColor = PreferenceUtils.getAccentString(Sp); iconskin = PreferenceUtils.getFolderColorString(Sp); theme = Integer.parseInt(Sp.getString("theme", "0")); theme1 = theme == 2 ? PreferenceUtils.hourOfDay() : theme; //mainActivity.findViewById(R.id.buttonbarframe).setBackgroundColor(Color.parseColor(skin)); files = new ArrayList<>(); if (savedInstanceState == null && f != null) { if (f.getPath().endsWith(".rar")) { openmode = 1; SetupRar(null); } else { openmode = 0; SetupZip(null); } } else { f = new File(savedInstanceState.getString("file")); s = savedInstanceState.getString("uri"); uri = Uri.parse(s); f = new File(uri.getPath()); if (f.getPath().endsWith(".rar")) { openmode = 1; SetupRar(savedInstanceState); } else { openmode = 0; SetupZip(savedInstanceState); } } String fileName = null; try { if (uri.getScheme().equals("file")) { fileName = uri.getLastPathSegment(); } else { Cursor cursor = null; try { cursor = getActivity().getContentResolver().query(uri, new String[] { MediaStore.Images.ImageColumns.DISPLAY_NAME }, null, null, null); if (cursor != null && cursor.moveToFirst()) { fileName = cursor .getString(cursor.getColumnIndex(MediaStore.Images.ImageColumns.DISPLAY_NAME)); } } finally { if (cursor != null) { cursor.close(); } } } } catch (Exception e) { e.printStackTrace(); } if (fileName == null || fileName.trim().length() == 0) fileName = f.getName(); try { mainActivity.setActionBarTitle(fileName); } catch (Exception e) { mainActivity.setActionBarTitle(getResources().getString(R.string.zip_viewer)); } mainActivity.supportInvalidateOptionsMenu(); mToolbarHeight = getToolbarHeight(getActivity()); paddingTop = (mToolbarHeight) + dpToPx(72); mToolbarContainer.getViewTreeObserver() .addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { paddingTop = mToolbarContainer.getHeight(); mToolbarHeight = mainActivity.toolbar.getHeight(); if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN) { mToolbarContainer.getViewTreeObserver().removeOnGlobalLayoutListener(this); } else { mToolbarContainer.getViewTreeObserver().removeGlobalOnLayoutListener(this); } } }); }
From source file:com.appunite.websocket.WebSocket.java
/** * Write websocket headers to outputStream (not thread safe) * /*from w w w. ja v a2 s . com*/ * @param uri uri * @param secret secret that is written to headers * @throws IOException */ private void writeHeaders(Uri uri, String secret) throws IOException { mOutputStream.writeLine("GET " + uri.getPath() + " HTTP/1.1"); mOutputStream.writeLine("Upgrade: websocket"); mOutputStream.writeLine("Connection: Upgrade"); mOutputStream.writeLine("Host: " + uri.getHost()); mOutputStream.writeLine("Origin: " + uri); mOutputStream.writeLine("Sec-WebSocket-Key: " + secret); mOutputStream.writeLine("Sec-WebSocket-Protocol: chat"); mOutputStream.writeLine("Sec-WebSocket-Version: 13"); mOutputStream.writeNewLine(); mOutputStream.flush(); }
From source file:com.amaze.carbonfilemanager.fragments.ZipViewer.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); Sp = PreferenceManager.getDefaultSharedPreferences(getActivity()); s = getArguments().getString(KEY_PATH); Uri uri = Uri.parse(s); f = new File(uri.getPath()); mToolbarContainer = getActivity().findViewById(R.id.lin); mToolbarContainer.setOnTouchListener(new View.OnTouchListener() { @Override/*from w w w . jav a 2 s . c om*/ public boolean onTouch(View view, MotionEvent motionEvent) { if (stopAnims) { if ((!rarAdapter.stoppedAnimation)) { stopAnim(); } rarAdapter.stoppedAnimation = true; } stopAnims = false; return false; } }); hidemode = Sp.getInt("hidemode", 0); listView.setVisibility(View.VISIBLE); mLayoutManager = new LinearLayoutManager(getActivity()); listView.setLayoutManager(mLayoutManager); res = getResources(); mainActivity.supportInvalidateOptionsMenu(); if (utilsProvider.getAppTheme().equals(AppTheme.DARK)) rootView.setBackgroundColor(Utils.getColor(getContext(), R.color.holo_dark_background)); else listView.setBackgroundColor(Utils.getColor(getContext(), android.R.color.background_light)); gobackitem = Sp.getBoolean("goBack_checkbox", false); coloriseIcons = Sp.getBoolean("coloriseIcons", true); Calendar calendar = Calendar.getInstance(); showSize = Sp.getBoolean("showFileSize", false); showLastModified = Sp.getBoolean("showLastModified", true); showDividers = Sp.getBoolean("showDividers", true); year = ("" + calendar.get(Calendar.YEAR)).substring(2, 4); skin = mainActivity.getColorPreference().getColorAsString(ColorUsage.PRIMARY); accentColor = mainActivity.getColorPreference().getColorAsString(ColorUsage.ACCENT); iconskin = mainActivity.getColorPreference().getColorAsString(ColorUsage.ICON_SKIN); //mainActivity.findViewById(R.id.buttonbarframe).setBackgroundColor(Color.parseColor(skin)); if (savedInstanceState == null && f != null) { files = new ArrayList<>(); // adding a cache file to delete where any user interaction elements will be cached String fileName = f.getName().substring(0, f.getName().lastIndexOf(".")); files.add(new BaseFile(getActivity().getExternalCacheDir().getPath() + "/" + fileName)); if (f.getPath().endsWith(".rar")) { openmode = 1; SetupRar(null); } else { openmode = 0; SetupZip(null); } } else { f = new File(savedInstanceState.getString(KEY_FILE)); s = savedInstanceState.getString(KEY_URI); uri = Uri.parse(s); f = new File(uri.getPath()); files = savedInstanceState.getParcelableArrayList(KEY_CACHE_FILES); isOpen = savedInstanceState.getBoolean(KEY_OPEN); if (f.getPath().endsWith(".rar")) { openmode = 1; SetupRar(savedInstanceState); } else { openmode = 0; SetupZip(savedInstanceState); } } String fileName = null; try { if (uri.getScheme().equals(KEY_FILE)) { fileName = uri.getLastPathSegment(); } else { Cursor cursor = null; try { cursor = getActivity().getContentResolver().query(uri, new String[] { MediaStore.Images.ImageColumns.DISPLAY_NAME }, null, null, null); if (cursor != null && cursor.moveToFirst()) { fileName = cursor .getString(cursor.getColumnIndex(MediaStore.Images.ImageColumns.DISPLAY_NAME)); } } finally { if (cursor != null) { cursor.close(); } } } } catch (Exception e) { e.printStackTrace(); } if (fileName == null || fileName.trim().length() == 0) fileName = f.getName(); try { mainActivity.setActionBarTitle(fileName); } catch (Exception e) { mainActivity.setActionBarTitle(getResources().getString(R.string.zip_viewer)); } mainActivity.supportInvalidateOptionsMenu(); mToolbarHeight = getToolbarHeight(getActivity()); paddingTop = (mToolbarHeight) + dpToPx(72); mToolbarContainer.getViewTreeObserver() .addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { paddingTop = mToolbarContainer.getHeight(); mToolbarHeight = mainActivity.toolbar.getHeight(); if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN) { mToolbarContainer.getViewTreeObserver().removeOnGlobalLayoutListener(this); } else { mToolbarContainer.getViewTreeObserver().removeGlobalOnLayoutListener(this); } } }); }
From source file:com.androguide.apkreator.MainActivity.java
@SuppressLint("NewApi") @SuppressWarnings("deprecation") @Override// ww w . j av a2s . com protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); supportRequestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setContentView(R.layout.activity_main); /** * Before anything we need to check if the config files exist to avoid * FC is they don't * * @see #checkIfConfigExists() */ checkIfConfigExists(); /** * Now it's all good because if no configuration was found we have * copied a default one over. * * @see #checkIfConfigExists() */ setAppConfigInPrefs(); headers = getPluginTabs(); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerList = (ListView) findViewById(R.id.left_drawer); /* * set a custom shadow that overlays the main content when the drawer * opens */ mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); /* set up the drawer's list view with items and click listener */ ArrayAdapter<String> pimpAdapter = new ArrayAdapter<String>(this, R.layout.drawer_list_item, mDrawerHeaders); mDrawerList.setAdapter(pimpAdapter); Log.e("FIRST POS", mDrawerList.getFirstVisiblePosition() + ""); Log.e("LAST POS", mDrawerList.getLastVisiblePosition() + ""); View child = mDrawerList.getChildAt(mDrawerList.getFirstVisiblePosition()); if (child != null && android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) child.setBackground(getColouredTouchFeedback()); mDrawerList.setOnItemClickListener(new DrawerItemClickListener()); /** Set the user-defined ActionBar icon */ File file = new File(getFilesDir() + "/.APKreator/icon.png"); if (file.exists()) { try { getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeButtonEnabled(true); Uri iconUri = Uri.fromFile(new File(getFilesDir() + "/.APKreator/icon.png")); Bitmap icon = BitmapFactory.decodeFile(iconUri.getPath()); Drawable ic = new BitmapDrawable(icon); getSupportActionBar().setIcon(ic); } catch (NullPointerException e) { Log.e("NPE", e.getMessage()); } } /* * ActionBarDrawerToggle ties together the proper interactions between * the sliding drawer and the action bar app icon */ mDrawerToggle = new ActionBarDrawerToggle(this, /* host Activity */ mDrawerLayout, /* DrawerLayout object */ R.drawable.ic_drawer, /* nav drawer image to replace 'Up' caret */ R.string.app_name, /* "open drawer" description for accessibility */ R.string.app_name /* "close drawer" description for accessibility */ ) { public void onDrawerClosed(View view) { invalidateOptionsMenu(); /* * creates call to * onPrepareOptionsMenu() */ } public void onDrawerOpened(View drawerView) { invalidateOptionsMenu(); /* * creates call to * onPrepareOptionsMenu() */ } }; mDrawerLayout.setDrawerListener(mDrawerToggle); /** Tabs adapter using the PagerSlidingStrip library */ tabs = (PagerSlidingTabStrip) findViewById(R.id.tabs); ViewPager pager = (ViewPager) findViewById(R.id.pager); MyPagerAdapter adapter = new MyPagerAdapter(this.getSupportFragmentManager()); pager.setAdapter(adapter); pager.setOnPageChangeListener(new OnPageChangeListener() { @Override public void onPageSelected(int arg0) { } @Override public void onPageScrolled(int arg0, float arg1, int arg2) { } @Override public void onPageScrollStateChanged(int arg0) { } }); final int pageMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 4, getResources().getDisplayMetrics()); pager.setPageMargin(pageMargin); tabs.setViewPager(pager); tabs.setOnPageChangeListener(this); changeColor(Color.parseColor(getPluginColor())); pager.setOffscreenPageLimit(5); }
From source file:org.cm.podd.report.service.DataSubmitService.java
@Override protected void onHandleWork(@NonNull Intent intent) { sharedPrefUtil = new SharedPrefUtil(getApplicationContext()); HttpURLConnection conn = null; Log.i(TAG, "submit data " + Long.toString(System.currentTimeMillis())); ReportQueueDataSource queueDataSource = new ReportQueueDataSource(getApplicationContext()); ReportDataSource reportDataSource = new ReportDataSource(getApplicationContext()); try {//from w w w.ja v a2 s. c om List<Queue> queues = queueDataSource.getAllQueues(); for (Queue que : queues) { long id = que.getId(); String type = que.getType(); long reportId = que.getReportId(); long imageId = que.getImageId(); Log.d(TAG, String.format("type= %s, report id= %d, image id= %d", type, reportId, imageId)); boolean success = false; boolean forceSkipUpload = false; if (type.equals(ReportQueueDataSource.DATA_TYPE)) { // get report data Report report = reportDataSource.getById(reportId); if (report != null) { if (BuildConfig.REAL_SUBMIT) { success = submitReport(report); } else { success = true; } if (success) { // mark report as done submitting to server reportDataSource.updateSubmit(reportId); } } else { // no report found, just remove this from queue success = true; } } else if (type.equals(ReportQueueDataSource.IMAGE_TYPE)) { // get image data ReportImage image = reportDataSource.getImageById(imageId); Report report = reportDataSource.getById(image.getReportId()); if (image != null) { String uriStr = image.getImageUri(); Uri uri = Uri.parse(uriStr); String filePath = null; // find image file path Cursor c = getContentResolver().query(uri, null, null, null, null); if (c == null) { filePath = uri.getPath(); } else { if (c.moveToFirst()) { // ?? upload int idx = c.getColumnIndex(MediaStore.Images.ImageColumns.DATA); filePath = c.getString(idx); c.close(); } else { forceSkipUpload = true; } } if (filePath != null) { success = uploadToS3(image.getGuid(), filePath, image.getThumbnail()); } // submit image bytes if (success) { success = submitImage(image, report.getGuid()); if (success) { reportDataSource.updateImageSubmit(imageId); } } } else { // Image could be deleted by user anytime, // so just remove a queue if no image found success = true; } } else if (type.equals(ReportQueueDataSource.UPDATE_REPORT_TYPE)) { Intent syncIntent = new Intent(this, SyncReportTypeService.class); startService(syncIntent); } if (success || forceSkipUpload) { // After queue was submitted successfully then remove it if (success) { Log.i(TAG, "success! submit report " + type); } else { Log.i(TAG, "force skip upload! report " + type); } queueDataSource.remove(id); } } // notify report list about change in report status sendBroadcast(new Intent(ACTION_REPORT_STATUS_CHANGE)); } catch (Exception e) { // handle exception Log.e(TAG, "Error submit data", e); } finally { Log.e(TAG, "---- end submit ----"); queueDataSource.close(); reportDataSource.close(); } }
From source file:com.carlrice.reader.fragment.EntryFragment.java
public void setData(Uri uri) { mCurrentPagerPos = -1;/*from w ww . j ava2s .c o m*/ mBaseUri = FeedData.EntryColumns.PARENT_URI(uri.getPath()); try { mInitialEntryId = Long.parseLong(uri.getLastPathSegment()); } catch (Exception unused) { mInitialEntryId = -1; } if (mBaseUri != null) { Bundle b = getActivity().getIntent().getExtras(); String whereClause = FeedData.shouldShowReadEntries(mBaseUri) || (b != null && b.getBoolean(Constants.INTENT_FROM_WIDGET, false)) ? null : EntryColumns.WHERE_UNREAD; String entriesOrder = PrefUtils.getBoolean(PrefUtils.DISPLAY_OLDEST_FIRST, false) ? Constants.DB_ASC : Constants.DB_DESC; // Load the entriesIds list. Should be in a loader... but I was too lazy to do so Cursor entriesCursor = Application.context().getContentResolver().query(mBaseUri, EntryColumns.PROJECTION_ID, whereClause, null, EntryColumns.DATE + entriesOrder); if (entriesCursor != null && entriesCursor.getCount() > 0) { mEntriesIds = new long[entriesCursor.getCount()]; int i = 0; while (entriesCursor.moveToNext()) { mEntriesIds[i] = entriesCursor.getLong(0); if (mEntriesIds[i] == mInitialEntryId) { mCurrentPagerPos = i; // To immediately display the good entry } i++; } entriesCursor.close(); } } else { mEntriesIds = null; } mEntryPagerAdapter.notifyDataSetChanged(); if (mCurrentPagerPos != -1) { mEntryPager.setCurrentItem(mCurrentPagerPos); } }
From source file:co.codecrunch.musicplayerlite.activities.MusicPlayerBaseActivity.java
/** * Get intent data from music choose option *//* w ww . j a v a 2s . c om*/ private void getIntentData() { try { Uri data = getIntent().getData(); if (data != null) { if (data.getScheme().equalsIgnoreCase("file")) { String path = data.getPath().toString(); if (!TextUtils.isEmpty(path)) { MediaController.getInstance().cleanupPlayer(context, true, true); MusicPreferance.getPlaylist(context, path); updateTitle(false); MediaController.getInstance().playAudio(MusicPreferance.playingSongDetail); mLayout.setPanelState(SlidingUpPanelLayout.PanelState.EXPANDED); } } if (data.getScheme().equalsIgnoreCase("http")) LogWriter.info(TAG, data.getPath().toString()); if (data.getScheme().equalsIgnoreCase("content")) LogWriter.info(TAG, data.getPath().toString()); } } catch (Exception e) { e.printStackTrace(); } }
From source file:com.polyvi.xface.extension.camera.XCameraExt.java
private InputStream getInputStream(Uri mUri) throws IOException { try {/*from w w w . ja v a 2 s .c o m*/ if (mUri.getScheme().equals("file")) { return new java.io.FileInputStream(mUri.getPath()); } else { return getContext().getContentResolver().openInputStream(mUri); } } catch (FileNotFoundException ex) { return null; } }