Android : Advice Needed For Manipulating Mediastore For All Music Files?
Aug 3, 2010
I'm rather new to android programming and right now I'm playing with the media store for a personal test project. I've run into a couple double-edge problems..
I need to query the mediastore for a list of all music files, simple enough - but i need to restrict the results to certain folders only. I accomplished this (rather easily) using the SQL-*LIKE- where clauses and all's well on this aspect.
I now need a unique (if this were actually using SQL, I could simply use the DISTINCT modifier and be done with this) list of all artists. Now this is based off the songs in a given path. Therefore I cannot filter the list returned from querying the URI:MediaStore.Audio.Artists.EXTERNAL_CONTENT_URI, and adding in where clauses based off the file path as I did in the first step.
So, what this leaves me with is using my initial query and getting a cursor back then stripping the dupes from the cursor (which is where i am now - too slow, especially with 1000+ songs) - based on a query of artists instead of songs, obviously.
Is is possible to override the actual query that fills the cursor, maybe? As in: override the query and filter how the data is initially put into the cursor (remove recursive entries) and return the proper cursor immediately? Content providers and how they were never built with a distinct function is beyond me, but whatever. Is the returned cursor from a URI query command filled in a manner that can be overridden or not? That's what I'm unclear of at the moment on this. I would like to be able to wrap the getContentResolver().query(xxx..)) command directly to remove the entries on cursor fill, if possible - i do async queries and using a single query statement (well, one for the artist query) would be great.
My other alternative thought is to just preload the data and manipulate my view's data by creating a new cursor based off the preloaded dataset (cursor) - which may be the way to go, and if so - would a cursor be the best way to store this data? Also worried about ram with larger libraries.
Maybe there's simply a way to do a DISTINCT query on the URI - I just do not know. I've seen this question (or the ilk there-of) asked many times with no good answers that were meant for a URI as opposed to a SQL back-end.
View 1 Replies
Nov 2, 2009
I'm a total newbie to Android (and to Java in general... mostly a PERL/ PHP guy here...), so forgive me if I use the wrong terminology to refer to things... I have been asked by my company to implement an application for Android that allows a user to enter a note at the end of every call. E.g., either they or the other party hangs up, immediately a notes area pops up with a "save" button and if they enter a note, the note is saved with a reference to the call log entry. As I understand it, onCallStateChange() will give a pretty good indicator of a hangup if the state has become Telephony Manager.CALL_STATE_IDLE. I've figured out how to do the UI part, how to save it in a database, etc... My question, however, is about how I implement this "listening" aspect of it. Should I have a service running all the time that has an instance of android.telephony.PhoneStateListener? If so, do I use the onBind or onStart method, and how do I make sure it doesn't go away when memory runs low? Or can I somehow attach the listener to this event, and then terminate? Or is a Broadcast Receiver the way to go?
View 16 Replies
View Related
Feb 26, 2012
I am new user for android, my device is HTC inspire 4G.
Q: After i installed some games like (Real Football, Asphalt6 ...), when i opened it, it required additional files to download and its size differ from 200 to 600 MB, so i want to know are these additional files stored in 4 giga ROM, or in the 1.13 giga internal memory , or in the 8 giga memory card .
View 2 Replies
View Related
Jun 19, 2010
Every link I go to in order to get files to root my droid 2.1 have broken links, anyone have working links please?
View 3 Replies
View Related
Apr 4, 2010
I have a Samsung Galaxy I7500 using android 1.5. I extended my phone with a 16GB microSD. I copied a big music collection (around 800 files) into a folder on this SD. Now the problem is that the music player can't find all the files.
I know that there are several threads about android not finding music. The answers are usually that the library hasn't yet been updated or that the ID3 tags are not correct.
I have checked both.
Btw. I can play the files using ASTRO.
In my opinion it seems as if android can't build up a library with too many entries. If I rename the files or put them into different folders, songs disappear and reappear quite randomly.
Do you have any solutions? Is there a music player which doesn't use the native music players index of files?
View 3 Replies
View Related
Sep 3, 2013
got a Samsung Galaxy S4 (for several years I had iPhones) and I am enjoying it. Now that I have gotten all my music files away from iTunes' clunky clutches I have reorganized them and they are on my S4's sim card and it works great.
The issue is that I have updated a few of the files and moved a couple more around. I want to update those music files on my S4 from my PC. I could just delete the Music folder on the S4 and recopy everything over, but that seems to be a huge overkill.
What is a good way to compare files between my S4 and folders on the PC and match/update between the two? I am using Windows 7. I have tried to map the Sim Card as a drive but couldn't get that to work. I have Kies from Samsung but that is kinda clunky. I have also tried AirDroid (which I think is great) but I can't really sync files with that. Normally I would use a Windows application like Beyond Compare or WinMerge to do something like this.
View 3 Replies
View Related
Jul 3, 2013
I am on a standard website that has a normal upload button, I need to upload a PDF file, But when I click on the upload button on the web site a popup window from my Android phone appears and says "Choose action" and gives me access to the gallery, camcorder, voice recorder , choose music track, gallery (again), select music track and voice recorder (again).
I need to some how get access to my SD card and my download folder to be able to pick the the pdf file that I need to upload. I have tried this both on the default internet browser and Google Chrome, but both give the same options.
I am on a rooted HTC ONE on ATT
View 3 Replies
View Related
Apr 25, 2013
I copy all my music files into google music on my sd card! They all went away. The only thing that is left is the band title folder, they are all empty inside. Is there any recovery or did I make a huge mistake? sdcard/andriod/data/com.goole.andriod.music..I still have all my "on device music" from google.
View 1 Replies
View Related
Apr 10, 2013
I have music that is playable with Google Play Music player, but not with other players. I have chosen for the music to be "on the device", and it plays when even in Airplane Mode, so I know it is not streaming, but the music files do not show up in my "Music" directory tree, or under any other file trees that I can find. I have used ES File Explorer to do a top down search for some of the missing titles, but it doesn't find them. I'm perplexed. There must be a cache somewhere, but I can't find it.
View 5 Replies
View Related
Aug 2, 2010
I'm kind of new to android development.I have read from many sources that findViewById() is a "costly" operation. I'm making an application that deals with 5 TextViews to provide different kinds of information (distance, duration, title, description, etc) from a database. I'm using listeners to catch touch/click events and feedbacks a handler. The main function of the handler is to received a "position" in the Cursor where the new information needs to be displayed. I mentioned earlier that findViewById() is a "costly" operation. So, I don't call this method in the handler. Doing so, it will retrieve every time the Views when user touchs/clicks some widget. Is it right to populate the Activity with private members of the Views/Layout it displays? I mean, I don't like it. I don't know why, but seems that I'm populating too much the activity. I'm aware of the android:onClick xml attribute, but in my case I also use long click listeners. So, a piece of onCreate() looks like: And all of those are private members, wihout mention the "cursor.getColumnIndex()" for each. I thought on implementing Handler.Callback and set on the Hanlder.Callback constructor implementer a View array or a View list or something, but I also need this objects later to set other listeners and setups. Is this right? I cannot think another way, as I need the reference to the object, and also the Cursor reference that the handler will move to the "position" provided and update the correspondent View. I will really appreciate either an advice or a useful link/info/doc to read in what concern in this kind of designs. What I do not like is that It looks like imperative programming filling the Activity with "global" variables.
View 6 Replies
View Related
Jul 30, 2010
What accessories do you experienced users have/recommend?I know there are 2 kinds of cases - hard or soft gel.Which is better (and why).What about the home docking station?Worth it?
View 2 Replies
View Related
Mar 3, 2010
I have a service running that grabs the users attention with a notification. What i would like to happen when the user clicks on the notification is for it to launch a dialog box. The "proper" thing to do is to launch an activity in this way, so is there a way to get an activity to launch with out filling the screen? So it looks like a dialog box?
View 5 Replies
View Related
Feb 16, 2010
How can I get the album art from MediaStore?
View 1 Replies
View Related
Sep 27, 2010
I'm trying to query the Android's MediaStore.Images.Media to get the images contained in the device. I get my cursor on the DB like this: Code...
and I get the indices of the columns this way:
int dataIdx = cursor.getColumnIndex(DATA); ... int idIdx = cursor.getColumnIndex(MediaStore.Images.Media._ID);
unfortunately it seems that the column index idIdx is always -1, which means the column doesn't exist. Am I doing something wrong? Is there anyone else experiencing the same?
View 3 Replies
View Related
Oct 5, 2010
can someone please help me? I would like to write a program which uses a service to periodically update a text view on an activity. I do this by having ActivityA with a 2 buttons to start/stop my service. In the service I run a timer which triggers every second. From here I need to have this launch and update a text view on ActivityB which at present is just a counter value.I'm sure there are likely better ways to do this, such as using only one activity, maybe using a thread but the main design consideration is to have the service running even if my activity is destoyed (the counter value would instead go trigger some alarm or file write instead of a text view update). Sorry for rambling. I find the android developer resources offer too many solutions!
View 2 Replies
View Related
May 19, 2010
I'm new to Android development and am working on a small test project. I have a service, which communicates with an SQLite3 database, and two activities. A main activity which fetches database information via the service and displays it and a second activity which allows me to add data to the database via the service.
Currently, I have a singleton class which implements the ServiceConnection interface and I'm binding this to the service in the the main activity using the bindService function. Because it's a singleton, I can then use this service connection in both the main activity and second activity to work with the database and it all seems to work quite well.
However, I'm all the time aware that the service connection is bound to the main activity and I'm wondering if this is the wrong/bad way to do it? Would I be best off having two service connections, one in each activity, and binding each to the service?
View 2 Replies
View Related
Jul 21, 2010
I wanted some music on my phone and don't have a cable. Ill be updating the music often so was going to try something like Dropbox but found out if i put things on my PCs Dropbox folder it wont automatically be downloaded to my phone, ill have to download each file manually. Is there an app which will sync all my music files when i load the app up?
View 2 Replies
View Related
Feb 14, 2009
If I pragmatically store new media files on the SD card, the MediaStore does not know about them until I remove and reinsert the SD card. Is there a way to tell the MediaStore to rescan the SD card without first unmounting the SD card?
View 6 Replies
View Related
Jun 17, 2010
For example if a have two directories /sdcard/Music/Music-1 and /sdcard/Music/Music-2 how can i construct uri to get the files in Music-1 dir for example. I can use MediaStore.Audio.Media.EXTERNAL_CONTENT_URI to get the content of all external storage but how to do the trick only for specific dir.
View 1 Replies
View Related
Aug 13, 2010
I have an app that allows the user to take and save a new picture using the Intent ACTION_IMAGE_CAPTURE. After the user accepts the newly taken picture, I create a ContentValue object to set the picture information, and then I insert the picture into the MediaStore and send a broadcast so that the user can see the photo when opening a picture viewer app such as gallery:
ContentValues newImage = new ContentValues(3);
newImage.put(Media.DISPLAY_NAME, mPicName);
newImage.put(Media.MIME_TYPE, "image/png");
newImage.put(MediaStore.Images.Media.DATA, path);
mPictureUri = getContentResolver().insert(Media.EXTERNAL_CONTENT_URI, newImage);
sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, mPictureUri));
All of this code works fine. The photo is correctly saved, and I can view the photo using gallery. The problem is that when I view the photo in gallery and select "Details" it shows the photo name as "null." And yes, I know for a fact that the variable mPicName above is not null and always has the correct value.
The odd thing is that, when running my app on my Droid running Android 2.1, when I choose to copy files to/from the phone and my computer, I open up the Droid on my Windows computer, and when I go into my app's created folder for photos and view the new photo, the name is correct. Then, when I disable copying files from the phone/computer and go back into gallery to view the file on my Droid, the name is suddenly correct and is no longer null.
Can someone tell me why the name is null after my code runs, and why the name is correct after viewing the file on my computer rather than on the phone? Is there a way to get the name non-null right when the picture is saved? I'd bet that the name would be correct if I turned my phone off and turned it back on, but I'm not sure how exactly to get force things to work immediately.
View 1 Replies
View Related
Oct 7, 2010
How do i get back the image taken from starting the Intent(MediaStore.ACTION_IMAGE_CAPTURE)?
I need the image to be display as a thumbnail and also be attached to email.
View 2 Replies
View Related
Mar 28, 2009
I am unsure of the jargon so please bear with me, I am seeking advice on the best way to go about drawing the graphics for an app I am developing. Imagine you are creating a game of checkers, where you can drag/drop one piece at a time to a blank space on the board. When the piece is being moved, it seems to me that you should not need to redraw all of the pieces that are not being moved. Using the LunarLander example, is there a way to store the background image and only draw the piece being moved over it? I have been trying to figure out a way to capture the canvas as an bitmap that is occasionally refreshed.
View 5 Replies
View Related
Sep 15, 2010
I have one year of experience in programming. After getting laid off in cuts I managed to get a job in telecommunications planning. I'm good at my new job and don't want to leave it but I miss programming. I'd like to be able to code in my free time (which is about 4 hours every evening 7 days a week.)
I can code pretty well in C#, reasonably well in SQL and poorly in a unix shell.
What sort of job should I get on the side? Would anyone hire me as a free lancer? Should I focus on making apps for phones (android) instead?
View 7 Replies
View Related
Apr 27, 2009
I'm torn between which group to post this too, but since it is for an application I am working on, I guess I'll stick it here. So here we go. I have an application which downloads data onto the sdcard to be used by the application. Some of these files are sound or music files and the music player in android seems to parse these directories and add these files to the list. I'd like to somehow block or hide these files from the music player. Is there is a way to do this? I was thinking it may be possible to name my folder with a period at the beginning, since linux hides such files. I'm just not sure if that is going to hide it from the music player or if there is another way to handle this.
View 9 Replies
View Related
Apr 6, 2010
I have only had my HTC Desire for a couple of days and I love it however this is my first 'android' phone so I am still finding my way around doing things. I wanted to transfer music from my PC to my phone so I linked up my phone with the PC using the USB cable and dragged the files from my desktop to the J drive which I assume is my phone but the music does not appear to be in my music folder, I assume that I have to do something else to get it from the SD card to my phone but what
View 10 Replies
View Related
Dec 4, 2008
When i first installed tunewiki and opened it, it said i have 43 music files, but when i go into songs, it only shows 2 songs...I have tried refreshing the library, but that doesn't work.
View 2 Replies
View Related
Apr 17, 2010
I am using MediaStore.Images.Media.insertImage(ContentResolver cr, String imagePath, String name, String description) function to insert a newly created image into gallery. System is naming the file by default, but its different than names of pictures taken by original app(Time stamp). Is there easy way to set it up?
View 2 Replies
View Related
Apr 15, 2010
After I've used a MediaStore.ACTION_IMAGE_CAPTURE intent to take a photo, when I try to retrieve the captured image, I sometimes get an out of memory error as shown below. The odd thing is the huge size of the memory trying to be allocated is always reported as 10,077,696 (x99c600). However, the image file is much smaller, typically around 750,000 bytes.Any suggestions on how to get around this problem? I'm testing this on a Nexus One with firmware version: 2.1-update1 and Build number: ERE27. Code...
View 2 Replies
View Related
Jul 15, 2009
I have seen a number of posts from people who had trouble retrieving a full size image from MediaStore.EXTRA_OUTPUT with code...
Should this code work? I mean, should this result in a file containing the picture?
View 4 Replies
View Related
Sep 30, 2009
Is that normal that Images indexed in the MediaStore do not have thumbnails generated until the Gallery app is launched and the user actively navigates to the bucket where the image is stored ?
I think it's quite odd as I thought thulbnails generation was part of media indexing.
View 9 Replies
View Related