[android-beginners] Having trouble with setDataSource() for MediaPlayer
I've gotten the MediaPlayer to work with the create() on a resource. I'm trying to get it to work with a file in the assets folder. I've tried all sorts of combinations with the setDataSource() method, but I keep getting errors. Here's one of my error traces: E/PlayerDriver( 31): Command PLAYER_SET_DATA_SOURCE completed with an error or info PVMFErrNotSupported E/MediaPlayer( 1550): error (1, -4) E/com.appsgrl.xxx.playerserv...@43d251f0( 1550): IOException on setDataSource:Prepare failed.: status=0x1 W/PlayerDriver( 31): PVMFInfoErrorHandlingComplete E/MediaPlayer( 1550): start called in state 0 E/MediaPlayer( 1550): error (-38, 0) I was trying to do the following: (I did not show the try/catch stuff) MediaPlayer mp = new MediaPlayer(); FileDescriptor sfd = getAssets().openFd(abc.wav).getFileDescriptor(); mp.setDataSource(sfd); mp.prepare(); mp.start() Does anyone have a simple example of how to play something from the asses folder? Thanks -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
Re: [android-beginners] Re: Appwidget Getting Location Updates
Jake, 01.07.2010 1:04, Jake Colman пишет: Kostya, I already start a service to do the initial update of the widget. Do I just start the same service again from within the appwidget's event handler for the broadcast event? If doing this will bring the widget up-to-date, then why not? If, on the other hand, proper updates require some data, then you can set extras on the intent used to start the service, and get them in the service's onStart / onStartCommand. As a side question, what does the service do after it is started? Does it just hang around wasting resources? How does the service know that it has done its job (updated the appwidget display) and that it has no more work to do? See http://developer.android.com/reference/android/app/Service.html#ServiceLifecycle http://developer.android.com/reference/android/app/Service.html#ProcessLifecycle -- Kostya ...Jake KV == Kostya Vasilyevkmans...@gmail.com writes: KV Jake, KV PendingIntents are not limited to launching activites. When a KV PendingIntent fires, it just fires - the results of it firing KV depend on how the PI was created. KV If it's a broadcast event, it can be handled anywhere, and KV depends on where / how a handler for this broadcast event is KV defined. KV The easiest thing is to add a handler for this event to your KV AppWidgetProvider, this can be done in the manifest (since AWP is KV a BroadcastListener). Then, if building an widget update is not KV instant, use a Service to built it. KV -- Kostya KV 30.06.2010 23:41, Jake Colman пишет: I would like my appwidget to get updates upon a change of location but I have a few questions. 1) I start a service in the appwidget's onUpdate() method. Is it appropriate to have location updates processed by the same service? 2) When using requestLocationUpdates() am I better off to use the Listener form of the API or the PendingIntent form of the API? To use the PendingIntent, I need to have an Activity, correct? And in this instance I don't, correct? So can the Service class create and use a Listener? Thanks. KV -- KV Kostya Vasilev -- WiFi Manager + pretty widget -- KV http://kmansoft.wordpress.com KV -- KV You received this message because you are subscribed to the Google KV Groups Android Beginners group. KV NEW! Try asking and tagging your question on Stack Overflow at KV http://stackoverflow.com/questions/tagged/android KV To unsubscribe from this group, send email to KV android-beginners+unsubscr...@googlegroups.com KV For more options, visit this group at KV http://groups.google.com/group/android-beginners?hl=en -- Kostya Vasilev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
Re: [android-beginners] Re: Beginner...How to test android application?
On Thu, Jul 1, 2010 at 12:38 AM, Rushikesh Khadtare khadtare.rushik...@gmail.com wrote: Any other link than developer.android ??? http://wiki.andmob.org/books Other than that, it is difficult to answer such generic questions, such as the ones you are asking. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android Training...At Your Office: http://commonsware.com/training -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] Updating an Application
Hi... I want to know how an application is updated in Android. Is there a specific code for that?? In my application I have used the feature public void setApplicationEnabledSetting (Stringhttp://developer.android.com/reference/java/lang/String.htmlpackageName, int newState, int flags) and using this I disabled my application (by passing COMPONENT_ENABLED_STATE_DISABLEDhttp://developer.android.com/reference/android/content/pm/PackageManager.html#COMPONENT_ENABLED_STATE_DISABLED for int newState ), without deleting its apk. Now, can the updated version of the apk be installed? and secondly, if the updated version do gets installed, will it enable the application again? (by changing int newState from COMPONENT_ENABLED_STATE_DISABLEDhttp://developer.android.com/reference/android/content/pm/PackageManager.html#COMPONENT_ENABLED_STATE_DISABLED to COMPONENT_ENABLED_STATE_ENABLEDhttp://developer.android.com/reference/android/content/pm/PackageManager.html#COMPONENT_ENABLED_STATE_ENABLED, or COMPONENT_ENABLED_STATE_DEFAULThttp://developer.android.com/reference/android/content/pm/PackageManager.html#COMPONENT_ENABLED_STATE_DEFAULT ) Thanks Regards Aviral -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
Re: [android-beginners] R class breaks on downgrade?
I had the same problem recently. First as justin told you, make sure that you are not importing android.R class instead of your R class in your program. Then check if your res directory works fine, any problem in this directory will cause build to fail and R wont be re-built. for instance my problem was that downgrading from 1.6 to 1.5 made the resolution screen support folder (drawable-ldpi etc...) unvalid so R wasn't generated. Hope this help Lucas -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] Location Provider Questions
My widget needs to know its location but does not care whether it gets it from the GPS or the network. If I can get a finer location from the GPS that's fine. But if the GPS is not enabled or does not exist in the device, than I will use what I can get. I have some questions related to this: 1) Do I need both 'fine' and 'coarse' permissions to indicate that I can use both? Or will 'fine' also use the network if the GPS is not available. I don't want the user to think that a GPS is required in order for the application to work. But I do need to get lat/long one way or the other. 2) Is best practice still to do a backwards search through the list of available providers and to use the best one I find? 3) When setting up the location listener or intent to track location changes you have to specify the provider to use. But what if want to simply use the cheapest provider available? Thanks. -- Jake Colman -- Android Tinkerer -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
RE: [android-beginners] Location Provider Questions
You can use LocationManager.getBestProvider() function with some Criteria to get the good provider. If you have ACCESS_FINE_LOCATION permission access then you can use both gps/network provider. Detail you can check in LocationManagerService.java under checkPermissionsSafe() function. -Original Message- From: android-beginners@googlegroups.com [mailto:android-beginn...@googlegroups.com] On Behalf Of Jake Colman Sent: Thursday, July 01, 2010 5:12 PM To: android-beginners@googlegroups.com Subject: [android-beginners] Location Provider Questions My widget needs to know its location but does not care whether it gets it from the GPS or the network. If I can get a finer location from the GPS that's fine. But if the GPS is not enabled or does not exist in the device, than I will use what I can get. I have some questions related to this: 1) Do I need both 'fine' and 'coarse' permissions to indicate that I can use both? Or will 'fine' also use the network if the GPS is not available. I don't want the user to think that a GPS is required in order for the application to work. But I do need to get lat/long one way or the other. 2) Is best practice still to do a backwards search through the list of available providers and to use the best one I find? 3) When setting up the location listener or intent to track location changes you have to specify the provider to use. But what if want to simply use the cheapest provider available? Thanks. -- Jake Colman -- Android Tinkerer -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] getFromLocationName Service Not Available
Hey hey, I'm getting problems with getFromLocationName. Every time I run it, it stalls at the line: ListAddress addresses = geocoder.getFromLocationName(Megazone Leicester, Leicester, LE1 3HS, UK, 1); with a LogCat Error of: java.io.IOException: Service Not Available at android.location.Geocoder.getFromLocationName(Geocoder.java. 159). I've had a look around and it seems to be a bug, but can anyone verify it, as some people seem to have it working fine. Geocoder geocoder = new Geocoder(this); ListAddress addresses = geocoder.getFromLocationName(Megazone Leicester, Leicester, LE1 3HS, UK, 1); Address SiteAddress = addresses.get(0); Double geoLat = SiteAddress.getLatitude() * 1E6; Double geoLng = SiteAddress.getLongitude() * 1E6; GeoPoint point = new GeoPoint(geoLat.intValue(), geoLng.intValue()); Ta muchly :-) -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] Re: Application still consumes battery even tough it is closed
That is what the diagram says, yes. But the text of the table says something different: it says onPause() is called when the system is about to resume another activity. But it also says that onStop() may be called when the activity is no longer visible to the user. More importantly, it says that this may happen EITHER because another activity is being resumed (in which case onPause() will be called) OR because it (the current activity) is being destroyed. The implication is that no, we cannot count on onPause() being called before onStop() is called, even if this is by far the more common case. Similarly, the same table says elsewhere that the next state for onStart() can be EITHER onResume() OR onStop(). Again, no stop at onPause(). Finally, I should point out that in http://developer.android.com/guide/topics/fundamentals.html#actlife, the doc we are all following to discuss this issue, it says explicitly that this table offers MORE detail than the diagram (following table describes each of these methods in more detail). That implies that the diagram is incomplete, but the table is if not complete, at least more complete. In a formal spec, the distinction would probably have been 'normative' versus 'reference'. But the Android online docs do not use this terminology. On Jun 26, 4:51 pm, RichardC richard.crit...@googlemail.com wrote: Why both onPause() and onStop()? Looking at the application lifecycle diagram http://developer.android.com/images/activity_lifecycle.png it's not possible to get to onStop() without going through onPause(). If however, you have found this not to be the case, I will have to change my programs and also deal with possible exceptions from resources being released twice. Do you have a simple test as I have never seen this (onPause being skipped) happen? /Richard On 26 June, 17:13, mahesh askmah...@gmail.com wrote: And you have to unregister it in your OnPause() and onStop(). Just as ref if you do not know this already - OnPause() is called when you quit the application via the back button or start another app. OnStop() is called when it is actually killed (via task manager) - maheshhttp://android.maheshdixit.com On Jun 25, 2:25 pm, Mark Murphy mmur...@commonsware.com wrote: On Fri, Jun 25, 2010 at 5:21 PM, Flamechamp flamechamp1...@yahoo.com wrote: This may sound stupid, but I have a problem with my application. I made an application to check the accelerometer and orientation sensor. I tested it on my Nexus One and it works. The problem starts when I close it. (I pressed the - button in the phone) When I checked the Battery usage. That program I made is still there. You also need to be sure to unregister your sensor listeners. If you do not, your program will not truly end, and you will continue receiving sensor data. -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy _The Busy Coder's Guide to *Advanced* Android Development_ Version 1.6 Available! -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] Jet authoring problem: SONiVOX synth DLL in SDK won't load in Cubase or Sonar.
The EASDLL.dll is not recognized by Cubase SX 3.0.2, nor according to a poster on the developer's group, Sonar. Seriously broken or seriously misunderstood? If we're going to author Jet audio, we need this synth right? -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] normal-hdpi screened emulator thinks it's a large screened emulator
I am coding an application that uses different layouts for different screens. I have multiple layout folders for different combinations as follows: large-land-hdpi normal-land-ldpi normal-land-mdpi normal-land-hdpi small-land-ldpi all the different layout folders work for their respective combinations except for normal-land-hpi. It does not seem to be used by any emulator. Using the parameters specified by Google on the android dev website for defining a screen: normal-hdpi: WVGA @240dpi large-mdpi: WVGA @160dpi unfortunately, for some reason, when i run the emulator in eclipse, the normal-hdpi emulator thinks it is a large screened emulator, while the large-mdpi one correctly chooses the the large-land-mdpi layout. If anyone knows if this is a bug, or is supposed to be this way it would be most appreciated. Thank you -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] Context Menu pops-up twice
Hi, I'm trying to make a context menu for a little notes application, and it has some weird behaviour. My notes are categorized in.. well categories. I'm using a ExpandableListView to show the categories (groups) and notes (children). I have registered for context menu, and what happens is the following: * When I click and hold a category, my context menu pops up which has one option delete. * When I click delete, the category gets deleted and the context menu disappears, but then a new context menu pops up which has also delete in it, but it isnt clickable. The only way to close it is to use the back button. I don't get why that second context menu pops up and how I can get rid of it, I hope somebody here can help me. Here is my code, if additional code pieces please tell me. :) public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); ExpandableListView.ExpandableListContextMenuInfo info = (ExpandableListView.ExpandableListContextMenuInfo) menuInfo; int type = ExpandableListView.getPackedPositionType(info.packedPosition); // Context menu for categories if(type == ExpandableListView.PACKED_POSITION_TYPE_GROUP) { menu.addSubMenu(0, CONTEXT_DELETE_CAT, 0, R.string.delete); // Context menu for notes } else if(type == ExpandableListView.PACKED_POSITION_TYPE_CHILD) { menu.addSubMenu(0, CONTEXT_DELETE_NOTE, 0, R.string.delete); } } public boolean onContextItemSelected(MenuItem item) { ExpandableListContextMenuInfo info = (ExpandableListContextMenuInfo) item.getMenuInfo(); switch(item.getItemId()) { case CONTEXT_DELETE_CAT: long categoryId = info.id; db.categories.deleteWithNotes(categoryId); mAdapter.notifyDataSetChanged(); fillView(); return true; case CONTEXT_DELETE_NOTE: long noteId = info.id; db.notes.delete(noteId); fillView(); getExpandableListView().expandGroup(mOpenedCategory); return true; default: return super.onContextItemSelected(item); } } -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en