Re: [android-developers] Re: Java101 strings and ints
How about a boolean matrix? On Fri, Oct 29, 2010 at 1:39 PM, acr acr...@gmail.com wrote: thanks, I do understand, but I love to hate the pain.. Im rocking and rolling here, but there are some things I run into that I know more experience will fix.. but that's how I learn, I just hit a bump. On Oct 29, 12:20 pm, DanH danhi...@ieee.org wrote: It should be pointed out that this is a basic Java question, not an Android question. And more to the point it's a basic programming question. You'd be far better off learning more about programming on a desktop system before digging into the ugliness that is Android (or any other phone platform). It will be much less frustrating for you. On Oct 29, 10:55 am, acr acr...@gmail.com wrote: Hi all, Im new to android and java but moving along at full speed. My lack of experience is making some elementary tasks too repetitive. For example I want to be able to loop through the following snipit of code.. the problem is I want i replace the number 1 in g1m0+=1; so through each iteration g1m0 would become g2mo for (Graphic grap : _toCompare) { for(int i=1;i=7;i++){ if(grap.getCol()==i grap.getRow()==1){ g1m0+=1; }else if(grap.getCol()==i grap.getRow()==2){ g1m0+=1; g1m1+=1; }else if(grap.getCol()==i grap.getRow()==3){ .. I know this is a simple to the novices out there can you please give me some insight to shorten up my code here.. Thanks a bunch! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- If you want freedom, compile the source. Sebastián Treu http://labombiya.com.ar -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Java101 strings and ints
On Fri, Oct 29, 2010 at 1:44 PM, Sebastián Treu sebastian.t...@gmail.com wrote: How about a boolean matrix? Sry, I meant int matrix (i came from C). -- If you want freedom, compile the source. Sebastián Treu http://labombiya.com.ar -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: How to handle Home Key in our Activity
FAQ is a great idea, but will not solve the issue with repeated questions. Simply, the won't read it. They won't google. And it's something we need to live with. I consider myself a beginner and always try to find out myself a way, reading, googling, and so on. And when I find that's not obvious, I ask for help to learn and to grow as a developer. But, that's me. I'm trying to be a professional. Some people just don't care, or they are just playing around, or they are different. I think that never, ever, ever this problem will be completely removed. No matter how many FAQs you write, or how many how-to's are out there. The class of people that don't dig up by themself will never be an empty set. Best regards, -- If you want freedom, compile the source. Sebastián Treu http://labombiya.com.ar -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Ho to take a screenshot of the current activity and email it to a specific email id
On Sat, Sep 11, 2010 at 8:08 AM, Mark Murphy mmur...@commonsware.com wrote: On Fri, Sep 10, 2010 at 1:41 AM, DG gujar.dwark...@gmail.com wrote: Is there any way in Android SDK to get the screen shot. No. That would be a security hole. There are apparently ways to get this on rooted phones, though. I don't like to twist the topic, but curiosity is such that I want to know why. Can you provide a useful link or info on why it would be a security hole? Thanks! -- If you want freedom, compile the source. Sebastián Treu http://labombiya.com.ar -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Ho to take a screenshot of the current activity and email it to a specific email id
Thanks both. (why people uses its brain for evil rather than good? :( ) Regards, -- If you want freedom, compile the source. Sebastián Treu http://labombiya.com.ar -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Prevent Rotation/change of orientation in a certain tab/activity
On Sat, Sep 11, 2010 at 6:58 PM, Patrick patrick.manges...@gmail.com wrote: Hallo! My MainActivity (the one that is started by the android application) is a TabActivity which contains several tabs (which are implemented as activities as well). In a certain tab/activity I want to prevent the change of orientation/rotation when the phone is turned. What is the easiest way to achieve this? I don't know if it's the easiest. You can prevent an activity of being restarted by an orientation change by using android:configChanges and make your way in onConfigurationChanged(). Since you are using a TabActivity, I'm not sure what behaviour you want to achieve, and to be honest, I don't know much about TabActivity. But I can think, if posible, to manage the changes in the tab activity concerning the current activity that is running (the one you want to rotate you set the android:orientation) so you won't get the tabs rotated. But, that's an idea from someone away from a developer-computer right now, and junior to android development. -- If you want freedom, compile the source. Sebastián Treu http://labombiya.com.ar -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: is there a way to implement screenshot functionality in android
déjà vu? -- If you want freedom, compile the source. Sebastián Treu http://labombiya.com.ar -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers]How can i make to return from the external link to my application?
On Wed, Sep 8, 2010 at 7:35 AM, Lidia G lidyp...@yahoo.com wrote: When the link button is pressed from my application and the required internet page is opened, if i press back from the phone, it is not returning any time back to my application. Is there are any possibility to make it programmatically to return any time back to the application screen from which the link was opened? Hi Lidia, I think that reading this should be useful to you: http://d.android.com/guide/topics/manifest/activity-element.html#reparent Also check out the other options related. Cheers, -- If you want freedom, compile the source. Sebastián Treu http://labombiya.com.ar -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] runs on emulator crashs on galaxy s
On Wed, Sep 8, 2010 at 12:22 PM, momojo jason.kah...@gmail.com wrote: I have an app the runs fine on my emulator and my incredible with android 2.2. Users say my app won't run on the galaxy s. What options exist to troubleshooting this? Is there a special agreement for galaxy? It could be a permissions issue. Emulator runs rooted. Check your permissions. -- If you want freedom, compile the source. Sebastián Treu http://labombiya.com.ar -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Recommendation for an Application with tons of media files
Nice to hear your opinions, thanks all. Cheers, -- If you want freedom, compile the source. Sebastián Treu http://labombiya.com.ar -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Recommendation for an Application with tons of media files
Hi all, What will be the best storage choice for an application with huge amount of mb in media? The application will not be in android market. First choice was to use assets/ folder. At least, 160MB of audio is shipped with the application. When I moved all the media to the assets/ folder, I end up with: Conversion to Dalvik format failed: Unable to execute dex: null And reading: http://code.google.com/p/android/issues/detail?id=2328 suggest me that maybe it's not such a good idea to ship all the media in an .apk file. I think that the problem has nothing to do with large .java files, as it arises when I copy the bunch of audio to assets/. I was thinking in using the sd card storage. But, I don't want the user to accidentally remove the media files. I want it to be private, not accesible to possible deletions. So, another approach is to use the private storage and download the media in the application first run, or something like that. What would you suggest in such case? I have little experience in android development yet, and I'm trying to take the pros and cons about it, for then make the best choice. Best regards -- If you want freedom, compile the source. Sebastián Treu http://labombiya.com.ar -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Recommendation for an Application with tons of media files
Hi all, On Mon, Sep 6, 2010 at 5:45 PM, Droid rod...@gmail.com wrote: Yes, 160 MB cannot easily be bundled into the App Market? The app will not be in the market. As I already said. Market has a limit of ~24MB. On Sep 6, 8:01 pm, Filip Havlicek havlicek.fi...@gmail.com wrote: Hi Sebastián, 160MB is a lot of data, I think it is a must to save that much to SD card (I'm not sure how much is the common internal phone storage, but I wouldn't be surprised if it would be around 256MB in common cases). Although I have to disappoint you, I think there is no way to prevent user from accessing the data on SD card (this link supports my thoughtshttp://developer.android.com/guide/topics/data/data-storage.html#file...). You cypher the data somehow to prevent other applications from reading it successfully, although you are going to have to check for the data availability everytime you want to access it and throw an error message when they are not found (they actually don't have to be deleted, mounting SD card as mass storage to computer is enough to make them disappear to you). Best regards, Filip Havlicek 2010/9/6 Frank Weiss fewe...@gmail.com How might a user accidently remove them? Why is this a concern? There are a few file explorer down there, and for X reason people can remove data using them. The problem is that if that data is removed, it has to be downloaded again. 3G in my country is yet a poor technology and very slow. As Filip says, data can be accessed, although there's no copyright or licensing issues I'm concerned in data availability. Data is public indeed, but I want to be sure that the media is there and nobody had removed it. I'm also aware that 160mb is a huge quantity of space, but is what the application needs (it's a guided tour with audio related to the tour you are doing. And from now, you have up to 12 tours to choose from). Best regards, -- If you want freedom, compile the source. Sebastián Treu http://labombiya.com.ar -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Activities I Don't Want the User to be able to go Back to
I what performance concern, will using FLAG_ACTIVITY_NO_HISTORY make any changes? I mean, does the framework loads the task to the activity costly or not? I ask this just for curiosity and to know a little more, as one could think of launching the Activity with that flag if it's known that there's no need to keep it in the stack as later on it will be finished. -- If you want freedom, compile the source. Sebastián Treu http://labombiya.com.ar -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Activities I Don't Want the User to be able to go Back to
On Sun, Sep 5, 2010 at 7:49 PM, Sebastián Treu sebastian.t...@gmail.com wrote: I what performance concern, will using FLAG_ACTIVITY_NO_HISTORY make any changes? I mean, does the framework loads the task to the activity opps... correcting: does the framework loads the task to the *stack* -- If you want freedom, compile the source. Sebastián Treu http://labombiya.com.ar -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Gallery widget, focus and selection gone?
Hi there, I'm trying to realize how the focus and selection in the Gallery widget is doing their job. I'm facing weird situations when trying to update information (TextViews and Spinner) upon a selected item in the Gallery. The focus and selection is lost. So, using the resource gallery_item_background will end in showing the unselected background for the current selected image. I have used the .xml that came with the android sdk, and I can't realize how this is happening. I have set setFocusable(false) and setFocusableInTouchMode(false) to all other Views to try out (and true for the Gallery) without any luck. I have also add 'in-situ' debug, that is, a menu that updates differents widgets when onItemSelected() is called. So I can see while using the application how the background resource is applied. When set to 'no update' the obvious thing happens. None of the widgets are updated with new values, and the background resource works as expected. When set to 'manual update' (an update in the listener that do: .setText() on the textview) does work depending the current View that is showing the TextViews (I have a ViewFlipper that display 2 differents Layout of the TextViews). I know that It can be complicated to understand the scenario without the code, but basically, updating the Spinner will always remove the focus from the Gallery (the Spinner was set no-focusable before) and the image resource background will be set as unselected. How can I manage this updates? I also call requestFocus() and requestFocusFromTouch() after the updates are made. I can't realize where is the problem. I have an update that is made by a handler. Happens the same thing. Any idea how should I manage an update to other widgets upon a selection on the Gallery without losing focus or the selected state of the image view? Thanks, -- If you want freedom, compile the source. Sebastián Treu http://labombiya.com.ar -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] MapView + LocationManager Question
On Tue, Aug 10, 2010 at 9:31 PM, TreKing treking...@gmail.com wrote: On Tue, Aug 10, 2010 at 4:40 PM, Tommy droi...@gmail.com wrote: So if I were to set requestLocationUpdates(String provider, 6, 0, LocationListener listener, Looper looper) it would be the same on the batter as if I were to set a timer for every 1 minute or whatever to call up the GPS again? Yes, or better, I'd think. Having the GPS connected but not doing anything would probably be better than having it reconnect each time. That initial start up is probably a good chunk of the batter use. I'm doing field-test with a device. And, I will not encourage people that want a precise (about 5-8 meters) point to use minTime. Using it so, will turn off the Gps engine (STOPPED), start it again (STARTED), and trying to get a position. That takes about 10 seconds. After that you can take a not so accurate point. And, if it's for a pedestrian, the guy is 10 meters away (less than your desired accuracy). The best solution I found so far is not using minTime, and use the entire GPS engine during the use of the application or service. I had to decide between battery power or precision. I choose precision, as is a pedestrian guide for tourists. I know tourist aren't in a rush, but you can't assume that. I'll made a stress battery test after a full charge leaving the phone with the application running without setting minTime or distance and I'll let you know how much power consumes in a samsun i5700. -- If you want freedom, compile the source. Sebastián Treu http://labombiya.com.ar -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Ensure GPS has fix before proceeding..
On 5/13/10, TreKing treking...@gmail.com wrote: 2) What is the best way to display a please wait message or something along those lines while the GPS service is attempting to get a fix (and ideally periodically allow the user to cancel out)? Best is debatable - but you could use an AsyncTask that does whatever it is you need your GPS fix for and include getting a fix as one of it's steps, during which time you show an indeterminate progress dialog that says Getting your current location ... please wait... or something. That's what I do when the last known location will not suffice. Works well enough. Every time the gps is started, will it fire the GPS_EVENT_FIRST_FIX if a fix was previosly taken? What I mean is that if the answer is no, then how do we know in the GpsStatus.Listener that we have a fix? And, if the list of satellites informs that none of them has been used for getting the fix, will the GPS engine try to get another fix? Sadly, the doc it's not clear enough to me. I'm trying to understand how the thing works. First, I read about GPS, the first fix definition, almanac/ephemeris, cold-start, etc that are more general. But I don't know how the android engine works. I also noticed that if you set minTime!=0 in requestLocationUpdates() the GPS engine will be turned off, then it will be started and you will get bounced values. Setting it to 0 will eat your battery, but you can measure more accurate values (and turn it off if you want with a button). -- If you want freedom, compile the source. Sebastián Treu http://labombiya.com.ar -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Android Emulator vs iPhone emulator (Why does it take so long)
On 8/25/10, Frank Weiss fewe...@gmail.com wrote: Just to be a bit cheeky, why use the Android emulator at all? You know it doesn't cost $99/year to to run your Android apps on a device. Android development does not end on your country. I can't believe i'm reading this. -- If you want freedom, compile the source. Sebastián Treu http://labombiya.com.ar -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] PendingIntent and location updates
Hi all, I'm a little confused about the FLAGs on PendingIntents objects. I don't get exactly what the documentation wants to say to us. For example, when we obtain a PendingIntent to be used as a Intent Receiver trigger, we use: Intent intent = create a description of the intent we want to launch; PendingIntent pi = PendingIntent.getBroadcast(context, NOT_USED_YET, intent, FLAG); What does it mean: [...] if the described PendingIntent already exists [...] ? Does it means if that intent description was already allocated to be launched? If so, what would happen when the last line is called the second time if we have set the PendingIntent to be launched by a location update? Do we need to remove the location update before using the PendingIntent object? I can't get quite well the PendingIntent concept. For me it's just like a loaded gun already to be fired (in the BroadcastReceiver context) upon certain circumstances. For instance, if we resquestLocationUpdates() with a PendingIntent created with FLAG_CANCEL_CURRENT, do we need to remove the update? The old object will not exist...right? Sorry this confusion, and thanks for any clarification. Regards, -- If you want freedom, compile the source. Sebastián Treu http://labombiya.com.ar -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] PendingIntent and location updates
Hi Mark, Thanks for explaining how they are compared. On Thu, Aug 19, 2010 at 7:28 AM, Mark Murphy mmur...@commonsware.com wrote: On Thu, Aug 19, 2010 at 6:23 AM, Sebastián Treu sebastian.t...@gmail.com wrote: What does it mean: [...] if the described PendingIntent already exists [...] ? Pretty much exactly what it says. PendingIntents are compared by comparing their Intents. Intents are compared via filterEquals(). filterEquals() looks at component, action, MIME type, and category, to see if the Intents are equivalent. But, where does they live? I mean, it the PendingIntent created with a Factory and when getBroadcast() is called you get a reference to it?. Then, if you call getBroadcast() again, will it take the intent you specify as an argument, look at every PendingIntent it has allocated and compared the way you explain? Does the framework maintain a list of allocated PendingIntent objects? That will clarify the concept to me lot. -- If you want freedom, compile the source. Sebastián Treu http://labombiya.com.ar -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] PendingIntent and location updates
On Thu, Aug 19, 2010 at 7:40 AM, Sebastián Treu sebastian.t...@gmail.com wrote: Hi Mark, Thanks for explaining how they are compared. On Thu, Aug 19, 2010 at 7:28 AM, Mark Murphy mmur...@commonsware.com wrote: On Thu, Aug 19, 2010 at 6:23 AM, Sebastián Treu sebastian.t...@gmail.com wrote: What does it mean: [...] if the described PendingIntent already exists [...] ? Pretty much exactly what it says. PendingIntents are compared by comparing their Intents. Intents are compared via filterEquals(). filterEquals() looks at component, action, MIME type, and category, to see if the Intents are equivalent. But, where does they live? I mean, it the PendingIntent created with a Factory and when getBroadcast() is called you get a reference to it?. Then, if you call getBroadcast() again, will it take the intent you specify as an argument, look at every PendingIntent it has allocated and compared the way you explain? Does the framework maintain a list of allocated PendingIntent objects? That will clarify the concept to me lot. I manage to reach the source code, this is what getBroadcast() does: IIntentSender target = ActivityManagerNative.getDefault().getIntentSender( IActivityManager.INTENT_SENDER_BROADCAST, packageName, null, null, requestCode, intent, resolvedType, flags ); return target != null ? new PendingIntent(target) : null; I read also the code within ActivityManager. That will be a new reference every time is invoked. Objects could be differents references but the IntentSender could be the same if I understood the code correctly. I was wrong on the references. Cheers, -- If you want freedom, compile the source. Sebastián Treu http://labombiya.com.ar -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] PendingIntent and location updates
Finally, I found what would do removeUpdates(PendingIntent). No matter what object reference you pass through, it will get the receiver: public void removeUpdatesPI(PendingIntent intent) { try { synchronized (mLock) { removeUpdatesLocked(getReceiver(intent)); So, there's no problem getting new instances of a PendingIntent every time you call getBroadcast(). What it matters is certainly the PendingIntent description so the target is the same of every different object, and so the receiver. At least, that is what finally I think what understood. Cheers, -- If you want freedom, compile the source. Sebastián Treu http://labombiya.com.ar -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: How to invoke another application on a Button Click?
On Wed, Aug 18, 2010 at 6:07 PM, dillipk codersnet2...@gmail.com wrote: How do I get the 'Intent' of a 3rd party application in order to start the activity? public void startActivity (Intent intent) Intent intent = new Intent(SOME_ACTION); If the application knows to manage SOME_ACTION it will be triggered by the Android framework automatically. For starting googlemaps for example: Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(geo:0,0?q=my+street+address)); -- If you want freedom, compile the source. Sebastián Treu http://labombiya.com.ar -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] AsyncTask, back button and cancel(boolean)
On Sun, Aug 15, 2010 at 7:43 PM, Mark Murphy mmur...@commonsware.com wrote: On Sun, Aug 15, 2010 at 5:37 PM, Filip Havlicek havlicek.fi...@gmail.com wrote: I'm just wondering what happens to running AsyncTask when the back button is pressed. Nothing happens to your AsyncTask when the BACK button is pressed. Doesn't seem to invoke onCancelled or onPostExecute in my AsyncTask. Correct. Bear in mind that AsyncTask does not have to be used by an Activity. It could be used by a Service, for example. This is right? I mean, I re-write code that I wrote as a Thread/Runnable with an AsyncTask after reading the android dev blog [0]. Should I re-write it again to be a Runnable? [0]: http://android-developers.blogspot.com/2010/07/multithreading-for-performance.html -- If you want freedom, compile the source. Sebastián Treu http://labombiya.com.ar -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Application state when Home pressed
On Sat, Aug 14, 2010 at 6:04 PM, viktor victor.scherb...@gmail.com wrote: OK, my third try to tell you what is my issue mean. For example: Activity0 -- it is a super class, Activity1, ...2, ... 3, ...4 my children classes from Activity0. Activity1 extends Activity0 Activity1, ...2, ...3, ...4 can start another examples of Activity0, My activity stack can be like this: Activity1; Activity5; Activity12(top). . My customers want that application update some information if app comes to foreground. In my case it happen in Activity0 { onMyUpdate() {..} }. Android application can go to the background by HOME button. If Home pressed onPause() will call. If app come to the foreground by long click on HOME onResume() is call. I try call my method in all Activity life cycle methods but result the same, my method calling always, when activity is coming to the foreground, back to previous activity, start new activity. That's how supossed to be. When Activity1 launchs Activity5, Activity1 goes background and can be killed at any time by the system. Now, if you go to home, Activity5 goes to backgroud. Going back to your application, Activity5 cames on foreground. Pressing back, Activity1 goes to foreground destroying Activity5. I think you'll need to redesign as you can't think yourself from where you are coming to foreground. If you are using only different views, try thinking on that: using just differents views (if they aren't too much though). Where I can put my update method if activity return to the foreground? If you want just play dirty, maybe there's a way to catch the home button press (I don't know if possible) event. But, your activity can be killed at any time. You can't make assumptions when your activity is no more visible. -- If you want freedom, compile the source. Sebastián Treu http://labombiya.com.ar -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Chilling news: Oracle sues Google over Android
On Sat, Aug 14, 2010 at 12:34 PM, Fabrizio Giudici My point is that we developers should not be much worried about that. I don't think that Oracle has any real intention to shut down Android, since it's a pot of money. You usually want to have a part of it, or be part of the game, not to destroy it. My principal concerns about Android are the same as one week ago, that is to make my app work at best. The problem it's not if Oracle wants to shutdown Android. The problem is how this will *affect* the android platform both acceptance and distribution. Android is new and it's making his way in the market. With this issue on the horizon, how will affect Android to be the choice of phone makers? Will you risk, as a phone maker, to continue supporting Android and distributing it in your phone without knowing what is happening behind the scenes? It's a PITA and I'm worried about it. I was creating myself big expectations with this. I'm new making my way as a developer and as an android developer (4 months), and now I'm a little worried. Regards, -- If you want freedom, compile the source. Sebastián Treu http://labombiya.com.ar -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Application state when Home pressed
On Sat, Aug 14, 2010 at 7:04 PM, viktor victor.scherb...@gmail.com wrote: Thanks Sebastián, But render different views on the same activity it is not good, it is better for desktop app but not mobile. Because Android cashed activity to prevent rendering the same type views. Thats not a fact. It depends on how you really are creating an Activity, or you just simply are displaying more information about the same thing you showed before (thats why the _recomendation_). An Activity should be a task. It is need investigate your thing that activity which in background can be killed. Activity1---Activity2--Activity3. I think that Activity1 never will be killed. Well, the activity life-cycle does not say that: http://d.android.com/images/activity_lifecycle.png Check the flow to process is killed when memory is needed. Every time activity is paused/stopped, your Activity may be destroyed. If we have low memory, another application process will be killed but not active application. And AFAIK, destroying an Activity does not means killing your whole Application. Regards, -- If you want freedom, compile the source. Sebastián Treu http://labombiya.com.ar -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Application state when Home pressed
In what your problem concern, and if you want to assume that your Activity that goes to background when home key is pressed it's not killed, I think you can override the methods, onSaveInstanceState() and onRestoreInstaceState(). When saving the state you save a homeKeyWasPressed value. You have KeyEvent.KEYCODE_HOME that I supposed is the home key: http://d.android.com/reference/android/view/KeyEvent.html#KEYCODE_HOME Then, you manage your homeKeyWasPressed state, and you save it and restore it with the methods mentioned above. I think it should be a _possible-but-no-good_ solution. Regards, -- If you want freedom, compile the source. Sebastián Treu http://labombiya.com.ar -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Looking for a design tip/advice/doc
On Tue, Aug 3, 2010 at 5:00 PM, bruce palant...@gmail.com wrote: If you are just doing a few items, it's not going to be a big deal. Same with grabbing data from a database. It's an issue when you have to scroll through lots of data and repopulate views, deal with flings, etc., while maintaining good speed. Sounds like you won't have to deal with this. Another way to approach this is to work with something like SimpleCursorAdapter and map your database onto the layout so it automagically populates. This only makes sense if you are going to display a set of info; lists/grid. In fact, I'm already using a SimpleCursorAdapter for a Spinner in the same Activity to improve the user experience. The Activity has a Gallery/ListView (while portrait or landscape), a Spinner for the selected ImageView from the Gallery/ListView, so the user has the posibility to go across the whole list, or just pick one within the Spinner. The ImageView shows you an image that could be interesting but maybe you don't know it. And the Spinner shows you a name, that maybe you are familiar with. So, you have the possibility of choose that. This two widgets are connected each other in terms that selecting something in the Spinner will select something in the Gallery/ListView and that will update 5 TextViews. For instance, only I have 12 rows of things to pick, but it could be more. Also, picking just one will expand more information about that row. Basically, it's a tour app, that has tours, that each tour has interest points. I know that google has recently create something like city tour, but it's not quite the same. And, I need to send another mail with a different topic to this list about some weird issues i'm facing with ListView. Thanks for the recommendations, Regards, -- If you want freedom, compile the source. Sebastián Treu http://labombiya.com.ar -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Weird situation with ListView and setting an ImageView background.
Hi all, I tried asking in the IRC to avoid making noise here, but noone has answered me. I can't understand or realize what's happening with my problem. The situation is like this: I have an ImageView configured in res/layout/image.xml. I have a res/layout-port and a res/layout-land directory that holds a layout with a Gallery for the former and a ListView for the latter. Both uses the same ImageAdapter I wrote, and the getView() looks like this: http://paste2.org/p/938866 (note a typo with 'cursor' and 'c', it should be just 'c' or just 'cursor'). When the .xml file sets the background: android:background=@drawable/gallery_unselected_default, ListView puts on top of it the ImageView making it invisible. But, if we uncomment the line 10 of the paste (and remove android:background from the xml) ListView puts the background and then the Drawable inside the background as _almost_ desired. The background is a 9-patch well formed. I said _almost_ because it doesn't strecht it to the background's content bound. I know it's not a Gallery and this widget does that because it's supposed to do that. But first, I want to realize why is happening what I mentioned before. For debugging purpouses, I wrote in the getView() method a line like this: if (position == 0) return inflater.inflate(R.layout.image, parent, false); I realize then, that the background was placed behind the Drawable like this: http://labombiya.com.ar/media/image1.jpg So, I removed the android:background line, uncommented the line 10 of the paste and the background was placed like this: http://labombiya.com.ar/media/image2.jpg Tha Gallery shows it fine in both situation. Setting the background through the xml file or through the code. But, that's because it's a Gallery, I'm aware of that and it's supposed to be so. But, what I cannot understand is this two differents behaviour with ListView when setting the background programmatically, or through xml. I cannot know why, so I'll be grateful if someone realize why. I mean, I can live with it but I need to know why is happening and why ImageView isn't scaled. Here's image.xml: http://paste2.org/p/938892 Cheers, -- If you want freedom, compile the source. Sebastián Treu http://labombiya.com.ar -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Looking for a design tip/advice/doc
On Mon, Aug 2, 2010 at 6:31 PM, Mark Murphy mmur...@commonsware.com wrote: On Mon, Aug 2, 2010 at 5:20 PM, TreKing treking...@gmail.com wrote: I have read from many sources that findViewById() is a costly operation. What sources? Actually, it's described in several places as being costly, such as the books from some commons guy. I suspect the source material for this was some recommendations from Romain Guy in 2008. He re-emphasized the point in his 2010 Google I|O presentation. Yes, indeed. In fact, I just saw that Google I/O video (The world of ListView) and a few more about android. He emphasizes actually that using the LayoutInflater is costly, more than calling findViewById(). @Treking (that I suppose isn't your name): Thanks, I will think about the class approach and sorts like that. Regards, -- If you want freedom, compile the source. Sebastián Treu http://labombiya.com.ar -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Looking for a design tip/advice/doc
Hi all, 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: imageTitle = (TextView)findViewById(R.id.title_image_view); title = (TextView)findViewById(R.id.title; desc = (TextView)findViewById(R.id.desc); duration = (TextView)findViewById(R.id.duration); distance = (TextView)findViewById(R.id.distance); 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. Thanks, -- If you want freedom, compile the source. Sebastián Treu http://labombiya.com.ar -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Animation doubt
Hi all, I want to slide down a RelativeLayout filled with information. I have written this animation: ?xml version=1.0 encoding=utf-8? translate xmlns:android=http://schemas.android.com/apk/res/android; android:fromYDelta=0 android:toYDelta=87% android:duration=350 android:fillAfter=true / The animation parameters are ok. But, when fillAfter is true, the RelativeLayout measures are wrong. In fact, the getTop() is still the same as before. And, if I set a listener to call layout(int,int,int.int) onAnimationEnd(), the layout dissapears until I click it. I call layout() this way in onAnimationEnd() method: if (animations[MOVE_DOWN] == animation) { textBox.layout(left, top, right, bottom); textBox.postInvalidate(left, top, right, bottom); //just for testing if this redraws the layout And, if I set the fillAfter to false, and onAnimationEnd() I call the layout() method without the invalidate method, when the view gets updated (it's connected to a onItemClickListener from a Gallery) with information, it will be redraw expanded. Anyone can give me a tip how to create such effects? I set a background layout as those folders tabs. I want to slide it down and up, upon user touch events. I managed to do that. The animation is like I want, but data it's not consistent. How to make the layout data consistent with the animation data? I tried out with the listener calling the layout() method, but the RelativeLayout dissapears. Any help? Regards, PS: I can make a video to show how the animation is missbehaving. -- If you want freedom, compile the source. Sebastián Treu http://labombiya.com.ar -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] How to manage an event by 2 widgets
Again, answering myself =) Solution was on the documentation ;-) I found a method from gallery called: setCallbackDuringFling (boolean shouldCallback). That method, when shouldCallback is true, calls the OnItemSelectedListener. Then, we can 'bounce' there back or forward a position we want, regarding the actual position we are. And, ironically I also found a method that leaves you exactly in the position you want :S. So, there's no need to emulate touchs or events like so. Just calling: setSelection(position) the adapterview will jump directly to that item. So, there was no need to override Gallery. Just set the callback during fling to true and write something like this on the item selected listener: public void onItemSelected (AdapterView? parent, View v, int position, long id) { View sideView = parent.findViewById(last); if (sideView != null last != position) sideView.clearAnimation(); if (v != null position != 0 position != parent.getCount() - 1) v.startAnimation(grow); if (position == LEFT_JOG_POSITION) parent.setSelection(1); if (position == RIGHT_JOG_POSITION) parent.setSelection(7); last = position; } } Working now, -- If you want freedom, compile the source. Sebastián Treu http://labombiya.com.ar -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] How to manage an event by 2 widgets
On Sat, Jul 10, 2010 at 6:31 PM, Mark Murphy mmur...@commonsware.com wrote: On Sat, Jul 10, 2010 at 5:22 PM, Sebastián Treu sebastian.t...@gmail.com wrote: Then clone the Gallery class in your project and make your changes there. I thought on that, but my 'clone' will be on my package and there's some protected variables that they don't have (or I can't find them) the proper getters and setters. Odds are those will be on AbsSpinner, which you may have to clone as well. If you would need to clone more than those two, then I'd consider another direction. Indeed. I found a solution! Not the best as I want it. I was hoping to modify a widget to be spreaded and used. That feature is nice. Having the option to add a slider to be pulled out. I have to say that I was dissapointed after reading the source code of the Gallery widget. I realized the bad focus behaviour that I mention on another thread, and the global variables within packages it's not my style. Also, the impossibility to override or to provide a different filling function is an unwise choice. What I have done is to provide to the adapter the drawable I want to be drawn in the edges. And, set a different background resource and scale for them. Thought, they will be threated and centered as a Gallery item. For the jogs I defined a selector so when you click them you have a different color, and I have the animation turned off for those positions. So, you see the scale animation only on the picture items. The problem is that the image is on top of the next item. Can it be put behind? Here's some stuff: http://labombiya.com.ar/media/device.png http://labombiya.com.ar/media/device1.png http://labombiya.com.ar/media/vid.mpeg Best regards, -- If you want freedom, compile the source. Sebastián Treu http://labombiya.com.ar -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] How to manage an event by 2 widgets
Well, i'm aswering to myself. I really like this modification to be used by someone, so If someone likes it I can tell him how to do it. What I have done was to extend Gallery and override onScroll() so when the selected view is the next one to the jog, it won't scroll anymore. Also, I need to modify onFling() and see what to do there... (possible things is to avoid flinging, or limiting the fling somehow, as it's a runnable within the Gallery widget that is started on the appropiate event). But for now, that works when scrolling. The other modification is to override onWindowFocusChanged() to emulate a 'touch' event so the Gallery centers our first image. After that, the Gallery will center our first image. It will be like a click to the 2nd image from the Adapter, so you need to calculate X_COORDS and Y_COORDS according your needs. Then, you need to prevent clicking on the jog overriding onSingleTapUp() and making some calculations. An important thing to mention is that I have identified every View with setId(position) in the Adapter getView() method. These are the drawable xml files for the jogs, left and right (I modified an file from android platform): http://paste2.org/p/911856 http://paste2.org/p/911852 Well, thats makes the Gallery looks like I want it. The bad thing is that I should see what to do with the fling, as it's a Runnable that runs on the Gallery object (yes, pretty ugly design). I have to say that this widget is not flexible at all. Hope that serves to anyone there. Bad luck that the topic it's not descriptive though, here's the code: http://pastebin.com/cEVd03t8 This is how it works (at the end I left the fling effect to see how it should be changed, or prevent to fling): http://labombiya.com.ar/media/vid.mpeg If anyone can provide a probable solution to the fling effect, I would be grateful. Best regards, -- If you want freedom, compile the source. Sebastián Treu http://labombiya.com.ar -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] How to manage an event by 2 widgets
Hi all, I want to change how a gallery looks like. I want to add 2 jogs at each side, so looks like this: http://omploader.org/vNHc2Yw/device.png First approach was to add the jogs to the ImageAdapter (at the beginning and at the end) for the Gallery. The Gallery will show the items as usual, but It will apply the custom background, and also if you specify spacing, you will get an ugly gallery. Also, I want the jog not to be centered as the others images. Then, I decided to download the whole api, and modify the Gallery source in a way so to handle specially the first item and the last item of the adapter. But, I don't know how to compile the api alone. The Makefile in the root project will build 6gb of the whole android platform. If someone can explain me how to build just the API, I will be grateful. The other approach was to compose Views. I thought to add ImageView's to the left and right corner and to be scrolled when needed, but when the Gallery capture the events I can't forward it to the holder of the ImageViews. So, I extend Gallery, and I override onScroll() like this: super.onScroll(e1,e2,distanceX,distanceY); return false; and also onTouchEvent() like this: super.onTouchEvent(event); return false; but unfortunately when I return false wihtin onTouchEvent() the Gallery does not scroll. So, main questions are: 1) How can I compile the modified API to generete a MyGallery.class to be added to android.jar? If I modify the source code of Gallery.java I can manage the fill of the Gallery for the specific items I want (i already read the source code). 2) In other approach, Is it posible to handle one event by 2 widgets? If so, I could overlap the Gallery above a jog. The Gallery will scroll as he knows, and I will scroll as I want. 3) If those approachs are bad, what will you recommend ? PS: I don't get why the Gallery does not have this nice feature I want to implement, kind of: setBorders(left, right) and etc. The problem on extending Gallery, is that when you add a View (for instance, the jog), you specify a position. Gallery fills the gallery getting the Views of it container with: getChildAt(0) and getChildAt(numChildren -1) when filling to right and left, respectively. Then, it gathers the 'unseen' Views from the Adapter. So the added view (the 'jog') will be scrolled by Gallery, but when the view is no longer visible, the Gallery itself has no way to get back that view, as it's not in the Adapter. Thanks in advance, Best regards, -- If you want freedom, compile the source. Sebastián Treu http://labombiya.com.ar -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] How to manage an event by 2 widgets
Hi Mark, thanks for the reply. If I modify the source code of Gallery.java I can manage the fill of the Gallery for the specific items I want (i already read the source code). Then clone the Gallery class in your project and make your changes there. I thought on that, but my 'clone' will be on my package and there's some protected variables that they don't have (or I can't find them) the proper getters and setters. Regards, -- If you want freedom, compile the source. Sebastián Treu http://labombiya.com.ar -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Wrong API reference doc?
Hi all, Building with: [setup] Android SDK Tools Revision 6 [setup] Project Target: Google APIs [setup] Vendor: Google Inc. [setup] Platform Version: 2.2 [setup] API level: 8 From here: http://developer.android.com/intl/fr/reference/android/view/ViewGroup.html#onRequestFocusInDescendants%28int,%20android.graphics.Rect%29 The documentation says that direction should be one of: FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, and FOCUS_RIGHT. From here: http://developer.android.com/intl/fr/reference/android/view/View.html#FOCUS_FORWARD. The doc says that FOCUS_FORWARD is a value to be used with 'focusSearch(int)'. And from here: http://developer.android.com/intl/fr/reference/android/view/View.html#focusSearch%28int%29 The doc says that direction should be one of: FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, and FOCUS_RIGHT. I needed to extend Gallery as it seems to manage absolutly BAD the focus on the selected view. When I was overriding: 'onRequestFocusInDescendants(int direction, Rect previouslyFocusedRect)' I made a debug to see which value was 'direction'. It was 2 (FOCUS_FORWARD). I was NOT calling requestFocus(int, Rect), so the view system was. After that, I made a 'focusSearch(FOCUS_FORWARD)' from a View and I get an illegal argument exception. Any ideas where that '2' came in? And why the doc says that FOCUS_FORWARD is to be used in focusSearch() in the constant details but in the method description says no. Best regards, -- If you want freedom, compile the source. Sebastián Treu http://labombiya.com.ar -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Using same sqlite database from multiple Activities and Services
On Wed, May 12, 2010 at 7:25 PM, brucko geoff.bruck...@gmail.com wrote: This all sounds like a local Service to me. Open the db in onBind if its not open. Let the service take care of how many Activities/ Services are bound and close the db in onUnbind. If you don't have a reference to the db and you are trying to open it, how do you know if it's opened or not? -- If you want freedom, compile the source. Sebastián Treu http://labombiya.com.ar -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Confused on android stacking activies
Any clues? -- If you want freedom, compile the source. Sebastián Treu http://labombiya.com.ar -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Confused on android stacking activies
Thanks both of you. I apologize my english for trying to explain myself. I thought the stack was global. The service manages notifications to the user, not necessarily when showing my own Application. So I guess the Context has to do here when the activity is launched so it then can return to the proper place. I'll put my head on Task Affinity. Thanks for guide my knowlegde, Best Regards, -- If you want freedom, compile the source. Sebastián Treu http://labombiya.com.ar -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Confused on android stacking activies
Hey guys, thank you so much. From: http://developer.android.com/intl/fr/guide/topics/manifest/activity-element.html#aff I set the activity to be android:taskAffinity=some-task, and now hitting back returns to the some-task application. I like when people guide others to find the solution thenselves reading =) Thats what I was looking for, not an actual solution, just a guide from people who know better of this than me. Thanks, Best Regards -- If you want freedom, compile the source. Sebastián Treu http://labombiya.com.ar -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] MediaPlayer, AssetFileDescriptor and FileDescriptor doubt
Hi, I was wondering why I needed to do this to play a single file in MediaPlayer: [code] FileDescriptor audioFd = null; AssetFileDescriptor assetFd = null; String fileName = audio/+lang+/+String.valueOf(code)+.mp3; System.out.println(AUDIO FILE NAME: +fileName); assetFd = ctx.getAssets().openFd(fileName); System.out.println(assetFd.length(): +assetFd.getLength()); audioFd = assetFd.getFileDescriptor(); mp = new MediaPlayer(); mp.setDataSource(audioFd, 0, assetFd.getLength()); mp.prepare(); mp.start(); mp.setLooping(true); [/code] If I do: [code] audioFd = ctx.getAssets().openFd(fileName).getFileDescriptor(); mp = new MediaPlayer(); mp.setDataSource(audioFd); [/code] The media player is filled with the files within the directory I open the AssetFileDescriptor. I mean, It plays the first file, the second, and so on. Althought, assetFd.getLength() returns the correct length of the file, when I get the file descriptor with getFileDescriptor(), the MediaPlayer plays ALL the files, so reading the API I found the setDataSource() method with helps me to play correctly only one file: public void setDataSource (FileDescriptor fd, long offset, long length) Could someone explain me to this please? Thanks in advance, -- If you want freedom, compile the source. Sebastián Treu http://labombiya.com.ar -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: MediaPlayer, AssetFileDescriptor and FileDescriptor doubt
Could someone explain me to this please? Sry, *to* should not be there, requestioning: Could someone explain me this, please? regards, -- If you want freedom, compile the source. Sebastián Treu http://labombiya.com.ar -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Confused on android stacking activies
Hi, I'm a little confused in what stacking concern. This is the scenario I have: I wrote an application that has several activies. Let's call it application A. Application A starts a service and launchs another application, not owned by me. The service, notify the user using notifications. When the user launchs the note, an activity of A is displayed. That is at least expected by me. But then, when the user hits the back button, instead of returning to the last-in-foreground application, android returns to application A. So now, the launched application is on background. Why is this? I have some questions about it: 1. when the Intent note was launched, did android finish the launched application? 2. has the Intent context (in fact, the PendingIntent) has anything to do with this? 3. Is there a way to make this behaviour turn in what I want? That is, hitting back on the Intent note returns to the last-in-foreground application. Thanks for clarifying me this, Regards, -- If you want freedom, compile the source. Get gentoo. Sebastián Treu http://labombiya.com.ar -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en