mediastore

Getting audio file path or URI from mediastore

坚强是说给别人听的谎言 提交于 2019-12-03 17:13:54
I am making an application which lists all the songs on the device onto the screen and clicking on them opens a sharing intent where the songs / audio file can be shared across various devices through different method like Bluetooth, WhatsApp etc. But I am not able to get the file path or location of the audio file from the mediastore. This is how I am getting my songs- public void getSongList() { //retrieve song info ContentResolver musicResolver = getActivity().getContentResolver(); Uri musicUri = android.provider.MediaStore.Audio.Media.EXTERNAL_CONTENT_URI; Cursor musicCursor =

Querying the MediaStore: Joining thumbnails and images (on ID)

夙愿已清 提交于 2019-12-03 14:47:11
I'm working on a "photo gallery"-type app for Android. It started as a Final Project for the Developing Android Apps at Udacity, so it's overall structure (activities, contentproviders etc) should be very sound, and it was accepted for certification by Udacity/Google. However, it's still not 100% finished, and I'm still trying to improve on it. What I want to do should really be quite straight-forward; load all images on device (as thumbnails) into a GridView in the MainActivity, with a DetailActivity which shows the full size image + some meta data (title, size, date etc). The course required

How to query all albums to a given artist

╄→гoц情女王★ 提交于 2019-12-03 08:00:28
问题 I need a way to display all albums of a given artist. All I found so far ist a way to list all albums which contain at least one songe of the artist - but that's not, what I want. I'm new to android an help would be very appreciated. Thank's in advance! 回答1: It may be far to late but it may be interesting to someone else: I had the same problem and only found obscure solutions how to query all albums done by a specific artist, then I came up with this rather simple solution: Uri.Builder

Loading large number of items in recycler view

爱⌒轻易说出口 提交于 2019-12-03 06:37:27
I have a recycler view within a fragment and basically I m trying to load song list in the recycler view .Each row of recycler view contains an imageview (for album art) and textview ( for song name). I am having trouble when the size of the dataset is huge, that is when there are too many songs, the recycler view lags and the app ends up giving an ANR.I am using Glide to load album arts in each row's imageview. How is google music player able to show such large number of songs without any lag? Edit: This is my SongsFragment public class SongsFragment extends Fragment { static {

Uri.parse(“file://” + ???); to access specific folder

女生的网名这么多〃 提交于 2019-12-02 11:35:30
My question is two part, how can I get the following code to access this location: "/storage/emulated/0/Movies/SpecificFolder" Code: private Uri getUriFromMediaStore(int position) { int dataIndex = mMediaStoreCursor.getColumnIndex(MediaStore.Files.FileColumns.DATA); mMediaStoreCursor.moveToPosition(position); String dataString = mMediaStoreCursor.getString(dataIndex); Uri mediaUri = Uri.parse("file://" + dataString); return mediaUri; } and, when the time comes how can I access videos/files from an online server? I have tried the following: mediaCursor = getContentResolver().query( MediaStore

Wrong DURATION in MediaStore.Video.Media.DURATION

你离开我真会死。 提交于 2019-12-02 11:22:29
问题 I'm trying to record video in my application and I've noticed that displaying their duration , I see wrong minutes \ seconds. This happens only with the video recorded trough the following code. With the video recorded through other apps, the duration is displayed right: public void recordStream() { //Release Camera before MediaRecorder start releaseCamera(); if(!prepareMediaRecorder()){ Toast.makeText(MainActivity.this, "Fail in prepareMediaRecorder()!\n - Ended -", Toast.LENGTH_LONG).show()

Joining cursors and sorting

夙愿已清 提交于 2019-12-02 08:18:20
问题 I'm writing a "gallery-type" app for Android. In the "master activity", I have a GridView which I want to load/fill with thumbnails from photos on the device. So I've written a ContentProvider, where the query method returns a cursor from MediaStore.Media.Thumbnails. However, I also want to display some meta data from MediaStore.Media.Images. In order to do this, I ended up using a CursorJoiner to join c_thumbs and c_images on ID. Only problem with this, is that CursorJoiner requires the

Android video file path from media store is coming as null

谁都会走 提交于 2019-12-02 08:03:04
I am trying to get the path of the video file for a video thumbnail. I'm not sure why it is still coming as null after I modified based on some solutions here. The version of android is 6.0.1. The user clicks the floating action button and summons a gallery of videos. FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.addNote); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(); intent.setType("video/*"); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(Intent.createChooser(intent,

Listing thumbnails per bucket

丶灬走出姿态 提交于 2019-12-02 07:52:48
问题 I have 2 classes. First is meant for searching for all folders, I mean Bucket list name. Seconds class makes thumbnails. But I need to have thumbnails per bucket. So when I push on my folder it should shows me all photos in it (thumbnails). Can somebody help me with it? First class: public class ThumbnailAdapter extends BaseAdapter { // Context required for performing queries private final Context mContext; // Cursor for thumbnails private final Cursor cursor; private final int imgId; private

How can I specify the output file's folder when calling RECORD_SOUND_ACTION?

吃可爱长大的小学妹 提交于 2019-12-02 06:44:25
I'd like to specify a destination folder when I call the MediaStore built-in sound recorder app, e.g. the sdcard folder. According to the Android documentation , there is no support for EXTRA_OUTPUT when calling the RECORD_SOUND_ACTION . How can I do this? You will have to allow the file to be recorded using whatever default filename and location are used and then move the file. Moving the file is far from trivial. Here's a complete example. import java.io.File; import java.io.IOException; import android.app.Activity; import android.content.Intent; import android.database.Cursor; import