[android-developers] Compressing camera image to a certain size
Hello I am sending images taken from the camera to a server. I want to keep as high quality as possible but not exceed 1.5MB. When data from camera is less than 1.5MB i do not process it, but there are cases when data might be 3, 5 etc. I have looked around in the BitmapFactory and Bitmap class. Basically i need to Bitmap.compress with a dynamic quality parameter. How can I determine which quality to use inorder to get an unknown image data size to 1.5MB? Or is there an other way to handle this? Thx for any pointers. -- 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: How do know when user launches application
Forget about the video, I want to hook into when the user pushes my app icon, i.e. I want to know each time that the user is expecting the app to start. On Apr 8, 7:49 pm, theSmith wrote: > When the launcher is clicked, the current activity is always brought > up if it exists. So if you wanted to return to the parent activity you > would have to either finish the other activities on the stack or > relaunch the original activity. I can determine this by simply > setting a boolean when your app is paused/resumed etc. > > Personally, if your app tried to play a video every time I opened it, > regardless of whether or not I was in a different sub activity, I > would uninstall your app very fast. > > --- > Creator of My College Lifehttp://mycollegelife.org > > On Apr 8, 11:07 am, Ferm wrote: > > > > > I want to play a video when the main activity launches from the > > appicon. > > > Application.onCreate() is not always called and Activity.onResume/ > > onCreate is called to many times (e.g. when user goes back from child > > activity). > > > How can I do this? > > Thanks! -- 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 To unsubscribe, reply using "remove me" as the subject.
[android-developers] How do know when user launches application
I want to play a video when the main activity launches from the appicon. Application.onCreate() is not always called and Activity.onResume/ onCreate is called to many times (e.g. when user goes back from child activity). How can I do this? Thanks! -- 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 To unsubscribe, reply using "remove me" as the subject.
[android-developers] Spinner dropdown causes status bar to show in fullscreen
Hi I am using fullscreen mode, e.g. I do not have any statusbar. When I click a spinner, which opens the dropdown view, the status bar is shown for a short second then it hides again. This happens only when there are a certain amount of items in the dropdown. If its only about 5 items, the status bar is not shown. How can I keep the status bar hidden permanently? I'm using my own DropDownViewResource, do I need to put something in there? http://schemas.android.com/apk/res/android"; android:id="@+id/spinner_item" style="@style/spinner_item_dropdown" />- fill_parent
- 40dp
- true
- true
- 16dp
- @color/black
- center
As you can see I've tried android:windowFullscreen without success. -- 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 To unsubscribe, reply using "remove me" as the subject.
[android-developers] Re: Sending email with attachment
Where should it be placed? I also get size = 0 and then I get a error saying "file//: attachment paths must point to file:///sdcard" Igonoring attachment file On Apr 7, 11:11 pm, powder wrote: > Hi, > > Thanks so much Kumar! > > It turned out to be the placement of the line: > > sendIntent.setType("text/csv") > > Regards Jonas. > > On Apr 5, 2:43 pm, Kumar Bibek wrote: > > > > > public static void sendFile(Context context) { > > File exportDir = new > > File(Environment.getExternalStorageDirectory(), > > "mydir"); > > if (!exportDir.exists()) { > > exportDir.mkdirs(); > > } > > String csvFile = exportDir + "/file.csv"; > > File file = new File(csvFile); > > if (file.exists()) { > > Intent sendIntent = new Intent(Intent.ACTION_SEND); > > sendIntent.putExtra(Intent.EXTRA_SUBJECT, "CSV > > file"); > > sendIntent.setType("text/csv"); > > sendIntent.putExtra(Intent.EXTRA_STREAM, > > Uri.parse("file://" > > + > > Environment.getExternalStorageDirectory() > > + "/mydir/file.csv")); > > sendIntent.putExtra(Intent.EXTRA_STREAM, Uri > > > > .parse("file:///sdcard/mydir/file.csv")); > > > > context.startActivity(Intent.createChooser(sendIntent, > > "Send CSV file")); > > } else { > > Toast.makeText(context, "TTT", > > Toast.LENGTH_LONG).show(); > > } > > > This piece of code works fine. I got the mail with the attachment. > > > Thanks and Regards, > > Kumar Bibek > > > On Apr 5, 5:31 pm, Kumar Bibek wrote: > > > > I will try this and let you know. > > > > Thanks and Regards, > > > Kumar Bibek > > > > On Apr 2, 3:09 am, powder wrote: > > > > > The logcat says: > > > > > ... > > > > 04-01 18:33:06.230: INFO/ActivityManager(76): Starting activity: > > > > Intent { act=android.intent.action.SEND typ=text/csv flg=0x300 > > > > cmp=com.google.android.gm/.ComposeActivityGmail (has extras) } > > > > 04-01 18:33:06.290: INFO/ActivityManager(76): Starting activity: > > > > Intent { act=android.intent.action.SEND typ=text/csv flg=0x280 > > > > cmp=com.google.android.gm/.ComposeActivity (has extras) } > > > > 04-01 18:33:06.589: DEBUG/Gmail(4465): ComposeActivity added to > > > > message:0 attachment:|file.csv|text/csv|0|text/csv|LOCAL_FILE|file:/// > > > > sdcard/mydir/file.csv size:0 > > > > 04-01 18:33:06.609: INFO/Gmail(4465): > Attachment uri: > > > > file:///sdcard/mydir/file.csv > > > > 04-01 18:33:06.609: INFO/Gmail(4465): > type: text/csv > > > > 04-01 18:33:06.609: INFO/Gmail(4465): > name: file.csv > > > > 04-01 18:33:06.609: INFO/Gmail(4465): > size: 0 > > > > ... > > > > > and the file size is 0. My file is attached in the email as a file but > > > > always with 0 bytes (my file is 510 bytes)? > > > > > On Apr 1, 1:27 pm, Kumar Bibek wrote: > > > > > > Some logcat logs will be helpful in trying to figure out what went > > > > > wrong. > > > > > > Thanks and Regards, > > > > > Kumar Bibek > > > > > > On Apr 1, 2:10 pm, powder wrote: > > > > > > > Hi, > > > > > > > I never got this to work on a real device, got the email but no > > > > > > attachment, also when installing K9 on a emulator and > > > > > > then sending the email I see the mail in the outbox with a size of 0 > > > > > > bytes: > > > > > > > public static void sendFile(Context context) { > > > > > > File exportDir = new > > > > > > File(Environment.getExternalStorageDirectory(), > > > > > > "mydir"); > > > > > > if (!exportDir.exists()) { > > > > > > exportDir.mkdirs(); > > > > > > } > > > > > > String csvFile = exportDir + "/file.csv"; > > > > > > File file = new File(csvFile); > > > > > > if(file.exists()) { > > > > > > Intent sendIntent = new Intent(Intent.ACTION_SEND); > > > > > > sendIntent.putExtra(Intent.EXTRA_SUBJECT, "CSV file"); > > > > > > sendIntent.setType("text/csv"); > > > > > > //sendIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); > > > > > > //sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://" + > > > > > > Environment.getExternalStorageDirectory() + "/mydir/file.csv")); > > > > > > sendIntent.putExtra(Intent.EXTRA_STREAM, > > > > > > Uri.parse("file:///sdcard/ > > > > > > mydir/file.csv")); > > > > > > context.startActivity(Intent.createChooser(sendIntent, "Send CSV > > > > > > file")); > > > > > > } else { > > > > > > Util.displayToast(context, R.string.no_csv_file); > > > > > > } > > > > > > > } > > > > > > > Any help appreciated. -- You received this message because you are subscribed to th
[android-developers] Re: Problem with viewflipper animations and drawing cache
Well, I solved the issues, including the image issue, by adding the following line to the Theme @android:color/transparent On Mar 21, 5:11 pm, Ferm wrote: > Hello > > I have a viewflipper which I use to animate between views. The in/out- > animations are TranlateAnimations. > > During the animations, the views that are animated are covered by a > darker transparent foreground. How can I get rid of this? > > Further, if the view thats being animated contains layout child with a > background image set, the image looks really bad during the animation. > > I have tried calling the following methods on both the viewflipper and > it's child views, without success > setAnimationCacheEnabled(false); > setAlwaysDrawnWithCacheEnabled(false); > setDrawingCacheEnabled(false); > setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_HIGH); > > Any hints would be appreciated. > btw: I had a similar problem when scrolling listviews but solved it > setting scrollingCache to false > > I also have the same problem when animating with a TextSwitcher. > Strange thing is that the ApiDemos does not have this problem and I am > basically using that same code. Are these optimizations set on a > global level? Also, other examples using e.g. a ViewFlipper such as > thishttp://www.inter-fuser.com/2009/07/android-transistions-slide-in-and-..., > does not have this problem. What am I missing? > > thx -- 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 To unsubscribe from this group, send email to android-developers+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
[android-developers] Problem with viewflipper animations and drawing cache
Hello I have a viewflipper which I use to animate between views. The in/out- animations are TranlateAnimations. During the animations, the views that are animated are covered by a darker transparent foreground. How can I get rid of this? Further, if the view thats being animated contains layout child with a background image set, the image looks really bad during the animation. I have tried calling the following methods on both the viewflipper and it's child views, without success setAnimationCacheEnabled(false); setAlwaysDrawnWithCacheEnabled(false); setDrawingCacheEnabled(false); setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_HIGH); Any hints would be appreciated. btw: I had a similar problem when scrolling listviews but solved it setting scrollingCache to false I also have the same problem when animating with a TextSwitcher. Strange thing is that the ApiDemos does not have this problem and I am basically using that same code. Are these optimizations set on a global level? Also, other examples using e.g. a ViewFlipper such as this http://www.inter-fuser.com/2009/07/android-transistions-slide-in-and-slide.html, does not have this problem. What am I missing? thx -- 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 To unsubscribe from this group, send email to android-developers+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
[android-developers] Saving/Restoring List
Maybe this is more of a Java question.. I have a java.utils.List populated with instances of my own class. I want to save them and have them restored when running the app again. I'm thinking of saving it as a string in SharedPreferences. I need to serialize everything so I guess my CustomClass needs to implement Serializeable.. but List does not implement it. I was hoping to just call serialize on the list and the list would call serialize on all its items. How would you do it? Thx -- 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: Mapview scroll finished Listener
hmm, this is very sad I have potentially more than 1000 markers positioned worldwide that are fetched via network. I can't load all these at once in onCreate.. Yeah, maybe I'll set up a timer.. thx On Mar 12, 7:42 pm, Mark Murphy wrote: > Ferm wrote: > > How do I know when zoom has changed? > > Again, there is no good way to do this. > > A lousy approach that should work indefinitely is to poll the MapView, > calling getZoomLevel(), and watch for changes. However, polling is > inefficient. > > A lousy approach that will probably break between Android versions is to > use the deprecated getZoomControls() to obtain the ZoomControls that the > MapView uses and add listeners to those. > > A great approach that will take a year or two is to file an issue asking > for better zoom/pan events, then wait for such events to appear in Android. > > Off the top of my head, I cannot think of other alternatives. > > -- > Mark Murphy (a Commons > Guy)http://commonsware.com|http://twitter.com/commonsguy > > Android App Developer Books:http://commonsware.com/books -- 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: Mapview scroll finished Listener
How do I know when zoom has changed? On Mar 12, 7:04 pm, Mark Murphy wrote: > Ferm wrote: > > What's the recommended event for when map center and lat/long spans > > changes? > > There is no "recommended event" for those, AFAIK. > > -- > Mark Murphy (a Commons > Guy)http://commonsware.com|http://twitter.com/commonsguy > > _The Busy Coder's Guide to *Advanced* Android Development_ > Version 1.3 Available! -- 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: Mapview scroll finished Listener
Ok thanks What's the recommended event for when map center and lat/long spans changes? On Mar 12, 6:26 pm, Mark Murphy wrote: > Ferm wrote: > > I want to add overlays when the map has scroll/zoon animation has > > stopped at a position. > > > I am currently using onTouchEvent for ACTION_UP but this fires > > unnecessary many times e.g. when the user lifts his finger several > > times during scrolling. > > > So I basically want to hook in to the event that fires the loading of > > map images. > > There is no event for that, AFAIK. > > -- > Mark Murphy (a Commons > Guy)http://commonsware.com|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 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] Mapview scroll finished Listener
I want to add overlays when the map has scroll/zoon animation has stopped at a position. I am currently using onTouchEvent for ACTION_UP but this fires unnecessary many times e.g. when the user lifts his finger several times during scrolling. So I basically want to hook in to the event that fires the loading of map images. -- 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] Eclipse is too slow
Hello I just installed the latest version of Eclipse IDE for Java Developers together with the ADT plugin on my Mac (2.8 GHz, 4 GB Ram). - Opening new files from the package explorer. For example, opening a layout xml file takes 1-2sec- And the mouse pointer changes. - Switching between tabs - Resizing views in the workspace The performance rapidly decreases when I open more files. Are all of you developing under these circumstances? How can I speed up eclipse? Thanks -- 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