[android-developers] Bitmap on sdcard decodestream
Easy i was playing with a little app i'm developing but i've just found a little problem... let's explain me it... I created a sdcard and inside it I placed some jpg files. So my data path is something like: /sdcard/app/img/1.jpg /sdcard/app/img/2.jpg /sdcard/app/img/3.jpg /sdcard/app/img/4.jpg [...] /sdcard/app/img/n.jpg Now I want to create a gallery app to show out these files, I looked at demo srcs by android sdk, but they always use imgs from resources... I decided to try using Bitmapfactory.decodeFile and also Bitmapfactory.decodestream but both seems not to work fine returning a NullPointerException Here you are a little snippet of my app: Java: for(int i=0;iimgsTokens.length;i++) { Log.d(+i,/sdcard/app/img/+imgsTokens[i] +.jpg); try { FileInputStream is = new FileInputStream(new File(/sdcard/app/img/+imgsTokens[i]+.jpg)); BufferedInputStream bis = new BufferedInputStream(is); photos[i] = BitmapFactory.decodeStream(is); bis.close(); is.close(); //photos[i] = BitmapFactory.decodeFile(/ sdcard/app/img/+imgsTokens[i]+.jpg); } catch(Exception e) { e.printStackTrace(); } } any idea how to fix? --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Bitmap on sdcard decodestream
Hi sahn0 thanks for the tip, but it still fails with a NullPointerException... I tried looking at f.isFile() and it returns true... so file exists... On 30 Set, 12:27, sahn0 [EMAIL PROTECTED] wrote: Maybe it is jpg format that causing problems? Try converting images to png. On 30 сент, 16:17, Matteo Crippa [EMAIL PROTECTED] wrote: Easy i was playing with a little app i'm developing but i've just found a little problem... let's explain me it... I created a sdcard and inside it I placed some jpg files. So my data path is something like: /sdcard/app/img/1.jpg /sdcard/app/img/2.jpg /sdcard/app/img/3.jpg /sdcard/app/img/4.jpg [...] /sdcard/app/img/n.jpg Now I want to create a gallery app to show out these files, I looked at demo srcs by android sdk, but they always use imgs from resources... I decided to try using Bitmapfactory.decodeFile and also Bitmapfactory.decodestream but both seems not to work fine returning a NullPointerException Here you are a little snippet of my app: Java: for(int i=0;iimgsTokens.length;i++) { Log.d(+i,/sdcard/app/img/+imgsTokens[i] +.jpg); try { FileInputStream is = new FileInputStream(new File(/sdcard/app/img/+imgsTokens[i]+.jpg)); BufferedInputStream bis = new BufferedInputStream(is); photos[i] = BitmapFactory.decodeStream(is); bis.close(); is.close(); //photos[i] = BitmapFactory.decodeFile(/ sdcard/app/img/+imgsTokens[i]+.jpg); } catch(Exception e) { e.printStackTrace(); } } any idea how to fix? --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Bitmap on sdcard decodestream
Hi Mike, i've just tried adding these few lines inside my code to hard-debug it: Log.d(stream,+is.available()); Log.d(stream,is.toString()); Log.d(bstream,+bis.available()); Log.d(bstream,bis.toString()); if(is==null) Log.d(stream,is null); and debugger says me: 09-30 15:41:52.605: DEBUG/3(951): /sdcard/app/img/7.jpg 09-30 15:41:52.615: DEBUG/stream(951): 22080 09-30 15:41:52.615: DEBUG/stream(951): [EMAIL PROTECTED] 09-30 15:41:52.645: DEBUG/bstream(951): 22080 09-30 15:41:52.645: DEBUG/bstream(951): [EMAIL PROTECTED] So i think it works fine and it's not null, but I still get the same error using bis and is input for bitmapdecode: 09-30 15:46:57.916: WARN/System.err(2066): java.lang.NullPointerException 09-30 15:46:57.916: WARN/System.err(2066): at com.app.Galleria.onCreate(Galleria.java:97) 09-30 15:46:57.916: WARN/System.err(2066): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java: 1122) 09-30 15:46:57.916: WARN/System.err(2066): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java: 2103) 09-30 15:46:57.925: WARN/System.err(2066): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java: 2156) 09-30 15:46:57.925: WARN/System.err(2066): at android.app.ActivityThread.access$1800(ActivityThread.java:112) 09-30 15:46:57.925: WARN/System.err(2066): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1580) 09-30 15:46:57.925: WARN/System.err(2066): at android.os.Handler.dispatchMessage(Handler.java:88) 09-30 15:46:57.935: WARN/System.err(2066): at android.os.Looper.loop(Looper.java:123) 09-30 15:46:57.935: WARN/System.err(2066): at android.app.ActivityThread.main(ActivityThread.java:3742) 09-30 15:46:57.935: WARN/System.err(2066): at java.lang.reflect.Method.invokeNative(Native Method) 09-30 15:46:57.935: WARN/System.err(2066): at java.lang.reflect.Method.invoke(Method.java:515) 09-30 15:46:57.945: WARN/System.err(2066): at com.android.internal.os.ZygoteInit $MethodAndArgsCaller.run(ZygoteInit.java:739) 09-30 15:46:57.945: WARN/System.err(2066): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:497) 09-30 15:46:57.945: WARN/System.err(2066): at dalvik.system.NativeStart.main(Native Method) And line 97 in Galleria.java is: photos[i] = BitmapFactory.decodeStream(is); On 30 Set, 15:09, Mike Reed [EMAIL PROTECTED] wrote: That is a correct way to call decodeStream. Are you sure the path is correct (i.e. are you getting a non-null fileinputstream)? --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Bitmap on sdcard decodestream
Ok, bug filed, but I don't think it could be related to images, i've just tested jpgs and pngs, and it fails with both of them... http://code.google.com/p/android/issues/detail?id=921 On 30 Set, 15:44, Mike Reed [EMAIL PROTECTED] wrote: Please file a bug for this, and attach one or more of the images and your code snippet. That will make it much easier to diagnose. thanks, mike On Sep 30, 2008, at 9:25 AM, Matteo Crippa wrote: Hi sahn0 thanks for the tip, but it still fails with a NullPointerException... I tried looking at f.isFile() and it returns true... so file exists... On 30 Set, 12:27, sahn0 [EMAIL PROTECTED] wrote: Maybe it is jpg format that causing problems? Try converting images to png. On 30 сент, 16:17, Matteo Crippa [EMAIL PROTECTED] wrote: Easy i was playing with a little app i'm developing but i've just found a little problem... let's explain me it... I created a sdcard and inside it I placed some jpg files. So my data path is something like: /sdcard/app/img/1.jpg /sdcard/app/img/2.jpg /sdcard/app/img/3.jpg /sdcard/app/img/4.jpg [...] /sdcard/app/img/n.jpg Now I want to create a gallery app to show out these files, I looked at demo srcs by android sdk, but they always use imgs from resources... I decided to try using Bitmapfactory.decodeFile and also Bitmapfactory.decodestream but both seems not to work fine returning a NullPointerException Here you are a little snippet of my app: Java: for(int i=0;iimgsTokens.length;i++) { Log.d(+i,/sdcard/app/img/+imgsTokens[i] +.jpg); try { FileInputStream is = new FileInputStream(new File(/sdcard/app/img/+imgsTokens[i]+.jpg)); BufferedInputStream bis = new BufferedInputStream(is); photos[i] = BitmapFactory.decodeStream(is); bis.close(); is.close(); //photos[i] = BitmapFactory.decodeFile(/ sdcard/app/img/+imgsTokens[i]+.jpg); } catch(Exception e) { e.printStackTrace(); } } any idea how to fix? --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Bitmap on sdcard decodestream
yes, i've just test them using the default app and also with the dev tools raw image viewer and both are able to show my pics :( Guillaume, may I ask you if can kindly paste a snippet of the code you are using to load an img from the sdcard? On 30 Set, 16:49, Guillaume Perrot [EMAIL PROTECTED] wrote: I also use BitmapFactory.decodeStream on images on the sdcard, but I have no problem. Does your images work with the standard Pictures application ? On Sep 30, 4:29 pm, Matteo Crippa [EMAIL PROTECTED] wrote: Ok, bug filed, but I don't think it could be related to images, i've just tested jpgs and pngs, and it fails with both of them... http://code.google.com/p/android/issues/detail?id=921 On 30 Set, 15:44, Mike Reed [EMAIL PROTECTED] wrote: Please file a bug for this, and attach one or more of the images and your code snippet. That will make it much easier to diagnose. thanks, mike On Sep 30, 2008, at 9:25 AM, Matteo Crippa wrote: Hi sahn0 thanks for the tip, but it still fails with a NullPointerException... I tried looking at f.isFile() and it returns true... so file exists... On 30 Set, 12:27, sahn0 [EMAIL PROTECTED] wrote: Maybe it is jpg format that causing problems? Try converting images to png. On 30 сент, 16:17, Matteo Crippa [EMAIL PROTECTED] wrote: Easy i was playing with a little app i'm developing but i've just found a little problem... let's explain me it... I created a sdcard and inside it I placed some jpg files. So my data path is something like: /sdcard/app/img/1.jpg /sdcard/app/img/2.jpg /sdcard/app/img/3.jpg /sdcard/app/img/4.jpg [...] /sdcard/app/img/n.jpg Now I want to create a gallery app to show out these files, I looked at demo srcs by android sdk, but they always use imgs from resources... I decided to try using Bitmapfactory.decodeFile and also Bitmapfactory.decodestream but both seems not to work fine returning a NullPointerException Here you are a little snippet of my app: Java: for(int i=0;iimgsTokens.length;i++) { Log.d(+i,/sdcard/app/img/+imgsTokens[i] +.jpg); try { FileInputStream is = new FileInputStream(new File(/sdcard/app/img/+imgsTokens[i]+.jpg)); BufferedInputStream bis = new BufferedInputStream(is); photos[i] = BitmapFactory.decodeStream(is); bis.close(); is.close(); //photos[i] = BitmapFactory.decodeFile(/ sdcard/app/img/+imgsTokens[i]+.jpg); } catch(Exception e) { e.printStackTrace(); } } any idea how to fix? --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Bitmap on sdcard decodestream
Thanks Romain, you are right! I totally forgot to init it... and it was driving me crazy :( On 30 Set, 18:24, Romain Guy [EMAIL PROTECTED] wrote: The fix is simple, initialize you array photos. In the bug report you filed, the array itself is null. The Bitmap returned by BitmapFactory is not. On Tue, Sep 30, 2008 at 2:17 AM, Matteo Crippa [EMAIL PROTECTED] wrote: Easy i was playing with a little app i'm developing but i've just found a little problem... let's explain me it... I created a sdcard and inside it I placed some jpg files. So my data path is something like: /sdcard/app/img/1.jpg /sdcard/app/img/2.jpg /sdcard/app/img/3.jpg /sdcard/app/img/4.jpg [...] /sdcard/app/img/n.jpg Now I want to create a gallery app to show out these files, I looked at demo srcs by android sdk, but they always use imgs from resources... I decided to try using Bitmapfactory.decodeFile and also Bitmapfactory.decodestream but both seems not to work fine returning a NullPointerException Here you are a little snippet of my app: Java: for(int i=0;iimgsTokens.length;i++) { Log.d(+i,/sdcard/app/img/+imgsTokens[i] +.jpg); try { FileInputStream is = new FileInputStream(new File(/sdcard/app/img/+imgsTokens[i]+.jpg)); BufferedInputStream bis = new BufferedInputStream(is); photos[i] = BitmapFactory.decodeStream(is); bis.close(); is.close(); //photos[i] = BitmapFactory.decodeFile(/ sdcard/app/img/+imgsTokens[i]+.jpg); } catch(Exception e) { e.printStackTrace(); } } any idea how to fix? -- Romain Guywww.curious-creature.org --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: How to add button to MediaController?
MediaController seems to work only with VideoView atm. On 24 Set, 02:14, stef [EMAIL PROTECTED] wrote: Hi, been trying to modify the MediaController widget to add a few custom buttons. I have tried to subclass it and add buttons to the linearlayout before te rewind and after tge fast forward with no success... is this even possible? I can always create my own MediaController class but that seems to be a waste... 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Emulator Skins for HTC Dream / T-Mobile G1
nice work! thanks :) On 24 Set, 09:41, Olaf Encke [EMAIL PROTECTED] wrote: Hello Android fans and developers. I just finished building the first HTC Dream/T-Mobile G1 skins for the Android emulator and would like to share them with you. Right now I have done the black version of the phone in portrait as well as in landscape mode. They are tested to work with the latest Android SDK version 1.0r1 (they also work with the 0.9beta). You can get them here:http://www.android.encke.net/(preview screenshots available) I hope you like them and can put them to good use. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Unable to create an URI for a local sound
I'm repling you directly here it could be useful for other ppl too... or someone could help us too... As far as I have understood atm there's no way to get android.resource:// to work property, I tested it using an inside browser in my app and it always bring me to a 404 error. Btw using the internal web browser I managed to reach at least files under assets directory using file:///android_asset/namefile.ext It works fine in loadUrl, eg. I tried to place there a .mp4 file and it returns a white screen (instead of the 404 error) so I think it is able to reach that file. I'm testing this with VideoView (because I'm managing to play a local video instead of a local sound) but it doesn't work :( It seems that both file:/// and android.resource aren't working fine with VideoView and Mplayer both atm. On 23 Set, 10:44, Matteo Crippa [EMAIL PROTECTED] wrote: I'm an Android novice, but what do you think about this solution? MediaPlayer mNotify; mNotify = MediaPlayer.create(this, R.raw.beep); mNotify.start(); It should play your audio file without problems On 23 Set, 04:13, CG [EMAIL PROTECTED] wrote: Hey, I try to play a local sound in a notification. The issue I meet is the folowing : I am unable to load the file. My code is : Uri uri = Uri.parse(android.resource://com.xirgonium.android/raw/ beep); mNotify.sound = uri; The package name is the one described in my manifest. I get the error : 09-23 01:55:12.692: WARN/NotificationService(47): error loading sound for android.resource://com.xirgonium.android/raw/beep 09-23 01:55:12.692: WARN/NotificationService(47): java.io.IOException: Prepare failed.: status=0xFFFC 09-23 01:55:12.692: WARN/NotificationService(47): at android.media.MediaPlayer.prepare(Native Method) 09-23 01:55:12.692: WARN/NotificationService(47): at android.media.AsyncPlayer$Thread.run(AsyncPlayer.java:76) Now if I try (as defined here :http://code.google.com/android/reference/android/content/ContentResol... Uri uri = Uri.parse(android.resource:// + PACKAGE_NAME + / + R.raw.beep); I get the error : 09-23 02:05:05.690: WARN/NotificationService(47): error loading sound for android.resource://com.xirgonium.android/2131034112 09-23 02:05:05.690: WARN/NotificationService(47): java.io.IOException: Prepare failed.: status=0xFFFC 09-23 02:05:05.690: WARN/NotificationService(47): at android.media.MediaPlayer.prepare(Native Method) 09-23 02:05:05.690: WARN/NotificationService(47): at android.media.AsyncPlayer$Thread.run(AsyncPlayer.java:76) I am pretty sure the package name is correct because I have the folowing apk in my emulator : -rw-r--r-- system system 263463 2008-09-23 02:04 com.xirgonium.android.apk I just try to load a .wav file. Can anyone help me on this point (code snippet is sufficient :-)) Or how can I be sure the file is in my apk ? Thanks for your help ! --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Unable to create an URI for a local sound
I'm an Android novice, but what do you think about this solution? MediaPlayer mNotify; mNotify = MediaPlayer.create(this, R.raw.beep); mNotify.start(); It should play your audio file without problems On 23 Set, 04:13, CG [EMAIL PROTECTED] wrote: Hey, I try to play a local sound in a notification. The issue I meet is the folowing : I am unable to load the file. My code is : Uri uri = Uri.parse(android.resource://com.xirgonium.android/raw/ beep); mNotify.sound = uri; The package name is the one described in my manifest. I get the error : 09-23 01:55:12.692: WARN/NotificationService(47): error loading sound for android.resource://com.xirgonium.android/raw/beep 09-23 01:55:12.692: WARN/NotificationService(47): java.io.IOException: Prepare failed.: status=0xFFFC 09-23 01:55:12.692: WARN/NotificationService(47): at android.media.MediaPlayer.prepare(Native Method) 09-23 01:55:12.692: WARN/NotificationService(47): at android.media.AsyncPlayer$Thread.run(AsyncPlayer.java:76) Now if I try (as defined here :http://code.google.com/android/reference/android/content/ContentResol... Uri uri = Uri.parse(android.resource:// + PACKAGE_NAME + / + R.raw.beep); I get the error : 09-23 02:05:05.690: WARN/NotificationService(47): error loading sound for android.resource://com.xirgonium.android/2131034112 09-23 02:05:05.690: WARN/NotificationService(47): java.io.IOException: Prepare failed.: status=0xFFFC 09-23 02:05:05.690: WARN/NotificationService(47): at android.media.MediaPlayer.prepare(Native Method) 09-23 02:05:05.690: WARN/NotificationService(47): at android.media.AsyncPlayer$Thread.run(AsyncPlayer.java:76) I am pretty sure the package name is correct because I have the folowing apk in my emulator : -rw-r--r-- system system 263463 2008-09-23 02:04 com.xirgonium.android.apk I just try to load a .wav file. Can anyone help me on this point (code snippet is sufficient :-)) Or how can I be sure the file is in my apk ? Thanks for your help ! --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] App versioning appstore
Hi, I'm looking for information about Android app versioning, in particular with reference with the appstore system. In this very moment I'm planning to develop an app with some static contents (eg. music, background, video and pics), but within a couple of months it will be possible to upgrade these static (incapsulated in app) contents, and now I'm courious to know if I have to work on a self-update system in my app, or can I handle these new versions by appstore upgrade (eg. new versions app updates on iphone app store)? --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] ViewVideo mp4 or 3gp (both local or net) problems
Hi, I was trying to set up my app to play a video. I tried to load it form local and net both, but no way to get it working: I still receive a Cannot play video error. Basically I used the same src that we are able to find in sample dir. Here you are my media.xml ?xml version=1.0 encoding=utf-8? AbsoluteLayout android:id=@+id/media android:layout_width=fill_parent android:layout_height=fill_parent android:background=#00 xmlns:android=http://schemas.android.com/apk/res/android; VideoView android:id=@+id/media_video android:layout_width=fill_parent android:layout_height=240px / Button android:id=@+id/media_home android:layout_width=wrap_content android:layout_height=wrap_content android:background=#00 android:text=Home android:textColor=#FF android:layout_x=10px android:layout_y=410px /Button /AbsoluteLayout And here Media.java package com.app1; import android.app.Activity; import android.net.Uri; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.MediaController; import android.widget.VideoView; public class Media extends Activity { private VideoView video; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.media); Button bottoneHome = (Button) findViewById(R.id.media_home); bottoneHome.setOnClickListener(mHomeListener); video = (VideoView) findViewById(R.id.media_video); video.setVideoURI(Uri.parse(http://www.jsharkey.org/downloads/ dailytest.3gp)); //video.setVideoURI(Uri.parse(android.resource://com.app1/ + R.raw.v)); video.setMediaController(new MediaController(this)); video.requestFocus(); } private OnClickListener mHomeListener = new OnClickListener() { public void onClick(View v) { finish(); } }; } Any idea how to get it working? --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---