[android-developers] Re: Fail to connect to camera service
e.printStackTrace(); } tnnCamera.startPreview(); mPreviewRunning = true; } @Override // When the camera is closed public void surfaceDestroyed(SurfaceHolder holder) { mPreviewRunning = false; tnnCamera.setPreviewCallback(null); tnnCamera.stopPreview(); tnnCamera.release(); } IMPORTANT NOTE/ISSUE: This code works perfectly fine when I launch the BasicOpenARDemoActivity and the condition "if(distancia<0.05 && ar.equals("1"))" is already TRUE (it follows the right procedure which is:condition true-> run intent tnnintent -> go to activity thennnowmode -> call native cam and a surfaceview). The application only crashes if that same condition is FALSE and then turns TRUE by changing the device position. In lay man terms: If I'm already in the position (lat/long) where the intent to call the activity happens (distance <0.05) everything works correctly. If I'm far away (distance>0.05) and approach ... the condition/trigger "if(distancia<0.05 && ar.equals("1"))" turns true and I get the error. I hope I made myself clear, I guess this is as hard to understand as it is to explain. Thank you very much for your time and thanks in advance. Pedro On Dec 4, 3:29 pm, Pedro Teixeira wrote: > Yes that's the only way I know how to do it. I'll try to contact them > and hear what they have to say about it. Thank you > > On Dec 4, 3:20 pm, Mark Murphy wrote: > > > > > On Sun, Dec 4, 2011 at 10:10 AM, Pedro Teixeira > > > wrote: > > > I'm almost sure the problem is as you mentioned that thecamerais > > > already in use. > > > > I'm going from an activity that uses thecamera(wikitudeapplicaiton) > > > to an activity that still uses thecamera(my own). > > > > I'm not sure what are my options here: > > > Am I able to continue without releasing thecameraor do I have to > > > release thecameraand then start again? > > > Unless you want problems (technical or user), activities should > > release theCamerain onPause(), or at the very latest onStop(). If > >Wikitudeis not doing this, andWikitudeis starting your activity, > > then you need to talk to the authors ofWikitude. > > > > Another issue that I'm having is that I can't seem to find any code on > > >wikitudedemonstration example that starts thecameraso I'm not even > > > sure how to stop it. > > > Presumably, they have a support board or email address or something. > > > > Is there any general or standard mode of doing this? I mean.. release > > > thecameraindependently from which activity I'm on at the moment? > > > You can only release cameras that you open. If you open in (onStart() > > or onResume()), you release it (onPause() or onStop()). > > > -- > > Mark Murphy (a Commons > > Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy > > > Android Training...At Your Office:http://commonsware.com/training -- You received this message because you are subscribed to the Google Groups "Android 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] Questions about SDK and SDK update
Hello. I have a probably silly question but programming have never been my strongest area..definitely. I started programming 2 years ago and I was using Google APIs - Android 1.6 I get that the SDK has evolved much more ever since. Can I update the SDK? Is it possible to do it from Eclipe? I also would like to know if it will affect the application I was building under 1.6 and if it will work on an old HTC dev model. Thank you very much for your time and sorry for the beginners question. -- 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] Informations about Dev Phone 1 characteristics (for Wikitude use)
Hi, Is anyone familiar with wikitude? I'm trying to build a simple AR mode activity and I would like to try Wikitude ARchitect since it has the feature I'd like to implement: An overlaid picture instead of an overlaid icon. This are the requirements they say I need: Android 2.2 or higher support for OpenGL ES 2.0 The only mobile I have available from the university is an Android Dev Phone 1. Will this work or is it too much outdated? Thank you -- 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] Fail to connect to camera service
Hi, I have a location based application that depending on the position of the use relating to a certain spot it turns on the camera. In layman terms, when there's proximity to a place it triggers the camera. If I'm already near the sport when it's suppose to trigger ( I've build a proximity algorithm based on user position (lat,long) and the spot position) the camera mode opens just fine trough an intent that calls the activity where the camera access is implemented. But if I'm walking towards the spot and the trigger is set I get an error. This is the logcat: 11-27 20:03:42.451: E/AndroidRuntime(1380): Uncaught handler: thread main exiting due to uncaught exception 11-27 20:03:42.541: E/AndroidRuntime(1380): java.lang.RuntimeException: Fail to connect to camera service 11-27 20:03:42.541: E/AndroidRuntime(1380): at android.hardware.Camera.native_setup(Native Method) 11-27 20:03:42.541: E/AndroidRuntime(1380): at android.hardware.Camera.(Camera.java:85) 11-27 20:03:42.541: E/AndroidRuntime(1380): at android.hardware.Camera.open(Camera.java:67) 11-27 20:03:42.541: E/AndroidRuntime(1380): at com.pedroteixeira.thennnow.thenNnowMode.surfaceCreated(thenNnowMode.java: 229) 11-27 20:03:42.541: E/AndroidRuntime(1380): at android.view.SurfaceView.updateWindow(SurfaceView.java:392) 11-27 20:03:42.541: E/AndroidRuntime(1380): at android.view.SurfaceView.dispatchDraw(SurfaceView.java:264) 11-27 20:03:42.541: E/AndroidRuntime(1380): at android.view.ViewGroup.drawChild(ViewGroup.java:1524) 11-27 20:03:42.541: E/AndroidRuntime(1380): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1256) 11-27 20:03:42.541: E/AndroidRuntime(1380): at android.view.ViewGroup.drawChild(ViewGroup.java:1524) 11-27 20:03:42.541: E/AndroidRuntime(1380): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1256) 11-27 20:03:42.541: E/AndroidRuntime(1380): at android.view.View.draw(View.java:6277) 11-27 20:03:42.541: E/AndroidRuntime(1380): at android.widget.FrameLayout.draw(FrameLayout.java:352) 11-27 20:03:42.541: E/AndroidRuntime(1380): at android.view.ViewGroup.drawChild(ViewGroup.java:1526) 11-27 20:03:42.541: E/AndroidRuntime(1380): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1256) 11-27 20:03:42.541: E/AndroidRuntime(1380): at android.view.View.draw(View.java:6277) 11-27 20:03:42.541: E/AndroidRuntime(1380): at android.widget.FrameLayout.draw(FrameLayout.java:352) 11-27 20:03:42.541: E/AndroidRuntime(1380): at com.android.internal.policy.impl.PhoneWindow $DecorView.draw(PhoneWindow.java:1883) 11-27 20:03:42.541: E/AndroidRuntime(1380): at android.view.ViewRoot.draw(ViewRoot.java:1332) 11-27 20:03:42.541: E/AndroidRuntime(1380): at android.view.ViewRoot.performTraversals(ViewRoot.java:1097) 11-27 20:03:42.541: E/AndroidRuntime(1380): at android.view.ViewRoot.handleMessage(ViewRoot.java:1613) 11-27 20:03:42.541: E/AndroidRuntime(1380): at android.os.Handler.dispatchMessage(Handler.java:99) 11-27 20:03:42.541: E/AndroidRuntime(1380): at android.os.Looper.loop(Looper.java:123) 11-27 20:03:42.541: E/AndroidRuntime(1380): at android.app.ActivityThread.main(ActivityThread.java:4203) 11-27 20:03:42.541: E/AndroidRuntime(1380): at java.lang.reflect.Method.invokeNative(Native Method) 11-27 20:03:42.541: E/AndroidRuntime(1380): at java.lang.reflect.Method.invoke(Method.java:521) 11-27 20:03:42.541: E/AndroidRuntime(1380): at com.android.internal.os.ZygoteInit $MethodAndArgsCaller.run(ZygoteInit.java:791) 11-27 20:03:42.541: E/AndroidRuntime(1380): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549) 11-27 20:03:42.541: E/AndroidRuntime(1380): at dalvik.system.NativeStart.main(Native Method) Does anyone have any idea what can it be? I'm stuck with this issue. Thank you so much in advance. All help and tips are highly appreciated. Pedro -- 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: Informations about Dev Phone 1 characteristics (for Wikitude use)
Thank you ver much for the info Mark. On Nov 20, 1:00 pm, Mark Murphy wrote: > ADP1, IIRC, was the HTC Dream/T-Mobile G1. That does not support > either of your requirements AFAIK. Though you might find a modded ROM > that could offer 2.2. I'm fairly certain the Dream only offered OpenGL > ES 1.1, though, and I'll be surprised if a ROM can fix that. > > On Sun, Nov 20, 2011 at 7:01 AM, Pedro Teixeira > > wrote: > > Hi, > > > Is anyone familiar with wikitude? I'm trying to build a simple AR mode > > activity and I would like to try Wikitude ARchitect since it has the > > feature I'd like to implement: An overlaid picture instead of an > > overlaid icon. > > > This are the requirements they say I need: > > Android 2.2 or higher > > support for OpenGL ES 2.0 > > > The only mobile I have available from the university is an Android Dev > > Phone 1. Will this work or is it too much outdated? > > -- > Mark Murphy (a Commons > Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy > > _The Busy Coder's Guide to Android Development_ Version 3.6 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: Fail to connect to camera service
Yes, actually my application is using the camera when I'm calling another intent. I'll take a look on it and try to stop the camera before starting the new intent. Thank you very much for the input, always helpful. On Nov 28, 12:40 am, Mark Murphy wrote: > One place I have encountered that error is if the Camera is already in > use (by you or another app on the device). > > On Sun, Nov 27, 2011 at 7:33 PM, Pedro Teixeira > > > > > > wrote: > > Hi, > > > I have a location based application that depending on the position of > > the use relating to a certain spot it turns on the camera. In layman > > terms, when there's proximity to a place it triggers the camera. > > > If I'm already near the sport when it's suppose to trigger ( I've > > build a proximity algorithm based on user position (lat,long) and the > > spot position) the camera mode opens just fine trough an intent that > > calls the activity where the camera access is implemented. > > > But if I'm walking towards the spot and the trigger is set I get an > > error. This is the logcat: > > >11-2720:03:42.451:E/AndroidRuntime(1380): Uncaught handler: thread > > main exiting due to uncaught exception > >11-2720:03:42.541:E/AndroidRuntime(1380): > > java.lang.RuntimeException: Fail to connect to camera service > >11-2720:03:42.541:E/AndroidRuntime(1380): at > >android.hardware.Camera.native_setup(NativeMethod) > >11-2720:03:42.541:E/AndroidRuntime(1380): at > > android.hardware.Camera.(Camera.java:85) > >11-2720:03:42.541:E/AndroidRuntime(1380): at > > android.hardware.Camera.open(Camera.java:67) > >11-2720:03:42.541:E/AndroidRuntime(1380): at > > com.pedroteixeira.thennnow.thenNnowMode.surfaceCreated(thenNnowMode.java: > > 229) > >11-2720:03:42.541:E/AndroidRuntime(1380): at > > android.view.SurfaceView.updateWindow(SurfaceView.java:392) > >11-2720:03:42.541:E/AndroidRuntime(1380): at > > android.view.SurfaceView.dispatchDraw(SurfaceView.java:264) > >11-2720:03:42.541:E/AndroidRuntime(1380): at > > android.view.ViewGroup.drawChild(ViewGroup.java:1524) > >11-2720:03:42.541:E/AndroidRuntime(1380): at > > android.view.ViewGroup.dispatchDraw(ViewGroup.java:1256) > >11-2720:03:42.541:E/AndroidRuntime(1380): at > > android.view.ViewGroup.drawChild(ViewGroup.java:1524) > >11-2720:03:42.541:E/AndroidRuntime(1380): at > > android.view.ViewGroup.dispatchDraw(ViewGroup.java:1256) > >11-2720:03:42.541:E/AndroidRuntime(1380): at > > android.view.View.draw(View.java:6277) > >11-2720:03:42.541:E/AndroidRuntime(1380): at > > android.widget.FrameLayout.draw(FrameLayout.java:352) > >11-2720:03:42.541:E/AndroidRuntime(1380): at > > android.view.ViewGroup.drawChild(ViewGroup.java:1526) > >11-2720:03:42.541:E/AndroidRuntime(1380): at > > android.view.ViewGroup.dispatchDraw(ViewGroup.java:1256) > >11-2720:03:42.541:E/AndroidRuntime(1380): at > > android.view.View.draw(View.java:6277) > >11-2720:03:42.541:E/AndroidRuntime(1380): at > > android.widget.FrameLayout.draw(FrameLayout.java:352) > >11-2720:03:42.541:E/AndroidRuntime(1380): at > > com.android.internal.policy.impl.PhoneWindow > > $DecorView.draw(PhoneWindow.java:1883) > >11-2720:03:42.541:E/AndroidRuntime(1380): at > > android.view.ViewRoot.draw(ViewRoot.java:1332) > >11-2720:03:42.541:E/AndroidRuntime(1380): at > > android.view.ViewRoot.performTraversals(ViewRoot.java:1097) > >11-2720:03:42.541:E/AndroidRuntime(1380): at > > android.view.ViewRoot.handleMessage(ViewRoot.java:1613) > >11-2720:03:42.541:E/AndroidRuntime(1380): at > > android.os.Handler.dispatchMessage(Handler.java:99) > >11-2720:03:42.541:E/AndroidRuntime(1380): at > > android.os.Looper.loop(Looper.java:123) > >11-2720:03:42.541:E/AndroidRuntime(1380): at > > android.app.ActivityThread.main(ActivityThread.java:4203) > >11-2720:03:42.541:E/AndroidRuntime(1380): at > > java.lang.reflect.Method.invokeNative(NativeMethod) > >11-2720:03:42.541:E/AndroidRuntime(1380): at > > java.lang.reflect.Method.invoke(Method.java:521) > >11-2720:03:42.541:E/AndroidRuntime(1380): at > > com.android.internal.os.ZygoteInit > > $MethodAndArgsCaller.run(ZygoteInit.java:791) > >11-2720:03:42.541:E/AndroidRuntime(1380): at > > com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549) > >11-2720:03:42.541:E/AndroidRuntime(1380): at > > dalvik.system.NativeStart.main(NativeMethod) > > > Does anyone have any idea what can it be? I'm stuck with
[android-developers] Re: Fail to connect to camera service
HEy again. I'm almost sure the problem is as you mentioned that the camera is already in use. I'm going from an activity that uses the camera (wikitude applicaiton) to an activity that still uses the camera (my own). I'm not sure what are my options here: Am I able to continue without releasing the camera or do I have to release the camera and then start again? Another issue that I'm having is that I can't seem to find any code on wikitude demonstration example that starts the camera so I'm not even sure how to stop it. Is there any general or standard mode of doing this? I mean.. release the camera independently from which activity I'm on at the moment? I would appreciate some insight. Thank you in advance. Pedro On Nov 28, 12:40 am, Mark Murphy wrote: > One place I have encountered that error is if theCamerais already in > use (by you or another app on thedevice). > > On Sun, Nov 27, 2011 at 7:33 PM, Pedro Teixeira > > > > > > wrote: > > Hi, > > > I have a location based application that depending on the position of > > the use relating to a certain spot it turns on thecamera. In layman > > terms, when there's proximity to a place it triggers thecamera. > > > If I'm already near the sport when it's suppose to trigger ( I've > > build a proximity algorithm based on user position (lat,long) and the > > spot position) thecameramode opens just fine trough an intent that > > calls the activity where thecameraaccess is implemented. > > > But if I'm walking towards the spot and the trigger is set I get an > > error. This is the logcat: > > > 11-27 20:03:42.451: E/AndroidRuntime(1380): Uncaught handler: thread > > main exiting due to uncaught exception > > 11-27 20:03:42.541: E/AndroidRuntime(1380): > > java.lang.RuntimeException:Failto connect tocameraservice > > 11-27 20:03:42.541: E/AndroidRuntime(1380): at > > android.hardware.Camera.native_setup(Native Method) > > 11-27 20:03:42.541: E/AndroidRuntime(1380): at > > android.hardware.Camera.(Camera.java:85) > > 11-27 20:03:42.541: E/AndroidRuntime(1380): at > > android.hardware.Camera.open(Camera.java:67) > > 11-27 20:03:42.541: E/AndroidRuntime(1380): at > > com.pedroteixeira.thennnow.thenNnowMode.surfaceCreated(thenNnowMode.java: > > 229) > > 11-27 20:03:42.541: E/AndroidRuntime(1380): at > > android.view.SurfaceView.updateWindow(SurfaceView.java:392) > > 11-27 20:03:42.541: E/AndroidRuntime(1380): at > > android.view.SurfaceView.dispatchDraw(SurfaceView.java:264) > > 11-27 20:03:42.541: E/AndroidRuntime(1380): at > > android.view.ViewGroup.drawChild(ViewGroup.java:1524) > > 11-27 20:03:42.541: E/AndroidRuntime(1380): at > > android.view.ViewGroup.dispatchDraw(ViewGroup.java:1256) > > 11-27 20:03:42.541: E/AndroidRuntime(1380): at > > android.view.ViewGroup.drawChild(ViewGroup.java:1524) > > 11-27 20:03:42.541: E/AndroidRuntime(1380): at > > android.view.ViewGroup.dispatchDraw(ViewGroup.java:1256) > > 11-27 20:03:42.541: E/AndroidRuntime(1380): at > > android.view.View.draw(View.java:6277) > > 11-27 20:03:42.541: E/AndroidRuntime(1380): at > > android.widget.FrameLayout.draw(FrameLayout.java:352) > > 11-27 20:03:42.541: E/AndroidRuntime(1380): at > > android.view.ViewGroup.drawChild(ViewGroup.java:1526) > > 11-27 20:03:42.541: E/AndroidRuntime(1380): at > > android.view.ViewGroup.dispatchDraw(ViewGroup.java:1256) > > 11-27 20:03:42.541: E/AndroidRuntime(1380): at > > android.view.View.draw(View.java:6277) > > 11-27 20:03:42.541: E/AndroidRuntime(1380): at > > android.widget.FrameLayout.draw(FrameLayout.java:352) > > 11-27 20:03:42.541: E/AndroidRuntime(1380): at > > com.android.internal.policy.impl.PhoneWindow > > $DecorView.draw(PhoneWindow.java:1883) > > 11-27 20:03:42.541: E/AndroidRuntime(1380): at > > android.view.ViewRoot.draw(ViewRoot.java:1332) > > 11-27 20:03:42.541: E/AndroidRuntime(1380): at > > android.view.ViewRoot.performTraversals(ViewRoot.java:1097) > > 11-27 20:03:42.541: E/AndroidRuntime(1380): at > > android.view.ViewRoot.handleMessage(ViewRoot.java:1613) > > 11-27 20:03:42.541: E/AndroidRuntime(1380): at > > android.os.Handler.dispatchMessage(Handler.java:99) > > 11-27 20:03:42.541: E/AndroidRuntime(1380): at > > android.os.Looper.loop(Looper.java:123) > > 11-27 20:03:42.541: E/AndroidRuntime(1380): at > > android.app.ActivityThread.main(ActivityThread.java:4203) > > 11-27 20:03:42.541: E/AndroidRuntime(1380): at > > java.lang.reflect.Method.invokeNati
[android-developers] Re: Fail to connect to camera service
Yes that's the only way I know how to do it. I'll try to contact them and hear what they have to say about it. Thank you On Dec 4, 3:20 pm, Mark Murphy wrote: > On Sun, Dec 4, 2011 at 10:10 AM, Pedro Teixeira > > wrote: > > I'm almost sure the problem is as you mentioned that thecamerais > > already in use. > > > I'm going from an activity that uses thecamera(wikitude applicaiton) > > to an activity that still uses thecamera(my own). > > > I'm not sure what are my options here: > > Am I able to continue without releasing thecameraor do I have to > > release thecameraand then start again? > > Unless you want problems (technical or user), activities should > release theCamerain onPause(), or at the very latest onStop(). If > Wikitude is not doing this, and Wikitude is starting your activity, > then you need to talk to the authors of Wikitude. > > > Another issue that I'm having is that I can't seem to find any code on > > wikitude demonstration example that starts thecameraso I'm not even > > sure how to stop it. > > Presumably, they have a support board or email address or something. > > > Is there any general or standard mode of doing this? I mean.. release > > thecameraindependently from which activity I'm on at the moment? > > You can only release cameras that you open. If you open in (onStart() > or onResume()), you release it (onPause() or onStop()). > > -- > Mark Murphy (a Commons > Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy > > Android Training...At Your Office:http://commonsware.com/training -- You received this message because you are subscribed to the Google Groups "Android 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] NullPointerException when trying to write a log into the SDcard
Hello there, hope you can help me somehow. I've got this class example which used to work just fine. Basiclly it just writes to the sd card a log file with some of my device information. public class LogToSD { static PrintWriter outFile = null; private static void initialize() { try { File root = Environment.getExternalStorageDirectory(); if( root.canWrite() ) { Calendar rightNow = Calendar.getInstance(); long day = rightNow.get( Calendar.DAY_OF_YEAR ); long hour = rightNow.get( Calendar.HOUR_OF_DAY ); long minutes = rightNow.get( Calendar.MINUTE ); long seconds = rightNow.get( Calendar.SECOND ); String date = +day + "d_" + hour + "h-" + minutes + "m-" + seconds + "s"; File gpxfile = new File( root, "ThenNnow_" + date + ".log" ); FileWriter gpxwriter = new FileWriter( gpxfile ); outFile = new PrintWriter( gpxwriter ); outFile.write( "\n\n- THEN-N-NOW USER TESTING LOG -\n" ); outFile.write( "- INITIAL TIME (dd_hh-mm-ss): " + date + " -\n\n" ); } } catch (IOException e) { Log.e( "LogToSD", "Could not write to file: " + e.getMessage()); } } public static void write( String text1, String text2 ) { if( outFile == null ) initialize(); Calendar rightNow = Calendar.getInstance(); long minutes = rightNow.get( Calendar.MINUTE ); long seconds = rightNow.get( Calendar.SECOND ); long ms = rightNow.get( Calendar.MILLISECOND ); String time = minutes + ":" + seconds + "." + ms; outFile.write( time + "\t" + text1 + ": " + text2 + "\n" ); outFile.flush(); Log.v( "LogToSD", text1 + " " + text2 ); } public static void shutdown() { if( outFile != null ) outFile.close(); } } In my main activity this method is called like this: if (ar.equals("1")){ LogToSD.write("AR:", "User Location (Latitude:"+ (currentlocation.getLatitude() * 1E6)+", Longitude:"+ (currentlocation.getLongitude() * 1E6)+")"); }else{ LogToSD.write("Normal:", "User Location (Latitude:"+ (currentlocation.getLatitude() * 1E6)+", Longitude:"+ (currentlocation.getLongitude() * 1E6)+")"); } This was working just fine and now I'm getting a NullPointerException which I have no idea where it came from but it points to this lines of code in the main activity which I just pasted before. Can someone please help? 09-17 15:53:03.075: ERROR/AndroidRuntime(921): Uncaught handler: thread main exiting due to uncaught exception 09-17 15:53:03.215: ERROR/AndroidRuntime(921): java.lang.NullPointerException 09-17 15:53:03.215: ERROR/AndroidRuntime(921): at com.pedroteixeira.thennnow.LogToSD.write(LogToSD.java:53) Thank you very much for your help. Pedro -- 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] getting Latitude and Longitude from MyLocationOverlay
Hi there, This is probably linear, but I can't seem to find the answer around. I'm using the class MyLocationOverlay to represent the user on the map. mlo = new MyLocationOverlay(this, mapView) ; mlo.enableCompass(); mlo.enableMyLocation(); mapView.getOverlays().add(mlo); It's working fine.. I'm just wondering, is it possible to take the values of latitude and longitude from the current MyLocationOverlay position? How does it work? I've tried creating a geopoint with getMyLocation() so I could get the lat/long from a location created with the geopoint but it's always null. Ive tried creating a Location with getLastFix() so I could get the lat/ long directly, but not successful either Hope you can help. Thank you very much in advance -- 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] Hi, really need help with Android Camera
Hi there, I have a cameraView class which shows me the Cam View with a button placed on the corner. Once I click that button I'd like to go to another activity which also contains the camera view but some other properties. My code is giving me an undetectable error. I'm not sure what to do. Here is the cameraView class and the thenNnowMode.class which my intent is calling is exactly the same ... but will load a picture in front of the camera view instead of having a button. Anyway, is there something I should do with the cam before moving to another activity that uses cam? public class cameraView extends Activity implements SurfaceHolder.Callback{ SurfaceView mSurfaceView; SurfaceHolder mSurfaceHolder; Camera mCamera; boolean mPreviewRunning=false; private Context mContext = this; ImageView transparencyPreview; Bitmap findPicture; private Button ThenNnowMode; public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.camview); Bundle w = getIntent().getExtras(); findPicture = w.getParcelable("bitmap"); final String picId = w.getString("id"); final String picDate = w.getString("date"); final String picKeywords = w.getString("keywords"); final String picComments = w.getString("comments"); mSurfaceView = (SurfaceView) findViewById(R.id.surface_camera); mSurfaceHolder = mSurfaceView.getHolder(); mSurfaceHolder.addCallback(this); mSurfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); ThenNnowMode = (Button) findViewById(R.id.thennnowmode); ThenNnowMode.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // PUT THE USER IN THE THENNNOW MODE Intent TNNIntent = new Intent(v.getContext(), thenNnowMode.class); Bundle f = new Bundle(); String activityName = "cameraView"; f.putString("activity", activityName); f.putParcelable("bitmap", findPicture); f.putString("id", picId); f.putString("date", picDate); f.putString("keywords", picKeywords); f.putString("comments", picComments); TNNIntent.putExtras(f); startActivity(TNNIntent); //surfaceDestroyed(mSurfaceHolder); finish(); } }); } protected void onRestoreInstanceState(Bundle savedInstanceState){ super.onRestoreInstanceState(savedInstanceState); } protected void onResume(){ super.onResume(); } protected void onSaveInstanceState(Bundle outState){ super.onSaveInstanceState(outState); } protected void onStop(){ super.onStart(); } @Override // Create the Surface and Open the Camera public void surfaceCreated(SurfaceHolder holder) { mCamera = Camera.open(); } @Override // Reacts for camera changes public void surfaceChanged(SurfaceHolder holder, int format, int w,int h) { if (mPreviewRunning) { mCamera.stopPreview(); } Camera.Parameters p = mCamera.getParameters(); p.setPreviewSize(w, h); mCamera.setParameters(p); try { mCamera.setPreviewDisplay(holder); } catch (IOException e) { e.printStackTrace(); } mCamera.startPreview(); mPreviewRunning = true; } @Override // When the camera is closed public void surfaceDestroyed(SurfaceHolder holder) { mCamera.stopPreview(); mPreviewRunning = false; mCamera.release(); } // When the picure is taken. This method gives the byte[] of the
Re: [android-developers] Hi, really need help with Android Camera
Hey there, Thanks for the quick answer. I also considered keeping everything in the same activity, but as you, I'm also a fan of small independent and specific activities. The thing is.. one of this camera activities will work with pictures and my server database, and the other one will work with pictures, gps, compass = AR .. so I really want to keep this separate so at some point the code can be too much overwhelming. Thank you again On Aug 11, 2010, at 3:32 PM, Mark Murphy wrote: On Wed, Aug 11, 2010 at 10:25 AM, Pedro Teixeira wrote: Hi there, I have a cameraView class which shows me the Cam View with a button placed on the corner. Once I click that button I'd like to go to another activity which also contains the camera view but some other properties. My code is giving me an undetectable error. I'm not sure what to do. Here is the cameraView class and the thenNnowMode.class which my intent is calling is exactly the same ... but will load a picture in front of the camera view instead of having a button. Anyway, is there something I should do with the cam before moving to another activity that uses cam? You should really reconsider whether you should be moving to another activity, rather than implementing all camera-related features in the one activity. Normally, I am a fan of lots of small activities, but the Camera does not appear to work well in that pattern, based on other questions posted to this list and elsewhere. If you stick with your current plan, you will need to release the Camera object in the first activity and open it again in the second activity. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android 2.2 Programming 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 Pedro Teixeira www.pedroteixeira.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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Hi, really need help with Android Camera
I've tried stop the cam preview and release it before calling the intent.. it actually goes to the other activity now. but gives an error 1 second after This is the errors on the logcat: 08-11 17:22:06.943: ERROR/MediaPlayer(542): Unable to to create media player 08-11 17:22:06.953: ERROR/CameraService(542): Failed to load CameraService sounds. 08-11 17:22:06.953: ERROR/MediaPlayer(542): Unable to to create media player 08-11 17:22:06.953: ERROR/CameraService(542): Failed to load CameraService sounds. 08-11 17:22:09.593: ERROR/MediaPlayer(542): Unable to to create media player 08-11 17:22:09.593: ERROR/CameraService(542): Failed to load CameraService sounds. 08-11 17:22:09.603: ERROR/MediaPlayer(542): Unable to to create media player 08-11 17:22:09.603: ERROR/CameraService(542): Failed to load CameraService sounds. 08-11 17:23:08.543: ERROR/AndroidRuntime(720): Uncaught handler: thread main exiting due to uncaught exception 08-11 17:23:08.733: ERROR/AndroidRuntime(720): java.lang.RuntimeException: Method called after release() 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.hardware.Camera.stopPreview(Native Method) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at com.pedroteixeira.thennnow.cameraView.surfaceDestroyed(cameraView.java: 130) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.view.SurfaceView.reportSurfaceDestroyed(SurfaceView.java:426) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.view.SurfaceView.updateWindow(SurfaceView.java:351) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.view.SurfaceView.onWindowVisibilityChanged(SurfaceView.java:182) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.view.View.dispatchDetachedFromWindow(View.java:5580) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:1072) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:1072) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:1072) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:1072) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.view.ViewRoot.dispatchDetachedFromWindow(ViewRoot.java:1553) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.view.ViewRoot.die(ViewRoot.java:2510) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.view.WindowManagerImpl.removeViewImmediate (WindowManagerImpl.java:218) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.view.Window$LocalWindowManager.removeViewImmediate(Window.java: 421) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java: 3393) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.app.ActivityThread.access$2700(ActivityThread.java:116) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1826) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.os.Handler.dispatchMessage(Handler.java:99) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.os.Looper.loop(Looper.java:123) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.app.ActivityThread.main(ActivityThread.java:4203) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at java.lang.reflect.Method.invokeNative(Native Method) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at java.lang.reflect.Method.invoke(Method.java:521) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:791) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at dalvik.system.NativeStart.main(Native Method) :S On Aug 11, 2010, at 3:32 PM, Mark Murphy wrote: On Wed, Aug 11, 2010 at 10:25 AM, Pedro Teixeira wrote: Hi there, I have a cameraView class which shows me the Cam View with a button placed on the corner. Once I click that button I'd like to go to another activity which also contains the camera view but some other properties. My code is giving me an undetectable error. I'm not sure what to do. Here is the cameraView class and the thenNnowMode.class which my intent is calling is exactly the same ... but will load a picture in front of the camera view instead of having a button. Anyway, is there something I should do with the cam before moving to another activity that uses cam? You should really reconsider whether you should be moving to another activity, rather than implementing all camera-related features in the one activity. Normally, I am a fan of lots of small
Re: [android-developers] Hi, really need help with Android Camera
I had that already and won't work anyway, here is the code: ThenNnowMode.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { mCamera.stopPreview(); mCamera.release(); Intent TNNIntent = new Intent(v.getContext(), thenNnowMode.class); Bundle f = new Bundle(); String activityName = "cameraView"; f.putString("activity", activityName); f.putParcelable("bitmap", findPicture); f.putString("id", picId); f.putString("date", picDate); f.putString("keywords", picKeywords); f.putString("comments", picComments); TNNIntent.putExtras(f); startActivity(TNNIntent); finish(); } }); On Aug 11, 2010, at 5:32 PM, Mark Murphy wrote: You are getting "Method called after release()" triggered by a call to stopPreview() from your surfaceDestroyed(). Call stopPreview() before release()-ing the Camera. On Wed, Aug 11, 2010 at 12:24 PM, Pedro Teixeira wrote: I've tried stop the cam preview and release it before calling the intent.. it actually goes to the other activity now. but gives an error 1 second after This is the errors on the logcat: 08-11 17:22:06.943: ERROR/MediaPlayer(542): Unable to to create media player 08-11 17:22:06.953: ERROR/CameraService(542): Failed to load CameraService sounds. 08-11 17:22:06.953: ERROR/MediaPlayer(542): Unable to to create media player 08-11 17:22:06.953: ERROR/CameraService(542): Failed to load CameraService sounds. 08-11 17:22:09.593: ERROR/MediaPlayer(542): Unable to to create media player 08-11 17:22:09.593: ERROR/CameraService(542): Failed to load CameraService sounds. 08-11 17:22:09.603: ERROR/MediaPlayer(542): Unable to to create media player 08-11 17:22:09.603: ERROR/CameraService(542): Failed to load CameraService sounds. 08-11 17:23:08.543: ERROR/AndroidRuntime(720): Uncaught handler: thread main exiting due to uncaught exception 08-11 17:23:08.733: ERROR/AndroidRuntime(720): java.lang.RuntimeException: Method called after release() 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.hardware.Camera.stopPreview(Native Method) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at com.pedroteixeira.thennnow.cameraView.surfaceDestroyed (cameraView.java:130) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.view.SurfaceView.reportSurfaceDestroyed(SurfaceView.java:426) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.view.SurfaceView.updateWindow(SurfaceView.java:351) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.view.SurfaceView.onWindowVisibilityChanged(SurfaceView.java: 182) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.view.View.dispatchDetachedFromWindow(View.java:5580) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java: 1072) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java: 1072) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java: 1072) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java: 1072) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.view.ViewRoot.dispatchDetachedFromWindow(ViewRoot.java:1553) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.view.ViewRoot.die(ViewRoot.java:2510) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.view.WindowManagerImpl.removeViewImmediate (WindowManagerImpl.java:218) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.view.Window$LocalWindowManager.removeViewImmediate (Window.java:421) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.app.ActivityThread.handleDestroyActivity (ActivityThread.java:3393) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.app.ActivityThread.access$2700(ActivityThread.java:116) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1826) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.os.Handler.dispatchMessage(Handler.java:99) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.os.Looper.loop(Looper.java:123) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.app.ActivityThread.main(ActivityThread.java:4203) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at java.lang.reflect.Method.invokeNative(Native Method) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at java.lang.reflect.Method.invoke(Method.java:521) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at com.android
Re: [android-developers] Hi, really need help with Android Camera
Just don't know anymore where to do the stopPreviews and releases... just before the Intent onClick ?! That order is not working for me.. On Aug 11, 2010, at 5:32 PM, Mark Murphy wrote: You are getting "Method called after release()" triggered by a call to stopPreview() from your surfaceDestroyed(). Call stopPreview() before release()-ing the Camera. On Wed, Aug 11, 2010 at 12:24 PM, Pedro Teixeira wrote: I've tried stop the cam preview and release it before calling the intent.. it actually goes to the other activity now. but gives an error 1 second after This is the errors on the logcat: 08-11 17:22:06.943: ERROR/MediaPlayer(542): Unable to to create media player 08-11 17:22:06.953: ERROR/CameraService(542): Failed to load CameraService sounds. 08-11 17:22:06.953: ERROR/MediaPlayer(542): Unable to to create media player 08-11 17:22:06.953: ERROR/CameraService(542): Failed to load CameraService sounds. 08-11 17:22:09.593: ERROR/MediaPlayer(542): Unable to to create media player 08-11 17:22:09.593: ERROR/CameraService(542): Failed to load CameraService sounds. 08-11 17:22:09.603: ERROR/MediaPlayer(542): Unable to to create media player 08-11 17:22:09.603: ERROR/CameraService(542): Failed to load CameraService sounds. 08-11 17:23:08.543: ERROR/AndroidRuntime(720): Uncaught handler: thread main exiting due to uncaught exception 08-11 17:23:08.733: ERROR/AndroidRuntime(720): java.lang.RuntimeException: Method called after release() 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.hardware.Camera.stopPreview(Native Method) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at com.pedroteixeira.thennnow.cameraView.surfaceDestroyed (cameraView.java:130) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.view.SurfaceView.reportSurfaceDestroyed(SurfaceView.java:426) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.view.SurfaceView.updateWindow(SurfaceView.java:351) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.view.SurfaceView.onWindowVisibilityChanged(SurfaceView.java: 182) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.view.View.dispatchDetachedFromWindow(View.java:5580) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java: 1072) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java: 1072) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java: 1072) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java: 1072) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.view.ViewRoot.dispatchDetachedFromWindow(ViewRoot.java:1553) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.view.ViewRoot.die(ViewRoot.java:2510) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.view.WindowManagerImpl.removeViewImmediate (WindowManagerImpl.java:218) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.view.Window$LocalWindowManager.removeViewImmediate (Window.java:421) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.app.ActivityThread.handleDestroyActivity (ActivityThread.java:3393) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.app.ActivityThread.access$2700(ActivityThread.java:116) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1826) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.os.Handler.dispatchMessage(Handler.java:99) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.os.Looper.loop(Looper.java:123) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.app.ActivityThread.main(ActivityThread.java:4203) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at java.lang.reflect.Method.invokeNative(Native Method) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at java.lang.reflect.Method.invoke(Method.java:521) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:791) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at dalvik.system.NativeStart.main(Native Method) :S -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android 2.2 Programming 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 opt
Re: [android-developers] Hi, really need help with Android Camera
Hello .. can someone help me with this? I'm really frustrated... I've try releasing the camera and changing the code but im always getting the same error.. 3 days of this.. how annoying :/ PS: the new activity is a cam activity also with the same code.. at least for now code: ThenNnowMode.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { mCamera.stopPreview(); mCamera.release(); Intent TNNIntent = new Intent(mContext, thenNnowMode.class); Bundle f = new Bundle(); String activityName = "cameraView"; f.putString("activity", activityName); f.putParcelable("bitmap", findPicture); f.putString("id", picId); f.putString("date", picDate); f.putString ("keywords", picKeywords); f.putString("comments", picComments); TNNIntent.putExtras(f); startActivity(TNNIntent); finish(); } }); On Aug 11, 2010, at 5:32 PM, Mark Murphy wrote: You are getting "Method called after release()" triggered by a call to stopPreview() from your surfaceDestroyed(). Call stopPreview() before release()-ing the Camera. On Wed, Aug 11, 2010 at 12:24 PM, Pedro Teixeira wrote: I've tried stop the cam preview and release it before calling the intent.. it actually goes to the other activity now. but gives an error 1 second after This is the errors on the logcat: 08-11 17:22:06.943: ERROR/MediaPlayer(542): Unable to to create media player 08-11 17:22:06.953: ERROR/CameraService(542): Failed to load CameraService sounds. 08-11 17:22:06.953: ERROR/MediaPlayer(542): Unable to to create media player 08-11 17:22:06.953: ERROR/CameraService(542): Failed to load CameraService sounds. 08-11 17:22:09.593: ERROR/MediaPlayer(542): Unable to to create media player 08-11 17:22:09.593: ERROR/CameraService(542): Failed to load CameraService sounds. 08-11 17:22:09.603: ERROR/MediaPlayer(542): Unable to to create media player 08-11 17:22:09.603: ERROR/CameraService(542): Failed to load CameraService sounds. 08-11 17:23:08.543: ERROR/AndroidRuntime(720): Uncaught handler: thread main exiting due to uncaught exception 08-11 17:23:08.733: ERROR/AndroidRuntime(720): java.lang.RuntimeException: Method called after release() 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.hardware.Camera.stopPreview(Native Method) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at com.pedroteixeira.thennnow.cameraView.surfaceDestroyed (cameraView.java:130) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.view.SurfaceView.reportSurfaceDestroyed(SurfaceView.java:426) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.view.SurfaceView.updateWindow(SurfaceView.java:351) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.view.SurfaceView.onWindowVisibilityChanged(SurfaceView.java: 182) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.view.View.dispatchDetachedFromWindow(View.java:5580) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java: 1072) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java: 1072) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java: 1072) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java: 1072) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.view.ViewRoot.dispatchDetachedFromWindow(ViewRoot.java:1553) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.view.ViewRoot.die(ViewRoot.java:2510) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.view.WindowManagerImpl.removeViewImmediate (WindowManagerImpl.java:218) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.view.Window$LocalWindowManager.removeViewImmediate (Window.java:421) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.app.ActivityThread.handleDestroyActivity (ActivityThread.java:3393) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.app.ActivityThread.access$2700(ActivityThread.java:116) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1826) 08-11 17:23:08.733: ERROR/AndroidRuntime(720): at android.os.Handler.dispatchMessage(Handler.java:99) 08-11 17:23:08.733: ERROR/AndroidRuntime(72
[android-developers] make automatic login on application
Hi everyone, I'm trying to create a "registration on my application" activity with only the user having to insert his name and email. I want to add this values to my server database. Which is already working fine, The user inserts the name and email and android sends a http request to a php on my server and the php inserts this values in the database. The thing is.. I'd like this to happen only once and by this I mean if the user has registed with that cellphone the device would remember it and just go to another activity but keeping thoose 2 values available to use. Is this possible to do? Maybe my application access the device preferences or something like that.. or should I build besides a register, a login page for the user to login and make the validation on the server side? Anyone has any tutorial on this or someething to get me started? thank you . -- 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: make automatic login on application
thank you very much for the replies, I'll digg up on the SharedPreferences. Sarwar you are right, I want the user to be able to use the application in any device with his email. I would just like him not to perform login every time. Basically like danH mentioned about a browser. Lets say a website like facebook. If u register, login and save password it will recognize the user.. otherwise the user can logout. Anyway thanks for the messages, I'll try to find some code to get me started on the client side. Cheers On Aug 18, 11:14 am, Shashidhar wrote: > When the login is success full store the credentials in local sqlite > database. > Whenever your app starts it should check this local database first and if > there are already no credentials stored then redirect to login page else to > redirect it to your app's home screen. > > Thanks, > Shashidhar > > On Wed, Aug 18, 2010 at 11:12 AM, Sarwar Erfan wrote: > > > > > Hi, > > You can use SharedPreferences as Frank mentioned. > > > In client: > > When your first activity runs (or may be you can override Application > > and put it in the constructor): > > Check in SharedPreferences whether the registration information exists > > or not. > > If exists, then do not send request to server. > > If does not exist, then get name/email (may be through a activity?) > > and send request to your server. > > When response is got from server, save registration information in > > SharedPreferences > > > In server: > > When a request is received, check in database whether the email is > > already registered or not. > > If not registered, then put the record in database. > > If registered, then do not put in database (uninstall-reinstall check) > > > Finally, did you really mean "if the user has registered with that > > cellphone" ? What if the user wants to use the app with same email on > > different devices? > > If you really want to identify in device level (rather than email > > level), then you may want to send and also save in DB the ANDROID_ID > > of the device. > > >http://developer.android.com/reference/android/provider/Settings.Secu... > > > Regards > > Sarwar Erfan > > > On Aug 18, 4:16 am, Frank Weiss wrote: > > > I'd use SharedPreferences for that. You will also need to add a use > > > case for the user uninstalling and then reinstalling the app. In that > > > case, SharedPreferences would be empty, but your server DB would have > > > a record of the prior registration. > > > -- > > 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 > cr...@googlegroups.com> > > For more options, visit this group at > >http://groups.google.com/group/android-developers?hl=en -- 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] store bitmaps
Hello everyone, I could really use some help with this... I have this HTTP code snippet which gives me back a bitmap from the internet. ( I set a preview also ) myFileUrl =null; String URL = http://www.whatever.com/picture.png; try { myFileUrl = new URL(URL); HttpURLConnection conn=(HttpURLConnection)myFileUrl.openConnection(); conn.setDoInput(true); conn.connect(); InputStream is = conn.getInputStream(); picture = BitmapFactory.decodeStream(is); picPreview.setImageBitmap(picture); } catch (IOException e) { } My question is.. I want to send this picture file to my database.. but aparentlly I can't send the bitmap, because it's not a file.. so I have to first convert this bitmap into a file, save it in my SD and then send it as a file. Does anyone know how to save the bitmap into a file in my device? Ideally, the name of the file would be (in my example) picture.png ..or whatever was the name of the file already. After I would like to send the image to the server.. but that's a whole other story... Thanks in advance 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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Submit a Picture to server
Hi everyone... I wouldn't post about this again if I really wasn't frustrated about it.. I've been going through this for a whole week and still I'm not able to do an image upload... My code doesn't report any errors.. but not even the intent is working.. please take a minute to go through it.. it's kinda simple.. like I want it to be.. This is my addPic.class on which I have a ImageView, EditText, a Button to browse the device and a button to add the picture... This is the code for the browse button: deviceBrowse.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent i = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI); startActivityForResult(i, ACTIVITY_SELECT_IMAGE); } }); which calls : protected void onActivityResult(int requestCode, int resultCode, Intent imageReturnedIntent) { super.onActivityResult(requestCode, resultCode, imageReturnedIntent); switch(requestCode) { case ACTIVITY_SELECT_IMAGE: if(resultCode == RESULT_OK){ Uri selectedImage = imageReturnedIntent.getData(); String[] filePathColumn = {MediaStore.Images.Media.DATA}; Cursor cursor = getContentResolver().query(selectedImage, filePathColumn, null, null, null); cursor.moveToFirst(); int columnIndex = cursor.getColumnIndex(filePathColumn[0]); filePath = cursor.getString(columnIndex); cursor.close(); selectedDeviceImage = BitmapFactory.decodeFile(filePath); picPreview.setImageBitmap(selectedDeviceImage); label.setText(filePath); exsistingFileName = filePath; } } } This last piece of code ..put's the path of the file in the label and the bitmap on the Imageview so I can have a preview.. So here is my problematic piece of code: the add button add.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { doFileUpload(); // Go to camera mode Intent addIntent = new Intent(v.getContext(), editPic.class); Bundle w = new Bundle(); String activityName = "addPic"; w.putString("activity", activityName); w.putParcelable("bitmap", selectedDeviceImage); //a.putString("id", picId); addIntent.putExtras(w); startActivity(addIntent); finish(); I'll show you the doFileUpload() in a minute... I just wanted to mention that the intent is not working God knows why.. it doesn't go to the class I specified... private void doFileUpload(){ HttpURLConnection conn = null; DataOutputStream dos = null; DataInputStream inStream = null; exsistingFileName = filePath; // Is this the place are you doing something wrong. String lineEnd = "rn"; String twoHyphens = "--"; String boundary = "*"; int bytesRead, bytesAvailable, bufferSize; byte[] buffer; int maxBufferSize = 1*1024*1024; String responseFromServer = ""; String urlString = "http://www.pedroteixeira.org/thennnow/ UT9.php"; try { Log.e("MediaPlayer","Inside second Method"); FileInputStream fileInputStream = new FileInputStream(new File(exsistingFileName) ); // open a URL connection to the Servlet URL url = new URL(urlString); // Open a HTTP connection to the URL conn = (HttpURLConnection) url.openConnection(); // Allow Inputs conn.setDoInput(true); // Allow Outputs conn.setDoOutput(true); // Don't use a cached copy. conn.setUseCaches(false); // Use a post method. conn.setRequestMethod("POST"); conn.setRequestProperty("Connection", "Keep-Alive"); conn.setRequestProperty("Content-Type", "multipart/form- data;boundary="+boundary); dos = new DataOutputStream( conn.getOutputStream() ); dos.writeBytes(twoHyphens + boundary + lineEnd); dos.writeBytes("Content-Disposition: form-data; name= \"uploadedfile\";filename=\"" + exsistingFileName +"\"" + lineEnd); dos.writeBytes(lineEnd); Log.e("MediaPlayer","Headers are written"); // create a buffer of maximum size bytesAvailable = fileInputStream.available(); bufferSize = Math.min(bytesAvailable, maxBufferSize);
Re: [android-developers] Submit a Picture to server
I'm so embarassed.. can't belive I waisted so much time with this... Well anyway, better now than in one week or more.. thanks a lot Kostya!! Aparentlly the backslashes had been eaten before.. damn! :D thank you On Aug 21, 2010, at 11:24 AM, Kostya Vasilyev wrote: "lineEnd" is defined by your code as "rn". Should be "\r\n" - did the email client eat it, or are you really missing the backslashes in your code? -- Kostya Vasilyev -- http://kmansoft.wordpress.com 21.08.2010 14:07 пользователь "Pedro Teixeira" 0...@gmail.com> написал: Hi everyone... I wouldn't post about this again if I really wasn't frustrated about it.. I've been going through this for a whole week and still I'm not able to do an image upload... My code doesn't report any errors.. but not even the intent is working.. please take a minute to go through it.. it's kinda simple.. like I want it to be.. This is my addPic.class on which I have a ImageView, EditText, a Button to browse the device and a button to add the picture... This is the code for the browse button: deviceBrowse.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent i = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI); startActivityForResult(i, ACTIVITY_SELECT_IMAGE); } }); which calls : protected void onActivityResult(int requestCode, int resultCode, Intent imageReturnedIntent) { super.onActivityResult(requestCode, resultCode, imageReturnedIntent); switch(requestCode) { case ACTIVITY_SELECT_IMAGE: if(resultCode == RESULT_OK){ Uri selectedImage = imageReturnedIntent.getData(); String[] filePathColumn = {MediaStore.Images.Media.DATA}; Cursor cursor = getContentResolver().query(selectedImage, filePathColumn, null, null, null); cursor.moveToFirst(); int columnIndex = cursor.getColumnIndex(filePathColumn[0]); filePath = cursor.getString(columnIndex); cursor.close(); selectedDeviceImage = BitmapFactory.decodeFile(filePath); picPreview.setImageBitmap (selectedDeviceImage); label.setText(filePath); exsistingFileName = filePath; } } } This last piece of code ..put's the path of the file in the label and the bitmap on the Imageview so I can have a preview.. So here is my problematic piece of code: the add button add.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { doFileUpload(); // Go to camera mode Intent addIntent = new Intent (v.getContext(), editPic.class); Bundle w = new Bundle(); String activityName = "addPic"; w.putString("activity", activityName); w.putParcelable("bitmap", selectedDeviceImage); //a.putString("id", picId); addIntent.putExtras(w); startActivity(addIntent); finish(); I'll show you the doFileUpload() in a minute... I just wanted to mention that the intent is not working God knows why.. it doesn't go to the class I specified... private void doFileUpload(){ HttpURLConnection conn = null; DataOutputStream dos = null; DataInputStream inStream = null; exsistingFileName = filePath; // Is this the place are you doing something wrong. String lineEnd = "rn"; String twoHyphens = "--"; String boundary = "*"; int bytesRead, bytesAvailable, bufferSize; byte[] buffer; int maxBufferSize = 1*1024*1024; String responseFromServer = ""; String urlString = "http://www.pedroteixeira.org/thennnow/ UT9.php"; try { Log.e("MediaPlayer","Inside second Method"); FileInputStream fileInputStream = new FileInputStream(new File(exsistingFileName) ); // open a URL connection to the Servlet URL url = new URL(urlString); // Open a HTTP connection to the URL conn = (HttpURLConnection) url.openConnection(); // Allow Inputs conn.setDoInput(true); // Allow Outputs conn.setDoOutput(true); // Don't use a cached copy. conn.setUseCaches(false); // Use a post meth
[android-developers] Intent not opening correct ativity
Hello, I'm having a struggle understanding why my intent is not working.. I basically just copied paste from other examples in my code that work perfectly like this.. here it is: Intent addIntent = new Intent(v.getContext(), thenNnowMode.class); Bundle w = new Bundle(); String activityName = "addPic"; w.putString("activity", activityName); w.putParcelable("bitmap", selectedDeviceImage); //a.putString("id", picId); addIntent.putExtras(w); startActivity(addIntent); finish(); The intent is opening a different class called thenNnow.class instead of thenNnowMode.class.. and I have no idea why this is happening.. any suggestion? I've tried sending the intent to open other activities other than thenNnowMode but it always opens thenNnow.. am I missing some silly syntax mistake? It's so strange.. its the same code PS: Im not sure if it's relevant but the thenNnowMode class uses the device camera -- 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: Intent not opening correct ativity
Hi, No I don't want to start in that manner... the explanation for that String is that I have two distinct classes that have an intent that direct them to thenNnowMode. So in the thenNnowMode class I retrieve the bundle... and check the String activity name just to know which activity made that class start.. meaning, "just to know which activity was previous to the one I'm now" . Well ... I don't know what's the matter then.. the code you gave me .. is what I already have ... this is really confusing.. anyway Thank you On Aug 23, 2010, at 7:40 AM, pablisco wrote: Hi, Can we assume that thenNnowMode is an extension of Activity? Also, I can see you pit the string "addPic" into the bundle. I hope you are not trying to start the activity in this manner. To open an activity, say called AddPic (which must be an activity class) and simply call: startActivity(new Intent(getContext(), AddPic.class)); Also some code from the mentioned classes may help solve your problem. On Aug 22, 11:39 pm, Pedro Teixeira wrote: Hello, I'm having a struggle understanding why my intent is not working.. I basically just copied paste from other examples in my code that work perfectly like this.. here it is: Intent addIntent = new Intent(v.getContext(), thenNnowMode.class); Bundle w = new Bundle(); String activityName = "addPic"; w.putString("activity", activityName); w.putParcelable("bitmap", selectedDeviceImage); // a.putString("id", picId); addIntent.putExtras(w); startActivity(addIntent); finish(); The intent is opening a different class called thenNnow.class instead of thenNnowMode.class.. and I have no idea why this is happening.. any suggestion? I've tried sending the intent to open other activities other than thenNnowMode but it always opens thenNnow.. am I missing some silly syntax mistake? It's so strange.. its the same code PS: Im not sure if it's relevant but the thenNnowMode class uses the device camera -- 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 Pedro Teixeira www.pedroteixeira.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 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: Intent not opening correct ativity
Hi Filip, Yes it's the correct file name.. I'll show a snippet of the code: public class thenNnowMode extends Activity implements SurfaceHolder.Callback{ SurfaceView tnnSurfaceView; SurfaceHolder mSurfaceHolder; Camera tnnCamera; boolean mPreviewRunning = false; private Context mContext = this; ImageView transparencyPreview; Bitmap TNNPicture; TextView blinktext; Animation animation; public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.thennnowmode); Bundle w = getIntent().getExtras(); , so that's how I get my Bundle W ! And this is the way I send it: Intent addIntent = new Intent(v.getContext(), thenNnowMode.class); Bundle w = new Bundle(); String activityName = "addPic"; w.putString("activity", activityName); w.putParcelable("bitmap", selectedDeviceImage); // a.putString("id", picId); addIntent.putExtras(w); startActivity(addIntent); finish (); The thingis.. no matter which class I put here Intent addIntent = new Intent(v.getContext(), thenNnowMode.class); The application always take me to thenNnow.class So I think the problem might be on the class that is creating the intent and not the one receinvg it On Aug 23, 2010, at 9:58 AM, Filip Havlicek wrote: Hi Pedro, are you sure you are using correct class name (shouldn't be an issue if it starts fine, but just to be sure) and that you are bundling the "thenNnowMode" class with your application? I think it might happen that you are not bundling it and then the intent resolver tries to find suitable class to deliver the intent and chooses the "thenNnow" class, which is similar to "thenNnowMode" class (based on their names). Best regards, Filip Havlicek 2010/8/23 Pedro Teixeira Hi, No I don't want to start in that manner... the explanation for that String is that I have two distinct classes that have an intent that direct them to thenNnowMode. So in the thenNnowMode class I retrieve the bundle... and check the String activity name just to know which activity made that class start.. meaning, "just to know which activity was previous to the one I'm now" . Well ... I don't know what's the matter then.. the code you gave me .. is what I already have ... this is really confusing.. anyway Thank you On Aug 23, 2010, at 7:40 AM, pablisco wrote: Hi, Can we assume that thenNnowMode is an extension of Activity? Also, I can see you pit the string "addPic" into the bundle. I hope you are not trying to start the activity in this manner. To open an activity, say called AddPic (which must be an activity class) and simply call: startActivity(new Intent(getContext(), AddPic.class)); Also some code from the mentioned classes may help solve your problem. On Aug 22, 11:39 pm, Pedro Teixeira wrote: Hello, I'm having a struggle understanding why my intent is not working.. I basically just copied paste from other examples in my code that work perfectly like this.. here it is: Intent addIntent = new Intent(v.getContext(), thenNnowMode.class); Bundle w = new Bundle(); String activityName = "addPic"; w.putString("activity", activityName); w.putParcelable("bitmap", selectedDeviceImage); // a.putString("id", picId); addIntent.putExtras(w); startActivity(addIntent); finish (); The intent is opening a different class called thenNnow.class instead of thenNnowMode.class.. and I have no idea why this is happening.. any suggestion? I've tried sending the intent to open other activities other than thenNnowMode but it always opens thenNnow.. am I missing some silly syntax mista
Re: [android-developers] Re: Intent not opening correct ativity
And here is my intent on the debugger showing the correct info: Intent { cmp=com.pedroteixeira.thennnow/.thenNnowMode (has extras) } On Aug 23, 2010, at 7:40 AM, pablisco wrote: Hi, Can we assume that thenNnowMode is an extension of Activity? Also, I can see you pit the string "addPic" into the bundle. I hope you are not trying to start the activity in this manner. To open an activity, say called AddPic (which must be an activity class) and simply call: startActivity(new Intent(getContext(), AddPic.class)); Also some code from the mentioned classes may help solve your problem. On Aug 22, 11:39 pm, Pedro Teixeira wrote: Hello, I'm having a struggle understanding why my intent is not working.. I basically just copied paste from other examples in my code that work perfectly like this.. here it is: Intent addIntent = new Intent(v.getContext(), thenNnowMode.class); Bundle w = new Bundle(); String activityName = "addPic"; w.putString("activity", activityName); w.putParcelable("bitmap", selectedDeviceImage); // a.putString("id", picId); addIntent.putExtras(w); startActivity(addIntent); finish(); The intent is opening a different class called thenNnow.class instead of thenNnowMode.class.. and I have no idea why this is happening.. any suggestion? I've tried sending the intent to open other activities other than thenNnowMode but it always opens thenNnow.. am I missing some silly syntax mistake? It's so strange.. its the same code PS: Im not sure if it's relevant but the thenNnowMode class uses the device camera -- 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 Pedro Teixeira www.pedroteixeira.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 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: Intent not opening correct ativity
I'm sorry, I wasn't explicit, that's true. The intent is inside a dialog box which has just a simple feedback message for the user. And it's supposed to change activity when pressed ok, here is all the code to be more specific: add.setOnClickListener(new View.OnClickListener() { @Override public void onClick(final View v) { if (selectedDeviceImage!=null){ doFileUpload(); // Go to camera mode builder = new AlertDialog.Builder(addPic.this); builder.setCancelable(false) .setPositiveButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { Intent addIntent = new Intent(v.getContext(), thenNnowMode.class); Bundle w = new Bundle(); String activityName = "addPic"; w.putString("activity", activityName); w.putParcelable("bitmap", selectedDeviceImage); addIntent.putExtras(w); startActivity(addIntent); finish(); } }); AlertDialog alert = builder.create(); alert.setTitle("Picture added!"); alert.setIcon(R.drawable.icon_yep); alert.show(); }else{ builder = new AlertDialog.Builder(addPic.this); builder.setCancelable(false) .setPositiveButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); AlertDialog alert = builder.create(); alert.setTitle("Please, pick a picture!"); alert.setIcon(R.drawable.icon_not); alert.show(); }} }); On Aug 23, 2010, at 11:57 AM, Filip Havlicek wrote: Hi Pedro, although I don't know what v in v.getContext() is, I would suggest that instead of doing the class setting in constructor, try using new Intent() and then set the class with Intent.setComponent (ComponentName) http://developer.android.com/reference/android/content/Intent.html#setComponent(android.content.ComponentName) and see if it makes any difference. Best regards, Filip Havlicek 2010/8/23 Pedro Teixeira And here is my intent on the debugger showing the correct info: Intent { cmp=com.pedroteixeira.thennnow/.thenNnowMode (has extras) } On Aug 23, 2010, at 7:40 AM, pablisco wrote: Hi, Can we assume that thenNnowMode is an extension of Activity? Also, I can see you pit the string "addPic" into the bundle. I hope you are not trying to start the activity in this manner. To open an activity, say called AddPic (which must be an activity class) and simply call: startActivity(new Intent(getContext(), AddPic.class)); Also some code from the mentioned classes may help solve your problem. On Aug 22, 11:39 pm, Pedro Teixeira wrote: Hello, I'm having a struggle understanding why my intent is not working.. I basically just copied paste from other examples in my code that work perfectly like this.. here it is: Intent addIntent = new Intent(v.getContext(), thenNnowMode.class); Bundle w = new Bundle(); String activityName = "addPic"; w.putString("activity", activityName); w.putParcelable("bitmap", selectedDeviceImage); // a.putString("id", picId); addIntent.putExtras(w); startActivity(addIntent); finish(); The intent is opening a different class called thenNnow.class instead of thenNnowMode.class.. and I have no idea why this is happening.. any suggestion? I've tried sending the intent to open other activities other than thenNnowMode but it always opens thenNnow.. am I missing some silly syntax mistake? It's so strange.. its the same code PS: Im not sure if it's relevant but the thenNnowMode class uses the device camera -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email
Re: [android-developers] Re: Intent not opening correct ativity
If I place just the intent as I have in the onCreate method it works fine. It goes and get the activity I'm calling. On Aug 23, 2010, at 12:43 PM, Filip Havlicek wrote: OK, did a quick look at it and seems fine. Another suggestion - try to build the Intent the way you are right now, but comment everything in your main activity's onCreate method and put just the Intent build & code you have. Does it still call wrong activity? Best regards, Filip Havlicek 2010/8/23 Pedro Teixeira I'm sorry, I wasn't explicit, that's true. The intent is inside a dialog box which has just a simple feedback message for the user. And it's supposed to change activity when pressed ok, here is all the code to be more specific: add.setOnClickListener(new View.OnClickListener() { @Override public void onClick(final View v) { if (selectedDeviceImage!=null){ doFileUpload(); // Go to camera mode builder = new AlertDialog.Builder(addPic.this); builder.setCancelable(false) .setPositiveButton("Ok", new DialogInterface.OnClickListener () { public void onClick(DialogInterface dialog, int id) { Intent addIntent = new Intent(v.getContext(), thenNnowMode.class); Bundle w = new Bundle(); String activityName = "addPic"; w.putString("activity", activityName); w.putParcelable("bitmap", selectedDeviceImage); addIntent.putExtras(w); startActivity(addIntent); finish(); } }); AlertDialog alert = builder.create(); alert.setTitle("Picture added!"); alert.setIcon(R.drawable.icon_yep); alert.show(); }else{ builder = new AlertDialog.Builder(addPic.this); builder.setCancelable(false) .setPositiveButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); AlertDialog alert = builder.create(); alert.setTitle("Please, pick a picture!"); alert.setIcon(R.drawable.icon_not); alert.show(); }} }); On Aug 23, 2010, at 11:57 AM, Filip Havlicek wrote: Hi Pedro, although I don't know what v in v.getContext() is, I would suggest that instead of doing the class setting in constructor, try using new Intent() and then set the class with Intent.setComponent (ComponentName) http://developer.android.com/reference/android/content/Intent.html#setComponent(android.content.ComponentName) and see if it makes any difference. Best regards, Filip Havlicek 2010/8/23 Pedro Teixeira And here is my intent on the debugger showing the correct info: Intent { cmp=com.pedroteixeira.thennnow/.thenNnowMode (has extras) } On Aug 23, 2010, at 7:40 AM, pablisco wrote: Hi, Can we assume that thenNnowMode is an extension of Activity? Also, I can see you pit the string "addPic" into the bundle. I hope you are not trying to start the activity in this manner. To open an activity, say called AddPic (which must be an activity class) and simply call: startActivity(new Intent(getContext(), AddPic.class)); Also some code from the mentioned classes may help solve your problem. On Aug 22, 11:39 pm, Pedro Teixeira wrote: Hello, I'm having a struggle understanding why my intent is not working.. I basically just copied paste from other examples in my code that work perfectly like this.. here it is: Intent addIntent = new Intent(v.getContext(), thenNnowMode.class); Bundle w = new Bundle(); String activityName = "addPic"; w.putString("activity", activityName); w.putParcelable("bitmap", selectedDeviceImage); // a.putString("id", picId); addIntent.putExtras(w); startActivity(addIntent); finish(); The intent is opening a different class called thenNnow.class instead of thenNnowMode.clas
Re: [android-developers] Re: Intent not opening correct ativity
hey, I've changed to getApplicationContext() .. but still doesn't work.. Everything inside that ''onclick()'' method is working besides this intent.. I really can't understand why this is happening and I'm getting so frustrated.. wow.. sorry for being taken your time with this. The function doFileUpload() works fine and puts a device picture into my server.. the intent is just the command after it and doesnt work. I think probably is something about the context since if I make the intent out of the listener it works.. oh god.. I kinda don't know what more to try On Aug 23, 2010, at 1:43 PM, Filip Havlicek wrote: Hi, I think something is wrong with the context you are passing to the Intent in the onClick method. Try to put getApplicationContext instead of v.getContext() and see if that works. Best regards, Filip Havlicek 2010/8/23 Pedro Teixeira If I place just the intent as I have in the onCreate method it works fine. It goes and get the activity I'm calling. On Aug 23, 2010, at 12:43 PM, Filip Havlicek wrote: OK, did a quick look at it and seems fine. Another suggestion - try to build the Intent the way you are right now, but comment everything in your main activity's onCreate method and put just the Intent build & code you have. Does it still call wrong activity? Best regards, Filip Havlicek 2010/8/23 Pedro Teixeira I'm sorry, I wasn't explicit, that's true. The intent is inside a dialog box which has just a simple feedback message for the user. And it's supposed to change activity when pressed ok, here is all the code to be more specific: add.setOnClickListener(new View.OnClickListener() { @Override public void onClick(final View v) { if (selectedDeviceImage!=null){ doFileUpload(); // Go to camera mode builder = new AlertDialog.Builder(addPic.this); builder.setCancelable(false) .setPositiveButton("Ok", new DialogInterface.OnClickListener () { public void onClick(DialogInterface dialog, int id) { Intent addIntent = new Intent(v.getContext(), thenNnowMode.class); Bundle w = new Bundle(); String activityName = "addPic"; w.putString("activity", activityName); w.putParcelable("bitmap", selectedDeviceImage); addIntent.putExtras(w); startActivity(addIntent); finish(); } }); AlertDialog alert = builder.create(); alert.setTitle("Picture added!"); alert.setIcon(R.drawable.icon_yep); alert.show(); }else{ builder = new AlertDialog.Builder(addPic.this); builder.setCancelable(false) .setPositiveButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); AlertDialog alert = builder.create(); alert.setTitle("Please, pick a picture!"); alert.setIcon(R.drawable.icon_not); alert.show(); }} }); On Aug 23, 2010, at 11:57 AM, Filip Havlicek wrote: Hi Pedro, although I don't know what v in v.getContext() is, I would suggest that instead of doing the class setting in constructor, try using new Intent() and then set the class with Intent.setComponent (ComponentName) http://developer.android.com/reference/android/content/Intent.html#setComponent(android.content.ComponentName) and see if it makes any difference. Best regards, Filip Havlicek 2010/8/23 Pedro Teixeira And here is my intent on the debugger showing the correct info: Intent { cmp=com.pedroteixeira.thennnow/.thenNnowMode (has extras) } On Aug 23, 2010, at 7:40 AM, pablisco wrote: Hi, Can we assume that thenNnowMode is an extension of Activity? Also, I can see you pit the string "addPic" into the bundle. I hope you are not trying to start the activity in this manner. To open an activity, say called AddPic (which must be an activity class) and simply call: startActivity(new Intent(getContext(), AddPic.class)); Also some code from the mentioned classes may help solve your problem. On Aug 22, 11:39 pm, Pedro Teixeira wrote: Hello, I'm having a struggle understanding why my intent is not working.. I basically just copied paste from other examples in my code that work perfectly like this.
Re: [android-developers] Re: Intent not opening correct ativity
I get this message on the logcat: 08-23 13:57:35.947: INFO/ActivityManager(76): Process com.android.camera (pid 2030) has died. Do you think is related? Since my activity which Im trying to open (thenNnowMode) uses the camera? On Aug 23, 2010, at 1:43 PM, Filip Havlicek wrote: Hi, I think something is wrong with the context you are passing to the Intent in the onClick method. Try to put getApplicationContext instead of v.getContext() and see if that works. Best regards, Filip Havlicek 2010/8/23 Pedro Teixeira If I place just the intent as I have in the onCreate method it works fine. It goes and get the activity I'm calling. On Aug 23, 2010, at 12:43 PM, Filip Havlicek wrote: OK, did a quick look at it and seems fine. Another suggestion - try to build the Intent the way you are right now, but comment everything in your main activity's onCreate method and put just the Intent build & code you have. Does it still call wrong activity? Best regards, Filip Havlicek 2010/8/23 Pedro Teixeira I'm sorry, I wasn't explicit, that's true. The intent is inside a dialog box which has just a simple feedback message for the user. And it's supposed to change activity when pressed ok, here is all the code to be more specific: add.setOnClickListener(new View.OnClickListener() { @Override public void onClick(final View v) { if (selectedDeviceImage!=null){ doFileUpload(); // Go to camera mode builder = new AlertDialog.Builder(addPic.this); builder.setCancelable(false) .setPositiveButton("Ok", new DialogInterface.OnClickListener () { public void onClick(DialogInterface dialog, int id) { Intent addIntent = new Intent(v.getContext(), thenNnowMode.class); Bundle w = new Bundle(); String activityName = "addPic"; w.putString("activity", activityName); w.putParcelable("bitmap", selectedDeviceImage); addIntent.putExtras(w); startActivity(addIntent); finish(); } }); AlertDialog alert = builder.create(); alert.setTitle("Picture added!"); alert.setIcon(R.drawable.icon_yep); alert.show(); }else{ builder = new AlertDialog.Builder(addPic.this); builder.setCancelable(false) .setPositiveButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); AlertDialog alert = builder.create(); alert.setTitle("Please, pick a picture!"); alert.setIcon(R.drawable.icon_not); alert.show(); }} }); On Aug 23, 2010, at 11:57 AM, Filip Havlicek wrote: Hi Pedro, although I don't know what v in v.getContext() is, I would suggest that instead of doing the class setting in constructor, try using new Intent() and then set the class with Intent.setComponent (ComponentName) http://developer.android.com/reference/android/content/Intent.html#setComponent(android.content.ComponentName) and see if it makes any difference. Best regards, Filip Havlicek 2010/8/23 Pedro Teixeira And here is my intent on the debugger showing the correct info: Intent { cmp=com.pedroteixeira.thennnow/.thenNnowMode (has extras) } On Aug 23, 2010, at 7:40 AM, pablisco wrote: Hi, Can we assume that thenNnowMode is an extension of Activity? Also, I can see you pit the string "addPic" into the bundle. I hope you are not trying to start the activity in this manner. To open an activity, say called AddPic (which must be an activity class) and simply call: startActivity(new Intent(getContext(), AddPic.class)); Also some code from the mentioned classes may help solve your problem. On Aug 22, 11:39 pm, Pedro Teixeira wrote: Hello, I'm having a struggle understanding why my intent is not working.. I basically just copied paste from other examples in my code that work perfectly like this.. here it is: Intent addIntent = new Intent(v.getContext(), thenNnowMode.class); Bundle w = new Bundle(); String activityName = "addPic"; w.putString(&quo
Re: [android-developers] Re: Intent not opening correct ativity
Oh god that's it It's the bitmap!! something bad coded... damn I just commented this line: w.putParcelable("bitmap", selectedDeviceImage); and it's working! Anyway it's strange that I don't get any kind of warning to this errors.. Well I'll take it from here. Thank you very much for your time. Such a big help. greetings :D On Aug 23, 2010, at 2:07 PM, Filip Havlicek wrote: Yes, it very well might be related. I tried your code with some editing (removed the if, changed the activity names and removed the doFileUpload() and w.putParcelable () ) and it worked fine for me. Best regards, Filip Havlicek 2010/8/23 Pedro Teixeira I get this message on the logcat: 08-23 13:57:35.947: INFO/ActivityManager(76): Process com.android.camera (pid 2030) has died. Do you think is related? Since my activity which Im trying to open (thenNnowMode) uses the camera? On Aug 23, 2010, at 1:43 PM, Filip Havlicek wrote: Hi, I think something is wrong with the context you are passing to the Intent in the onClick method. Try to put getApplicationContext instead of v.getContext() and see if that works. Best regards, Filip Havlicek 2010/8/23 Pedro Teixeira If I place just the intent as I have in the onCreate method it works fine. It goes and get the activity I'm calling. On Aug 23, 2010, at 12:43 PM, Filip Havlicek wrote: OK, did a quick look at it and seems fine. Another suggestion - try to build the Intent the way you are right now, but comment everything in your main activity's onCreate method and put just the Intent build & code you have. Does it still call wrong activity? Best regards, Filip Havlicek 2010/8/23 Pedro Teixeira I'm sorry, I wasn't explicit, that's true. The intent is inside a dialog box which has just a simple feedback message for the user. And it's supposed to change activity when pressed ok, here is all the code to be more specific: add.setOnClickListener(new View.OnClickListener() { @Override public void onClick(final View v) { if (selectedDeviceImage!=null){ doFileUpload(); // Go to camera mode builder = new AlertDialog.Builder(addPic.this); builder.setCancelable(false) .setPositiveButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { Intent addIntent = new Intent(v.getContext(), thenNnowMode.class); Bundle w = new Bundle(); String activityName = "addPic"; w.putString("activity", activityName); w.putParcelable("bitmap", selectedDeviceImage); addIntent.putExtras(w); startActivity(addIntent); finish(); } }); AlertDialog alert = builder.create(); alert.setTitle("Picture added!"); alert.setIcon(R.drawable.icon_yep); alert.show(); }else{ builder = new AlertDialog.Builder(addPic.this); builder.setCancelable(false) .setPositiveButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); AlertDialog alert = builder.create(); alert.setTitle("Please, pick a picture!"); alert.setIcon(R.drawable.icon_not); alert.show(); }} }); On Aug 23, 2010, at 11:57 AM, Filip Havlicek wrote: Hi Pedro, although I don't know what v in v.getContext() is, I would suggest that instead of doing the class setting in constructor, try using new Intent() and then set the class with Intent.setComponent(ComponentName) http://developer.android.com/reference/android/content/Intent.html#setComponent(android.content.ComponentName) and see if it makes any difference. Best regards, Filip Havlicek 2010/8/23 Pedro Teixeira And here is my intent on the debugger showing the correct info: Intent { cmp=com.pedroteixeira.thennnow/.thenNnowMode (has extras) } On Aug 23, 2010, at 7:40 AM, pablisco wrote: Hi, Can we assume that thenNnowMode is an extension of Activity? Also, I can see you pit the string "addPic" into the bundle. I hope you are not trying to start the activity in this manner. To open an activity, say called AddPic (which must be an activity class) and simply call: startActivity(new Intent(getContext(), AddPic.class)); Also some code from the men
Re: [android-developers] Re: Intent not opening correct ativity
I figured it was the bitmap that i was passing with parceable that was giving this error.. now its going correctly to the activity I pretend although I cant find a solution to send the bitmap. is there a way to retrive a bitmap from an imageview? On Aug 23, 2010, at 2:32 PM, Kostya Vasilyev wrote: I noticed that your code for the upload case doesn't close the dialog, like the code for the picking case does. Perhaps you could try that. Also, try getting the context using Java notation for the enclosing activity class (blah.this), although I think it's the same as v.getContext. What might be happening is your code crashing and Android restarting next-to-last known activity. You could also use an activity in place of a dialog, using startActivityForResult. -- Kostya Vasilyev -- http://kmansoft.wordpress.com 23.08.2010 15:25 пользователь "Pedro Teixeira" > написал: I'm sorry, I wasn't explicit, that's true. The intent is inside a dialog box which has just a simple feedback message for the user. And it's supposed to change activity when pressed ok, here is all the code to be more specific: add.setOnClickListener(new View.OnClickListener() { @Override public void onClick(final View v) { if (selectedDeviceImage!=null){ doFileUpload(); // Go to camera mode builder = new AlertDialog.Builder(addPic.this); builder.setCancelable(false) .setPositiveButton("Ok", new DialogInterface.OnClickListener () { public void onClick(DialogInterface dialog, int id) { Intent addIntent = new Intent(v.getContext(), thenNnowMode.class); Bundle w = new Bu... addIntent.putExtras(w); startActivity(addIntent); finish(); } }); AlertDialog alert = builder.create(); alert.setTitle("Picture added!"); alert.setIcon(R.drawable.icon_yep); alert.show(); }else{ builder = new AlertDialog.Builder(addPic.this); builder.setCancelable(false) .setPositiveButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); AlertDialog alert = builder.create(); alert.setTitle("Please, pick a picture!"); alert.setIcon(R.drawable.icon_not); alert.show(); }} }); On Aug 23, 2010, at 11:57 AM, Filip Havlicek wrote: > Hi Pedro, > > although I don't know what v ... -- You received this message because you are subscribed to the Google Groups "Android Developers" g... -- 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 Pedro Teixeira www.pedroteixeira.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 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: Intent not opening correct ativity
Im not sure how to pass a drawable.. so the issue was the bitmap i was trying to send w.putParcelable("bitmap", selectedDeviceImage); , now I have to find another way to send this lol it actually has a value so I'm not getting why the error.. but anyway.. I'll try other ways to send a bitmap, or convert it to byte something like that. On Aug 23, 2010, at 4:45 PM, Filip Havlicek wrote: Hi Pedro, glad I could help. Dunno about the bitmap from imageview, Drawable isn't enough? Best regards, Filip Havlicek 2010/8/23 Pedro Teixeira I figured it was the bitmap that i was passing with parceable that was giving this error.. now its going correctly to the activity I pretend although I cant find a solution to send the bitmap. is there a way to retrive a bitmap from an imageview? On Aug 23, 2010, at 2:32 PM, Kostya Vasilyev wrote: I noticed that your code for the upload case doesn't close the dialog, like the code for the picking case does. Perhaps you could try that. Also, try getting the context using Java notation for the enclosing activity class (blah.this), although I think it's the same as v.getContext. What might be happening is your code crashing and Android restarting next-to-last known activity. You could also use an activity in place of a dialog, using startActivityForResult. -- Kostya Vasilyev -- http://kmansoft.wordpress.com 23.08.2010 15:25 пользователь "Pedro Teixeira" > написал: I'm sorry, I wasn't explicit, that's true. The intent is inside a dialog box which has just a simple feedback message for the user. And it's supposed to change activity when pressed ok, here is all the code to be more specific: add.setOnClickListener(new View.OnClickListener() { @Override public void onClick(final View v) { if (selectedDeviceImage!=null){ doFileUpload(); // Go to camera mode builder = new AlertDialog.Builder(addPic.this); builder.setCancelable(false) .setPositiveButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { Intent addIntent = new Intent(v.getContext(), thenNnowMode.class); Bundle w = new Bu... addIntent.putExtras(w); startActivity(addIntent); finish(); } }); AlertDialog alert = builder.create(); alert.setTitle("Picture added!"); alert.setIcon(R.drawable.icon_yep); alert.show(); }else{ builder = new AlertDialog.Builder(addPic.this); builder.setCancelable(false) .setPositiveButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); AlertDialog alert = builder.create(); alert.setTitle("Please, pick a picture!"); alert.setIcon(R.drawable.icon_not); alert.show(); }} }); On Aug 23, 2010, at 11:57 AM, Filip Havlicek wrote: > Hi Pedro, > > although I don't know what v ... -- You received this message because you are subscribed to the Google Groups "Android Developers" g... -- 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 Pedro Teixeira www.pedroteixeira.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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- 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 Pedro Teixeira www.pedroteixeira.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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] decodeFile to bitmap problem
Hi... I have an activity that passes a bundle to another one with a path for a bitmap... In the activity that receives the bundle I do it like this: Bundle w = getIntent().getExtras(); if (w!=null){ String activityName = w.getString("activity"); TNNPicturePath = w.getString("path"); TNNPicture = BitmapFactory.decodeFile(TNNPicturePath); //set bitmap on imageview transparencyPreview = (ImageView) findViewById(R.id.picture); transparencyPreview.setImageBitmap(TNNPicture); transparencyPreview.setAlpha(100); } TNNPicturePath actually receives the path String which is (saw it on debugger): /sdcard/DCIM/Camera/2010-02-12 03.01.13.jpg so I guess everything is alright right? The thing is.. I'm getting an error decoding the file... this line to be more precise: TNNPicture = BitmapFactory.decodeFile(TNNPicturePath); any suggestions what can be wrong? I have the path..I have the bitmap to store.. I dont understand whats wrong. -- 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] decodeFile to bitmap problem
HI Filip, I'll try to see the system response.. Today nothing is working... I've passed so many bitmaps through the parceable extra in the bundle.. this one is not working.. it was the thing that was messing up with the bundles... So I removed it and I decided to pass just the picture path.. and now there's an error.. God! Such a simple thing and I'm a whole day on this... On Aug 23, 2010, at 8:17 PM, Filip Havlicek wrote: Hi Pedro, we meet again! I'm pretty sure we need the stack trace of your error from DDMS to help you with this. Best regards, Filip Havlicek 2010/8/23 Pedro Teixeira Hi... I have an activity that passes a bundle to another one with a path for a bitmap... In the activity that receives the bundle I do it like this: Bundle w = getIntent().getExtras(); if (w!=null){ String activityName = w.getString ("activity"); TNNPicturePath = w.getString("path"); TNNPicture = BitmapFactory.decodeFile (TNNPicturePath); //set bitmap on imageview transparencyPreview = (ImageView) findViewById(R.id.picture); transparencyPreview.setImageBitmap (TNNPicture); transparencyPreview.setAlpha(100); } TNNPicturePath actually receives the path String which is (saw it on debugger): /sdcard/DCIM/Camera/2010-02-12 03.01.13.jpg so I guess everything is alright right? The thing is.. I'm getting an error decoding the file... this line to be more precise: TNNPicture = BitmapFactory.decodeFile (TNNPicturePath); any suggestions what can be wrong? I have the path..I have the bitmap to store.. I dont understand whats wrong. -- 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 -- 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 Pedro Teixeira www.pedroteixeira.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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] decodeFile to bitmap problem
Ok.. I think I traced this Path problem... If I do: BitmapFactory.decodeFile(TNNPicturePath); where TNNPicturePath is a path from a picture stored in the device it works... if TNNPicture is a path from a picture taken and stored from the camera.. it doesn't work.. so I'm guessing.. decodeFile just works for a certain location on the device? Does this make any sense? I wanted to retrieve both from camera taken and downloaded pics On Aug 23, 2010, at 8:17 PM, Filip Havlicek wrote: Hi Pedro, we meet again! I'm pretty sure we need the stack trace of your error from DDMS to help you with this. Best regards, Filip Havlicek 2010/8/23 Pedro Teixeira Hi... I have an activity that passes a bundle to another one with a path for a bitmap... In the activity that receives the bundle I do it like this: Bundle w = getIntent().getExtras(); if (w!=null){ String activityName = w.getString ("activity"); TNNPicturePath = w.getString("path"); TNNPicture = BitmapFactory.decodeFile (TNNPicturePath); //set bitmap on imageview transparencyPreview = (ImageView) findViewById(R.id.picture); transparencyPreview.setImageBitmap (TNNPicture); transparencyPreview.setAlpha(100); } TNNPicturePath actually receives the path String which is (saw it on debugger): /sdcard/DCIM/Camera/2010-02-12 03.01.13.jpg so I guess everything is alright right? The thing is.. I'm getting an error decoding the file... this line to be more precise: TNNPicture = BitmapFactory.decodeFile (TNNPicturePath); any suggestions what can be wrong? I have the path..I have the bitmap to store.. I dont understand whats wrong. -- 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 -- 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 Pedro Teixeira www.pedroteixeira.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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] decodeFile to bitmap problem
Yes the camera is set on the Manifest. It's official... I downloaded a picture from the internet and the path to that picture works fine. If I use any other path of a pic taken from the camera it doesn't On Aug 23, 2010, at 8:49 PM, Filip Havlicek wrote: Hi Pedro, what pemissions do you have in your manifest? Do you have CAMERA permission? http://developer.android.com/reference/android/Manifest.permission.html#CAMERA Best regards, Filip Havlicek 2010/8/23 Pedro Teixeira Ok.. I think I traced this Path problem... If I do: BitmapFactory.decodeFile(TNNPicturePath); where TNNPicturePath is a path from a picture stored in the device it works... if TNNPicture is a path from a picture taken and stored from the camera.. it doesn't work.. so I'm guessing.. decodeFile just works for a certain location on the device? Does this make any sense? I wanted to retrieve both from camera taken and downloaded pics On Aug 23, 2010, at 8:17 PM, Filip Havlicek wrote: Hi Pedro, we meet again! I'm pretty sure we need the stack trace of your error from DDMS to help you with this. Best regards, Filip Havlicek 2010/8/23 Pedro Teixeira Hi... I have an activity that passes a bundle to another one with a path for a bitmap... In the activity that receives the bundle I do it like this: Bundle w = getIntent().getExtras(); if (w!=null){ String activityName = w.getString ("activity"); TNNPicturePath = w.getString("path"); TNNPicture = BitmapFactory.decodeFile (TNNPicturePath); //set bitmap on imageview transparencyPreview = (ImageView) findViewById(R.id.picture); transparencyPreview.setImageBitmap (TNNPicture); transparencyPreview.setAlpha(100); } TNNPicturePath actually receives the path String which is (saw it on debugger): /sdcard/DCIM/Camera/2010-02-12 03.01.13.jpg so I guess everything is alright right? The thing is.. I'm getting an error decoding the file... this line to be more precise: TNNPicture = BitmapFactory.decodeFile (TNNPicturePath); any suggestions what can be wrong? I have the path..I have the bitmap to store.. I dont understand whats wrong. -- 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 -- 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 Pedro Teixeira www.pedroteixeira.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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- 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 Pedro Teixeira www.pedroteixeira.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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] onClick for the whole screen?
Hi, My question is a little bit silly but.. I know how to set a listener for.. let's say a button or a editext so that when clicked some action happens: buttonOReditextl.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Action goes here } }); My question is... how can I set a onClick event for when the user taps/ clicks on the screen? or the surface.. I'm not sure? I want a picture to be taken when the camera is on.. but don't know how to make a listener to all the camera view instead of having a button to take a picture. Thank you -- 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: onClick for the whole screen?
I have a CameraPicture.Callback and the onClick method implemented like this: public void onClick(View arg0) { tnnCamera.takePicture(null, mPictureCallback, mPictureCallback); } So does it makes any sense? Sorry.. I just have no ideia where to start this.. On Aug 24, 2010, at 4:21 PM, nikhil wrote: your class should implement Gesture Listener and then override onClickEvent On Aug 24, 9:56 am, Pedro Teixeira wrote: Hi, My question is a little bit silly but.. I know how to set a listener for.. let's say a button or a editext so that when clicked some action happens: buttonOReditextl.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Action goes here } }); My question is... how can I set a onClick event for when the user taps/ clicks on the screen? or the surface.. I'm not sure? I want a picture to be taken when the camera is on.. but don't know how to make a listener to all the camera view instead of having a button to take a picture. Thank you -- 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 Pedro Teixeira www.pedroteixeira.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 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: onClick for the whole screen?
Hello, I actually used a tutorial on the camera around... I think they use the approach u mentioned about using the surfaceholder inside a view public void onClick(View arg0) { tnnCamera.takePicture(null, mPictureCallback, mPictureCallback); } Camera.PictureCallback mPictureCallback = new Camera.PictureCallback () { public void onPictureTaken(byte[] imageData, Camera c) { if (imageData != null) { Intent mIntent = new Intent(); // salva a foto previewAndStoreInfo(mContext, imageData, 50, "fotoTirada"); tnnCamera.startPreview(); setResult(FOTO_MODE, mIntent); finish(); } } }; And that previewAndStoreInfo just saves the picture in the device SD for now... supossely.. because here I'm not even able to take the picture.. I can't find where On Aug 24, 2010, at 9:08 PM, Filip Havlicek wrote: Hi Pedro, one possible way is to do it with gestures as nikhil suggested, although there might be some other ways. Do you happen to display the camera preview on the screen when you want the tapping to happen? If so, I suppose you have it inside some SurfaceHolder. Now I'm not sure, but I think SurfaceHolder doesn't have onClick or similar method, but on the other hand I'm sure you can put the SurfaceHolder inside some View that supports the onClick method. Then just override it to take a picture. Best regards, Filip Havlicek 2010/8/24 Pedro Teixeira I have a CameraPicture.Callback and the onClick method implemented like this: public void onClick(View arg0) { tnnCamera.takePicture(null, mPictureCallback, mPictureCallback); } So does it makes any sense? Sorry.. I just have no ideia where to start this.. On Aug 24, 2010, at 4:21 PM, nikhil wrote: your class should implement Gesture Listener and then override onClickEvent On Aug 24, 9:56 am, Pedro Teixeira wrote: Hi, My question is a little bit silly but.. I know how to set a listener for.. let's say a button or a editext so that when clicked some action happens: buttonOReditextl.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Action goes here } }); My question is... how can I set a onClick event for when the user taps/ clicks on the screen? or the surface.. I'm not sure? I want a picture to be taken when the camera is on.. but don't know how to make a listener to all the camera view instead of having a button to take a picture. Thank you -- 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 Pedro Teixeira www.pedroteixeira.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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- 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 Pedro Teixeira www.pedroteixeira.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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Taking a Picture
I have my code all set and done.. no errors at all..everything looks fine.. how/where/why doesnt takes a picture? Can anyone help me with this? this is a internet tutorial custumized for needs.. public class thenNnowMode extends Activity implements SurfaceHolder.Callback{ SurfaceView tnnSurfaceView; SurfaceHolder mSurfaceHolder; Camera tnnCamera; boolean mPreviewRunning = false; private Context mContext = this; ImageView transparencyPreview; Bitmap TNNPicture; String TNNPicturePath; TextView blinktext; Animation animation; static final int FOTO_MODE = 0; public void onCreate(Bundle icicle) { super.onCreate(icicle); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.thennnowmode); tnnSurfaceView = (SurfaceView) findViewById(R.id.surface_camera); mSurfaceHolder = tnnSurfaceView.getHolder(); mSurfaceHolder.addCallback(this); mSurfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); } protected void onRestoreInstanceState(Bundle savedInstanceState){ super.onRestoreInstanceState(savedInstanceState); } protected void onResume(){ super.onResume(); } protected void onSaveInstanceState(Bundle outState){ super.onSaveInstanceState(outState); } protected void onStop(){ super.onStart(); } @Override // Create the Surface and Open the Camera public void surfaceCreated(SurfaceHolder holder) { tnnCamera = Camera.open(); } @Override // Reacts for camera changes public void surfaceChanged(SurfaceHolder holder, int format, int w,int h) { if (mPreviewRunning) { tnnCamera.stopPreview(); } Camera.Parameters p = tnnCamera.getParameters(); p.setPreviewSize(w, h); tnnCamera.setParameters(p); try { tnnCamera.setPreviewDisplay(holder); } catch (IOException e) { e.printStackTrace(); } tnnCamera.startPreview(); mPreviewRunning = true; } @Override // When the camera is closed public void surfaceDestroyed(SurfaceHolder holder) { tnnCamera.stopPreview(); mPreviewRunning = false; tnnCamera.release(); } // Metodo on click of the screen takes a picture public void onClick(View arg0) { tnnCamera.takePicture(null, mPictureCallback, mPictureCallback); } // When the picure is taken. This method gives the byte[] of the picture Camera.PictureCallback mPictureCallback = new Camera.PictureCallback() { public void onPictureTaken(byte[] imageData, Camera c) { if (imageData != null) { Intent mIntent = new Intent(); // salva a foto previewAndStoreInfo(mContext, imageData, 50, "fotoTirada"); tnnCamera.startPreview(); setResult(FOTO_MODE, mIntent); finish(); } } }; public static boolean previewAndStoreInfo(Context mContext, byte[] imageData,int quality, String expName) { File sdImageMainDirectory = new File("/sdcard"); FileOutputStream fileOutputStream = null; String nameFile; try { BitmapFactory.Options options=new BitmapFactory.Options(); options.inSampleSize = 5; Bitmap myImage = BitmapFactory.decodeByteArray(imageData, 0, imageData.length,options); fileOutputStream = new FileOutputStream(sdImageMainDirectory.toString() +"/" + expName + ".jpg"); BufferedOutputStream bos = new BufferedOutputStream(fileOutputStream); myImage.compress(CompressFormat.JPEG, quality, bos); bos.flush(); bos.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return true; } } -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-dev
Re: [android-developers] Taking a Picture
Does anybody has a clue? no one had implemented a camera on surfaceview and take a picture? On Aug 25, 2010, at 10:35 PM, Pedro Teixeira wrote: I have my code all set and done.. no errors at all..everything looks fine.. how/where/why doesnt takes a picture? Can anyone help me with this? this is a internet tutorial custumized for needs.. public class thenNnowMode extends Activity implements SurfaceHolder.Callback{ SurfaceView tnnSurfaceView; SurfaceHolder mSurfaceHolder; Camera tnnCamera; boolean mPreviewRunning = false; private Context mContext = this; ImageView transparencyPreview; Bitmap TNNPicture; String TNNPicturePath; TextView blinktext; Animation animation; static final int FOTO_MODE = 0; public void onCreate(Bundle icicle) { super.onCreate(icicle); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.thennnowmode); tnnSurfaceView = (SurfaceView) findViewById(R.id.surface_camera); mSurfaceHolder = tnnSurfaceView.getHolder(); mSurfaceHolder.addCallback(this); mSurfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); } protected void onRestoreInstanceState(Bundle savedInstanceState){ super.onRestoreInstanceState(savedInstanceState); } protected void onResume(){ super.onResume(); } protected void onSaveInstanceState(Bundle outState){ super.onSaveInstanceState(outState); } protected void onStop(){ super.onStart(); } @Override // Create the Surface and Open the Camera public void surfaceCreated(SurfaceHolder holder) { tnnCamera = Camera.open(); } @Override // Reacts for camera changes public void surfaceChanged(SurfaceHolder holder, int format, int w,int h) { if (mPreviewRunning) { tnnCamera.stopPreview(); } Camera.Parameters p = tnnCamera.getParameters(); p.setPreviewSize(w, h); tnnCamera.setParameters(p); try { tnnCamera.setPreviewDisplay(holder); } catch (IOException e) { e.printStackTrace(); } tnnCamera.startPreview(); mPreviewRunning = true; } @Override // When the camera is closed public void surfaceDestroyed(SurfaceHolder holder) { tnnCamera.stopPreview(); mPreviewRunning = false; tnnCamera.release(); } // Metodo on click of the screen takes a picture public void onClick(View arg0) { tnnCamera.takePicture(null, mPictureCallback, mPictureCallback); } // When the picure is taken. This method gives the byte[] of the picture Camera.PictureCallback mPictureCallback = new Camera.PictureCallback() { public void onPictureTaken(byte[] imageData, Camera c) { if (imageData != null) { Intent mIntent = new Intent(); // salva a foto previewAndStoreInfo(mContext, imageData, 50, "fotoTirada"); tnnCamera.startPreview(); setResult(FOTO_MODE, mIntent); finish(); } } }; public static boolean previewAndStoreInfo(Context mContext, byte[] imageData,int quality, String expName) { File sdImageMainDirectory = new File("/sdcard"); FileOutputStream fileOutputStream = null; String nameFile; try { BitmapFactory.Options options=new BitmapFactory.Options(); options.inSampleSize = 5; Bitmap myImage = BitmapFactory.decodeByteArray(imageData, 0, imageData.length,options); fileOutputStream = new FileOutputStream(sdImageMainDirectory.toString() +"/" + expName + ".jpg"); BufferedOutputStream bos = new BufferedOutputStream(fileOutputStream); myImage.compress(CompressFormat.JPEG, quality, bos); bos.flush(); bos.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); }
Re: [android-developers] Taking a Picture
The thing is.. in my XML code for the camera preview I have an Image with some transparency overlaid on the entire screen also. So I think that migh be the reason why a syrface click doesn't execute anything.. Do u know how can I go through this without having to take the picture out? Can I make the ImageView be the trigger for a picture to be taken? I mean.. I need the function to take a picture when I touch a screen no matter whats there or when I touch the picture which is the object in the front. the camera is behind the picture, layer-speaking any idea ? On Aug 26, 2010, at 12:36 PM, Mark Murphy wrote: On Thu, Aug 26, 2010 at 4:04 AM, Pedro Teixeira wrote: Does anybody has a clue? no one had implemented a camera on surfaceview and take a picture? http://github.com/commonsguy/cw-advandroid/tree/master/Camera/Picture/ -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 3.1 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 Pedro Teixeira www.pedroteixeira.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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Taking a Picture
I don't get it... i used my code.. I used that entire code just exactlly as the one you showed... but my device just doesn't react to any touch. I tried to debug it.. and there's no reaction to anything On Aug 26, 2010, at 12:36 PM, Mark Murphy wrote: On Thu, Aug 26, 2010 at 4:04 AM, Pedro Teixeira wrote: Does anybody has a clue? no one had implemented a camera on surfaceview and take a picture? http://github.com/commonsguy/cw-advandroid/tree/master/Camera/Picture/ -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 3.1 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 Pedro Teixeira www.pedroteixeira.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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Taking a Picture
Can anyone help? I just have the camera working.. and nothing more.. my device doesnt react to anything, touch, click.. whatever On Aug 26, 2010, at 12:36 PM, Mark Murphy wrote: On Thu, Aug 26, 2010 at 4:04 AM, Pedro Teixeira wrote: Does anybody has a clue? no one had implemented a camera on surfaceview and take a picture? http://github.com/commonsguy/cw-advandroid/tree/master/Camera/Picture/ -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 3.1 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 Pedro Teixeira www.pedroteixeira.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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Taking a Picture
This tapping on screen to take a picture is revealing itself a big pain... I've tried rearranging the code according to my needs. I implemented the class TappableSurfaceView with out success... I'm wondering.. is a SurfaceView still tappable even if we have something overlaying it? Let's say a picture, or a piece of text? Does that work ? Maybe I'm loosing my time with an impossible thing.. On Aug 27, 2010, at 12:28 AM, Mark Murphy wrote: On Thu, Aug 26, 2010 at 5:50 PM, Pedro Teixeira wrote: Can anyone help? I just have the camera working.. and nothing more.. my device doesnt react to anything, touch, click.. whatever Here is yet another sample project, showing a SurfaceView used for video playback, that responds to touch events: http://github.com/commonsguy/vidtry -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 3.1 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 Pedro Teixeira www.pedroteixeira.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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Help with simple Bitmap issue
Hi there... I'm having an issue with a Bitmap which is giving me an error but any kind of report so I can understand it.. The code is simpley this this: - I get a image path from a bundle: Bundle w = getIntent().getExtras(); final String thenPicPath= w.getString("oldpicpath"); - And I set it on a ImageView called returnpic: Bitmap oldPicture = BitmapFactory.decodeFile(thenPicPath); returnpic.setImageBitmap(oldPicture); In the debugger the String thenPicPath reads : /sdcard/download/ 7122gato.jpg And the oldPicture Bitmap reads: android.graphics.bit...@437700c0 Everything looks fine but I get and error when setting the imagebitmap.. any clue? -- 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] Help with simple Bitmap issue
Any clue about this? anyone? On Aug 31, 2010, at 4:26 PM, Pedro Teixeira wrote: Hi there... I'm having an issue with a Bitmap which is giving me an error but any kind of report so I can understand it.. The code is simpley this this: - I get a image path from a bundle: Bundle w = getIntent().getExtras(); final String thenPicPath= w.getString("oldpicpath"); - And I set it on a ImageView called returnpic: Bitmap oldPicture = BitmapFactory.decodeFile(thenPicPath); returnpic.setImageBitmap(oldPicture); In the debugger the String thenPicPath reads : /sdcard/download/ 7122gato.jpg And the oldPicture Bitmap reads: android.graphics.bit...@437700c0 Everything looks fine but I get and error when setting the imagebitmap.. any clue? -- 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 Pedro Teixeira www.pedroteixeira.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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Help with simple Bitmap issue
The same old error... NullPoinerException which is strange considering I have the correct values on the variables when I run them on the debugger.. any suggestion? On Aug 31, 2010, at 4:26 PM, Pedro Teixeira wrote: Hi there... I'm having an issue with a Bitmap which is giving me an error but any kind of report so I can understand it.. The code is simpley this this: - I get a image path from a bundle: Bundle w = getIntent().getExtras(); final String thenPicPath= w.getString("oldpicpath"); - And I set it on a ImageView called returnpic: Bitmap oldPicture = BitmapFactory.decodeFile(thenPicPath); returnpic.setImageBitmap(oldPicture); In the debugger the String thenPicPath reads : /sdcard/download/ 7122gato.jpg And the oldPicture Bitmap reads: android.graphics.bit...@437700c0 Everything looks fine but I get and error when setting the imagebitmap.. any clue? -- 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 Pedro Teixeira www.pedroteixeira.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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Help with simple Bitmap issue
Can someone help me with this? I'm really having a hard time to understand why this error is happening... my code is simple as: File imageFile = new File(thenPicPath); if(imageFile.exists()){ Bitmap myBitmap = BitmapFactory.decodeFile(thenPicPath); ImageView returnpic = (ImageView) findViewById (R.id.addinfopic); returnpic.setImageBitmap(myBitmap); }else{ Context context = getApplicationContext(); CharSequence text = "nao existe essa foto!"; int duration = Toast.LENGTH_SHORT; Toast toast = Toast.makeText(context, text, duration); toast.show(); } When I get to the "returnpic.setImageBitmap(myBitmap);" part it crashes and gives this error on the logcat: (PS: the variable thenPicPath is ok being sdcard/downloads/something.jpg) 09-01 15:29:03.357: ERROR/AndroidRuntime(5057): Uncaught handler: thread main exiting due to uncaught exception 09-01 15:29:03.367: ERROR/AndroidRuntime(5057): java.lang.RuntimeException: Unable to start activity ComponentInfo {com.pedroteixeira.thennnow/com.pedroteixeira.thennnow.addPicInfo}: java.lang.NullPointerException 09-01 15:29:03.367: ERROR/AndroidRuntime(5057): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java: 2401) 09-01 15:29:03.367: ERROR/AndroidRuntime(5057): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java: 2417) 09-01 15:29:03.367: ERROR/AndroidRuntime(5057): at android.app.ActivityThread.access$2100(ActivityThread.java:116) 09-01 15:29:03.367: ERROR/AndroidRuntime(5057): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794) 09-01 15:29:03.367: ERROR/AndroidRuntime(5057): at android.os.Handler.dispatchMessage(Handler.java:99) 09-01 15:29:03.367: ERROR/AndroidRuntime(5057): at android.os.Looper.loop(Looper.java:123) 09-01 15:29:03.367: ERROR/AndroidRuntime(5057): at android.app.ActivityThread.main(ActivityThread.java:4203) 09-01 15:29:03.367: ERROR/AndroidRuntime(5057): at java.lang.reflect.Method.invokeNative(Native Method) 09-01 15:29:03.367: ERROR/AndroidRuntime(5057): at java.lang.reflect.Method.invoke(Method.java:521) 09-01 15:29:03.367: ERROR/AndroidRuntime(5057): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:791) 09-01 15:29:03.367: ERROR/AndroidRuntime(5057): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549) 09-01 15:29:03.367: ERROR/AndroidRuntime(5057): at dalvik.system.NativeStart.main(Native Method) 09-01 15:29:03.367: ERROR/AndroidRuntime(5057): Caused by: java.lang.NullPointerException 09-01 15:29:03.367: ERROR/AndroidRuntime(5057): at com.pedroteixeira.thennnow.addPicInfo.onCreate(addPicInfo.java:99) 09-01 15:29:03.367: ERROR/AndroidRuntime(5057): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java: 1123) 09-01 15:29:03.367: ERROR/AndroidRuntime(5057): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java: 2364) 09-01 15:29:03.367: ERROR/AndroidRuntime(5057): ... 11 more On Aug 31, 2010, at 4:26 PM, Pedro Teixeira wrote: Hi there... I'm having an issue with a Bitmap which is giving me an error but any kind of report so I can understand it.. The code is simpley this this: - I get a image path from a bundle: Bundle w = getIntent().getExtras(); final String thenPicPath= w.getString("oldpicpath"); - And I set it on a ImageView called returnpic: Bitmap oldPicture = BitmapFactory.decodeFile(thenPicPath); returnpic.setImageBitmap(oldPicture); In the debugger the String thenPicPath reads : /sdcard/download/ 7122gato.jpg And the oldPicture Bitmap reads: android.graphics.bit...@437700c0 Everything looks fine but I get and error when setting the imagebitmap.. any clue? -- 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 Pedro Teixeira www.pedroteixeira.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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Split Path to get filename and extension
hi there.. I have a file path to the SD card on a String.. like this : /sdcard/ download/recentPic.jpg And I'd like to get just the filename and extension recentPic.jpg Is there any simple way to do this ? Thank you -- 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: Split Path to get filename and extension
And how is that done? I found examples in javascript using the lastindexof ...but cant find anything for android java.. On Sep 3, 2010, at 6:52 PM, Filip Havlicek wrote: Just select extension as string from . to the end and filename as string from last / to last . Best regards, Filip Havlicek 2010/9/3 Maps.Huge.Info (Maps API Guru) Have you looked at File? -John Coryat -- 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 -- 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 Pedro Teixeira www.pedroteixeira.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 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: Split Path to get filename and extension
Obviously not for me lol.. I'm sorry, I'm just a little bit newbie in this and its giving me a headache just to get a simple name and extension from the path On Sep 3, 2010, at 9:15 PM, Kumar Bibek wrote: Use the file class. It's pretty straight forward. -Kumar Bibek http://techdroid.kbeanie.com On Sep 4, 12:02 am, Jeremy Wadsack wrote: This is basic java. It's not Android specific. String filename = "something.ext"; String extension = null; int lastDotPosition = filename.lastIndexOf('.'); if( lastDotPosition > 0 ) { extension = filename.substring(lastDotPosition + 1); } -- Jeremy Wadsack On Fri, Sep 3, 2010 at 11:57 AM, Pedro Teixeira wrote: And how is that done? I found examples in javascript using the lastindexof ...but cant find anything for android java.. On Sep 3, 2010, at 6:52 PM, Filip Havlicek wrote: Just select extension as string from . to the end and filename as string from last / to last . Best regards, Filip Havlicek 2010/9/3 Maps.Huge.Info (Maps API Guru) Have you looked at File? -John Coryat -- 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%2bunsubscr...@googlegroups.com> For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- 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 Pedro Teixeira www.pedroteixeira.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 android-developers+unsubscr...@googlegroups.com%2bunsubscr...@googlegroups.com> For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- 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 Pedro Teixeira www.pedroteixeira.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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Taking a Picture
Hi again.. still struggling with this... My code seems fine.. can you see what's wrong with this scene? public static boolean previewAndStoreInfo(Context mContext, byte[] imageData,int quality, String expName) { File sdImageMainDirectory = new File("/sdcard/download/" + expName); FileOutputStream fileOutputStream = null; try { BitmapFactory.Options options=new BitmapFactory.Options(); options.inSampleSize = 5; Bitmap myImage = BitmapFactory.decodeByteArray(imageData, 0, imageData.length,options); fileOutputStream = new FileOutputStream (sdImageMainDirectory.toString()); BufferedOutputStream bos = new BufferedOutputStream (fileOutputStream); myImage.compress(CompressFormat.JPEG, quality, bos); bos.flush(); bos.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return true; } I can't see the picture in the gallery, it's seems like its not saving the picture in the sdcard/download folder.. On Aug 29, 2010, at 9:50 AM, Mark Murphy wrote: On Fri, Aug 27, 2010 at 12:52 PM, Pedro Teixeira wrote: I'm wondering.. is a SurfaceView still tappable even if we have something overlaying it? Let's say a picture, or a piece of text? Does that work ? set THING="picture, or a piece of text" If you tap on the $THING, the touch event goes to the $THING. If the $THING does not handle the touch event, it will go to the activity. The touch event will not go to widgets behind the $THING. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _The Busy Coder's Guide to *Advanced* Android Development_ Version 1.9 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 Pedro Teixeira www.pedroteixeira.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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Picking two pictures at once
Hi, this snippet of code allows me to pick a picture and choose from a list of options to send them.. I'm wondering if it'spossible to pick 2 pictures instead of just one? Is it possible? thnk you Uri U = Uri.fromFile(F); Intent i = new Intent(Intent.ACTION_SEND); i.setType("image/jpg"); i.putExtra(Intent.EXTRA_STREAM, U); startActivity(Intent.createChooser(i,"Send Picture using:")); -- 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] Little help with view
Hi there, I have a class which is called cameraView and inside I have another which is called compassLook...goes like this: public class compassLook extends View { private float direction = 0; etc etc I use the compassLook view in my cameraView layout... I'm able to make this work fine in separate activities ..but the thing is I'd like to change the value ''direction'' with values generated in Cameraview.class so I've placed the class compassLook inside the cameraView class... The thing is I don't know how to work this out in XML anymore... This is how it used to be when it worked fine and when I used separate classes: How can I access that view now? Is there any specific syntax for this cases in the XML ? -- 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] Little help with view
didn't work :/ On Sep 10, 2010, at 9:51 PM, Mark Murphy wrote: Try "com.pedroteixeira.thennnow.Cameraview$compassLook". On Fri, Sep 10, 2010 at 4:47 PM, Pedro Teixeira wrote: Hi there, I have a class which is called cameraView and inside I have another which is called compassLook...goes like this: public class compassLook extends View { private float direction = 0; etc etc I use the compassLook view in my cameraView layout... I'm able to make this work fine in separate activities ..but the thing is I'd like to change the value ''direction'' with values generated in Cameraview.class so I've placed the class compassLook inside the cameraView class... The thing is I don't know how to work this out in XML anymore... This is how it used to be when it worked fine and when I used separate classes: How can I access that view now? Is there any specific syntax for this cases in the XML ? -- 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 -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android Training in London: http://skillsmatter.com/go/os-mobile- server -- 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 Pedro Teixeira www.pedroteixeira.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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Little help with view
It's strange because even in the android documentation says the syntax is class$innerclass but it's giving me an Inflate Exception: 09-10 22:31:34.206: ERROR/AndroidRuntime(1776): java.lang.RuntimeException: Unable to start activity ComponentInfo {com.pedroteixeira.thennnow/com.pedroteixeira.thennnow.cameraView}: android.view.InflateException: Binary XML file line #40: Error inflating class com.pedroteixeira.thennnow.cameraView$compassLook On Sep 10, 2010, at 10:27 PM, Kostya Vasilyev wrote: Perhaps you can try creating a non-nested class that extends the nested one. Just a stub, so you can reference it by name in the XML file. Not sure if the Java compiler actually allows this, but it should only take a few minutes to try out... -- Kostya Vasilyev -- http://kmansoft.wordpress.com 11.09.2010 1:21 пользователь "Pedro Teixeira" > написал: didn't work :/ On Sep 10, 2010, at 9:51 PM, Mark Murphy wrote: > Try "com.pedroteixeira.thennnow.Cameraview$com... Pedro Teixeira www.pedroteixeira.org -- You received this message because you are subscribed to the Google Groups "Android Developers" group... -- 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 Pedro Teixeira www.pedroteixeira.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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Little help with view
Ok I got it :D The class wasn't static... lol It is the syntax Mark metioned. Thank you very much :D On Sep 10, 2010, at 10:35 PM, Kostya Vasilyev wrote: Oops, scratch that. Just realized it's not going to work. Non-static inner classes can only be instantiated from within the outer class - this is because they have a hidden reference to an instance of the outer class. That's what makes them so convenient. A layoutInflater will not have access to the instance of the outer class, and even if it dud -- Kostya Vasilyev -- http://kmansoft.wordpress.com 11.09.2010 1:21 пользователь "Pedro Teixeira" > написал: didn't work :/ On Sep 10, 2010, at 9:51 PM, Mark Murphy wrote: > Try "com.pedroteixeira.thennnow.Cameraview$com... Pedro Teixeira www.pedroteixeira.org -- You received this message because you are subscribed to the Google Groups "Android Developers" group... -- 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 Pedro Teixeira www.pedroteixeira.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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Getting compass values and use it on map overlay
Hi there, I have a marker on the map using an Overlay.. I also have access to the compass sensor which I'm able to show a textView with the orientation values ( 0 to 359 ) .. how can I apply this values to the marker? (which is a drawable) I already have a MAtrix created but when I insert the orientation value gives me an error, here it is: GeoPoint geopoint = new GeoPoint((int) (newLocation.getLatitude() * 1E6), (int) (newLocation.getLongitude() * 1E6)); Paint paint = new Paint(); Point pt = new Point(); mapView.getProjection().toPixels(geopoint, pt); Bitmap bmp = BitmapFactory.decodeResource(getResources(),R.drawable.user2); Matrix matrix = new Matrix(); matrix.postTranslate(-25, -25); matrix.postRotate(direction); matrix.postTranslate(pt.x, pt.y); paint.setAntiAlias(true); paint.setFilterBitmap(true); int width = bmp.getWidth(); int height = bmp.getHeight(); Bitmap changedBitmap = Bitmap.createBitmap(bmp, 0, 0, width, height, matrix, true); BitmapDrawable icon = new BitmapDrawable(changedBitmap); icon.setBounds(0, 0, icon.getIntrinsicWidth(), icon.getIntrinsicHeight()); userOverlay useroverlay = new userOverlay(icon); useroverlay.addItem(item); mapView.getOverlays().add(useroverlay); I used the value retrieved from the sensor on ''direction'' but it doesn't work.. anyway to work this around? -- 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] Getting compass values and use it on map overlay
Basiclly.. I want to do the same as in Maps application for android... When the user moves the device, a marker on the map follows the movement in relation to the map ( I'm guessing the north ) On Sep 13, 2010, at 10:03 PM, TreKing wrote: On Mon, Sep 13, 2010 at 3:30 PM, Pedro Teixeira > wrote: I already have a MAtrix created but when I insert the orientation value gives me an error Which is what, exactly? I used the value retrieved from the sensor on ''direction'' but it doesn't work.. What is "direction"? What does "it doesn't work" mean? anyway to work this around? Do it correctly =P - TreKing - Chicago transit tracking app for Android-powered devices -- 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 Pedro Teixeira www.pedroteixeira.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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Getting compass values and use it on map overlay
Never mind, I found the value I had to use is azimuth. Thank you anyway On Sep 13, 2010, at 10:03 PM, TreKing wrote: On Mon, Sep 13, 2010 at 3:30 PM, Pedro Teixeira > wrote: I already have a MAtrix created but when I insert the orientation value gives me an error Which is what, exactly? I used the value retrieved from the sensor on ''direction'' but it doesn't work.. What is "direction"? What does "it doesn't work" mean? anyway to work this around? Do it correctly =P - TreKing - Chicago transit tracking app for Android-powered devices -- 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 Pedro Teixeira www.pedroteixeira.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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] duplicated entries?!
The strangest thing is happening in my application. I have a map overlay for various pictures, and another overlay for a drawing representing the user.. They all are at a certain position. The thing is, all information is appearing duplicated some pixeis down and some pixeis to the right. I have no ideia why is this happening since the information is used just once. Is there anyway to be sure about if all the elements have been removed before starting this ones..? The strange thing is that they are not even on the correct point ( lat, long ) they are all suffering a deviation down and right. do you have any clue on this? thank you -- 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] duplicated entries?!
Actually not sure.. I just removed the shadow... here is the class: public class userOverlay extends ItemizedOverlay { private List items; private Drawable marker; public userOverlay(Drawable defaultMarker) { super(defaultMarker); items = new ArrayList(); marker = defaultMarker; } @Override protected OverlayItem createItem(int index) { return (OverlayItem)items.get(index); } @Override public int size() { return items.size(); } @Override public void draw(Canvas canvas, MapView mapView, boolean shadow) { super.draw(canvas, mapView, false); boundCenter(marker); } public void addItem(OverlayItem item) { items.add(item); populate(); } } And this is how I use it on my code: protected void createAndShowUserOverlay(Location newLocation, float orientation) { List useroverlays = mapView.getOverlays(); // first remove old overlay if (useroverlays.size() > 0) { for (Iterator iterator = useroverlays.iterator(); iterator.hasNext ();) { iterator.next(); iterator.remove(); } } // transform the location to a geoPoint GeoPoint geopoint = new GeoPoint((int) (newLocation.getLatitude() * 1E6), (int) (newLocation.getLongitude() * 1E6)); Paint paint = new Paint(); Point pt = new Point(); mapView.getProjection().toPixels(geopoint, pt); Bitmap bmp = BitmapFactory.decodeResource(getResources (),R.drawable.user2); Matrix matrix = new Matrix(); matrix.postTranslate(-25, -25); matrix.postRotate(orientation); matrix.postTranslate(pt.x, pt.y); paint.setAntiAlias(true); paint.setFilterBitmap(true); int width = bmp.getWidth(); int height = bmp.getHeight(); Bitmap changedBitmap = Bitmap.createBitmap(bmp, 0, 0, width, height, matrix, true); BitmapDrawable icon = new BitmapDrawable(changedBitmap); icon.setBounds(0, 0, icon.getIntrinsicWidth(), icon.getIntrinsicHeight()); userOverlay useroverlay = new userOverlay(icon); OverlayItem item = new OverlayItem(geopoint, "I'm here", null); useroverlay.addItem(item); mapView.getOverlays().add(useroverlay); mapView.postInvalidate(); } On Sep 14, 2010, at 5:45 PM, TreKing wrote: On Tue, Sep 14, 2010 at 11:26 AM, Pedro Teixeira > wrote: I have no ideia why is this happening since the information is used just once. Funny how these problems always come in pairs ... I assume you're overriding onDraw? Did you look at the documentation for that function? - TreKing - Chicago transit tracking app for Android-powered devices -- 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 Pedro Teixeira www.pedroteixeira.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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] duplicated entries?!
oh god.. how can I put this back to normal without shadow? Sorry I'm not very experienced in programming.. I'm just trying to connect the dots of many tutorials and build something to use.. On Sep 14, 2010, at 6:13 PM, TreKing wrote: On Tue, Sep 14, 2010 at 12:08 PM, Pedro Teixeira > wrote: Actually not sure.. I just removed the shadow Which just means the function will be called twice with shadow = false. - TreKing - Chicago transit tracking app for Android-powered devices -- 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 Pedro Teixeira www.pedroteixeira.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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] duplicated entries?!
Oh thank you very much, it actually disappeared the duplicated... the only issue it was the one it wasn't supposed to lol It's strange that overriding a shadow makes a variation on the map position.. it can't be just that On Sep 14, 2010, at 6:28 PM, TreKing wrote: On Tue, Sep 14, 2010 at 12:23 PM, Pedro Teixeira > wrote: how can I put this back to normal without shadow? OK, this: public void draw(Canvas canvas, MapView mapView, boolean shadow) { super.draw(canvas, mapView, false); boundCenter(marker); } is going to get called twice by the system. That's just how it works. Therefore, what you're currently doing is drawing twice without shadow, which is why you see what you see. If you don't want the shadow then you probably want this: public void draw(Canvas canvas, MapView mapView, boolean shadow) { if (!shadow) { super.draw(canvas, mapView, shadow); boundCenter(marker); } } P.S. - boundCenter is not something that needs to be done repeatedly. - TreKing - Chicago transit tracking app for Android-powered devices -- 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 Pedro Teixeira www.pedroteixeira.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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Playing with List
Hi, I have an overlay list which I retrieve it like this: List overlays = mapView.getOverlays(); So in this list I have elements of the type userOverlay and picOverlay.. How can I do to erase ALL occurences of userOverlay but leave all the others? I've been playing around with the List methods but I can't make it work, I've tried: while(overlays.contains(userOverlay)==true){ overlays.remove(userOverlay); } Which made sense to me.. but it doesn't work.. any suggestions? -- 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] trigonometry
Hi, I'm having problems with JAva and trigonometry to calculate a direction from a point to a certain point... I want to translate this equation to Java-wise: tg^-1 = |value1-value2| / |value3-value4| And I'd like the result in degrees.. how can I do this? any ideia? -- 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] Playing with List
Worked like a charm Kostya : Thank you !!! I've used the iterator but didn't thought about ''instanceof'', it was erasing everything. Now it's perfect. Thank you very much :D Pedro On Sep 15, 2010, at 5:24 PM, Kostya Vasilyev wrote: Pedro, I believe list.remove(object item) removes the first element has is equal() to the one passed in. To remove items by some other criteria (such as actual class), you've got to iterate the list. Note that removing elements while iterating has to be done by calling remove() on the iterator. Calling remove() on the collection itself while iterating is not supported, and throws an exception that says as much. List list = mapView.getOverlays(); for (Iterator ite = list.iterator(); ite.hasNext(); ) { Overlay ov = ite.next(); if (ov instanceof UserOverlay) { ite.remove(); } } Hope this helps. -- Kostya 15.09.2010 20:06, Pedro Teixeira пишет: Hi, I have an overlay list which I retrieve it like this: List overlays = mapView.getOverlays(); So in this list I have elements of the type userOverlay and picOverlay.. How can I do to erase ALL occurences of userOverlay but leave all the others? I've been playing around with the List methods but I can't make it work, I've tried: while(overlays.contains(userOverlay)==true){ overlays.remove(userOverlay); } Which made sense to me.. but it doesn't work.. any suggestions? -- Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com -- 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 Pedro Teixeira www.pedroteixeira.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 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: trigonometry
Geez this is even better than I expected. I was worried with negative values hence the Math.abs and I wasn't sure how to express in degrees. Thank you very much for your answers guys, the atan2 is completely new to me ;) Thanks again On Sep 15, 2010, at 5:50 PM, Kostya Vasilyev wrote: Um, no. Math.atan2 takes two values, not one. Math.atan2(y2 - y1, x2 - x1) This gives correct result even for x2 and x1 being very close to each other. Depending on the sign of y2 - y1 that's either "up" or "down". -- Kostya 15.09.2010 20:45, Robert Green пишет: Kostya hit it: float angleDegrees = Math.toDegrees(Math.atan2((y1 - y2) / (x1 - x2))); On Sep 15, 11:32 am, Kostya Vasilyev wrote: Pedro, Java (and pretty much any language's) trig functions work with angles expressed in radians. http://en.wikipedia.org/wiki/Radian To convert to degrees, multiply by 180 / 3,1415926 (in Java, that's Math.PI). Or just call Math.toDegrees. Better yet - use Math.atan2 ( difference along Y, different along X). This one correctly handles the case of value3-value4 being zero (or very close thereof). -- Kostya 15.09.2010 20:22, Pedro Teixeira пишет: Hi, I'm having problems with JAva and trigonometry to calculate a direction from a point to a certain point... I want to translate this equation to Java-wise: tg^-1 = |value1-value2| / |value3-value4| And I'd like the result in degrees.. how can I do this? any ideia? -- Kostya Vasilyev -- WiFi Manager + pretty widget --http://kmansoft.wordpress.com -- Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com -- 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 Pedro Teixeira www.pedroteixeira.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 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: trigonometry
I guess Math is not my area of expertise, sorry for that :) On Sep 15, 2010, at 7:41 PM, DanH wrote: Yeah atan2 is a really new concept -- invented maybe 1965 with Fortran, if not before. Pretty much a standard in all language math/ trig suites since then. http://en.wikipedia.org/wiki/Atan2 On Sep 15, 11:56 am, Pedro Teixeira wrote: Geez this is even better than I expected. I was worried with negative values hence the Math.abs and I wasn't sure how to express in degrees. Thank you very much for your answers guys, the atan2 is completely new to me ;) Thanks again On Sep 15, 2010, at 5:50 PM, Kostya Vasilyev wrote: Um, no. Math.atan2 takes two values, not one. Math.atan2(y2 - y1, x2 - x1) This gives correct result even for x2 and x1 being very close to each other. Depending on the sign of y2 - y1 that's either "up" or "down". -- Kostya 15.09.2010 20:45, Robert Green пишет: Kostya hit it: float angleDegrees = Math.toDegrees(Math.atan2((y1 - y2) / (x1 - x2))); On Sep 15, 11:32 am, Kostya Vasilyev wrote: Pedro, Java (and pretty much any language's) trig functions work with angles expressed in radians. http://en.wikipedia.org/wiki/Radian To convert to degrees, multiply by 180 / 3,1415926 (in Java, that's Math.PI). Or just call Math.toDegrees. Better yet - use Math.atan2 ( difference along Y, different along X). This one correctly handles the case of value3-value4 being zero (or very close thereof). -- Kostya 15.09.2010 20:22, Pedro Teixeira пишет: Hi, I'm having problems with JAva and trigonometry to calculate a direction from a point to a certain point... I want to translate this equation to Java-wise: tg^-1 = |value1-value2| / |value3-value4| And I'd like the result in degrees.. how can I do this? any ideia? -- Kostya Vasilyev -- WiFi Manager + pretty widget --http://kmansoft.wordpress.com -- Kostya Vasilyev -- WiFi Manager + pretty widget --http://kmansoft.wordpress.com -- 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 Pedro Teixeira www.pedroteixeira.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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en Pedro Teixeira www.pedroteixeira.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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Compass pointing a direction other than North
Hi everyone..I'm trying to implement spomething that I don't even know if it's possible.. So I have this class which implements a SensorEventListener like this: private SensorEventListener mySensorEventListener = new SensorEventListener(){ @Override public void onAccuracyChanged(Sensor sensor, int accuracy) { } @Override public void onSensorChanged(SensorEvent event) { myCompass.updateDirection((float)event.values[0]); } }; And a class that handles the way the compass looks like this: public static class compassLook extends View { private Paint paintPointer = new Paint(Paint.ANTI_ALIAS_FLAG); private Paint paintCircle = new Paint(Paint.ANTI_ALIAS_FLAG); private Paint paintLeters = new Paint(Paint.ANTI_ALIAS_FLAG); private boolean firstDraw; private float direction = 0 ; public compassLook(Context context) { super(context); init(); } public compassLook(Context context, AttributeSet attrs) { super(context, attrs); init(); } public compassLook(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); init(); } private void init(){ paintPointer.setStyle(Paint.Style.STROKE); paintPointer.setStrokeWidth(3); paintPointer.setColor(Color.argb(255, 209, 114, 2)); paintCircle.setStyle(Paint.Style.STROKE); paintCircle.setStrokeWidth(2); paintCircle.setColor(Color.argb(150, 255, 255, 255)); paintLeters.setStyle(Paint.Style.STROKE); paintLeters.setStrokeWidth(1); paintLeters.setColor(Color.argb(230, 255, 255, 255)); paintLeters.setTextSize(12); firstDraw = true; } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { setMeasuredDimension(MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.getSize(heightMeasureSpec)); } @Override protected void onDraw(Canvas canvas) { int cxCompass = (getMeasuredWidth()/2); int cyCompass = (getMeasuredHeight()/2); float radiusCompass; if(cxCompass > cyCompass){ radiusCompass = (float) (cyCompass * 0.9); } else{ radiusCompass = (float) (cxCompass * 0.9); } canvas.drawCircle(cxCompass-50, cyCompass, radiusCompass, paintCircle); if(!firstDraw){ // Desenho da linha que aponta canvas.drawLine(cxCompass-50, cyCompass, (float)(cxCompass-50 + radiusCompass * Math.sin((double)(- direction) * 3.14/180)), (float)(cyCompass - radiusCompass * Math.cos((double)(-direction) * 3.14/180)), paintPointer); double mLatitude = (mLocation.getLatitude() / 1E6); // I get this value from a LM request double mLongitude = (mLocation.getLongitude() / 1E6); // I get this value from a LM request double picLatitude = Double.parseDouble(picLatitudeString); // I get this value from a bundle double picLongitude = Double.parseDouble(picLongitudeString); // I get this value from a bundle float direction = (float) Math.toDegrees(Math.atan2(picLongitude- mLongitude, picLatitude-mLatitude)); float distancia = (float) (Math.sqrt(Math.pow(mLatitude- picLatitude, 2) + Math.pow(mLongitude-picLongitude,2)))/2; //Desenho do texto que indica a distancia canvas.drawText(String.valueOf(distancia) + "Km", cxCompass-30, cyCompass+20, paintLeters); } } public void updateDirection(float dir) { firstDraw = false; direction = dir; invalidate(); } } This classes work perfectlly showing me a little circle with a line pointing the North. What I would like to do, is ..given this 2 points in space (mLatitude, mLongitude) and (picLatitude, picLongitude) which are the user position, and a certain picture position. I'd like the compass to point to the position of the picture (picLatitude,picLongitude) from the position they are in the moment (mLatitude,mLongitude) I came to the trignometry formula that calculates this..being: float direction = (float) Math.toDegrees(Math.atan2(picLongitude- mLongitude, picLatitude-mLatitude)); But when I use
Re: [android-developers] Re: Compass pointing a direction other than North
I'm actually not positivlly sure about the algorythm since it will return always the same value if I'm on the same position... so it doesn't make sense because it should depend on the device orientation... I'm using now the azimuth.. because it will depend on the orientation of the device.. at least the line is moving.. I guess is just a mathematical thing now ..ohh the math :S float angleDegrees = (float) Math.abs(Math.toDegrees(Math.atan2 (picLongitude-mLongitude, picLatitude-mLatitude))-event.values[0]); On Sep 16, 2010, at 5:41 PM, DanH wrote: Have you done any debugging? Looked at the raw sensor readings to make sure they make sense? Implemented the algorithm in Java on a desktop, fed in sensor numbers, and checked whether it produced what you expected? On Sep 16, 11:26 am, Pedro Teixeira wrote: Hi everyone..I'm trying to implement spomething that I don't even know if it's possible.. So I have this class which implements a SensorEventListener like this: private SensorEventListener mySensorEventListener = new SensorEventListener(){ @Override public void onAccuracyChanged(Sensor sensor, int accuracy) { } @Override public void onSensorChanged(SensorEvent event) { myCompass.updateDirection((float)event.values[0]); } }; And a class that handles the way the compass looks like this: public static class compassLook extends View { private Paint paintPointer = new Paint (Paint.ANTI_ALIAS_FLAG); private Paint paintCircle = new Paint (Paint.ANTI_ALIAS_FLAG); private Paint paintLeters = new Paint (Paint.ANTI_ALIAS_FLAG); private boolean firstDraw; private float direction = 0 ; public compassLook(Context context) { super(context); init(); } public compassLook(Context context, AttributeSet attrs) { super(context, attrs); init(); } public compassLook(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); init(); } private void init(){ paintPointer.setStyle(Paint.Style.STROKE); paintPointer.setStrokeWidth(3); paintPointer.setColor(Color.argb(255, 209, 114, 2)); paintCircle.setStyle(Paint.Style.STROKE); paintCircle.setStrokeWidth(2); paintCircle.setColor(Color.argb(150, 255, 255, 255)); paintLeters.setStyle(Paint.Style.STROKE); paintLeters.setStrokeWidth(1); paintLeters.setColor(Color.argb(230, 255, 255, 255)); paintLeters.setTextSize(12); firstDraw = true; } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { setMeasuredDimension(MeasureSpec.getSize (widthMeasureSpec), MeasureSpec.getSize(heightMeasureSpec)); } @Override protected void onDraw(Canvas canvas) { int cxCompass = (getMeasuredWidth()/2); int cyCompass = (getMeasuredHeight()/2); float radiusCompass; if(cxCompass > cyCompass){ radiusCompass = (float) (cyCompass * 0.9); } else{ radiusCompass = (float) (cxCompass * 0.9); } canvas.drawCircle(cxCompass-50, cyCompass, radiusCompass, paintCircle); if(!firstDraw){ // Desenho da linha que aponta canvas.drawLine(cxCompass-50, cyCompass, (float)(cxCompass-50 + radiusCompass * Math.sin ((double)(- direction) * 3.14/180)), (float)(cyCompass - radiusCompass * Math.cos ((double)(-direction) * 3.14/180)), paintPointer); double mLatitude = (mLocation.getLatitude() / 1E6); // I get this value from a LM request double mLongitude = (mLocation.getLongitude() / 1E6); // I get this value from a LM request double picLatitude = Double.parseDouble (picLatitudeString); // I get this value from a bundle double picLongitude = Double.parseDouble (picLongitudeString); // I get this value from a bundle float direction = (float) Math.toDegrees(Math.atan2 (picLongitude- mLongitude, picLatitude-mLatitude)); float distancia = (float) (Math.sqrt (Math.pow(mLatitude- picLatitude, 2) + Math.pow(mLongitude-picLongitude,2)))/2; //Desenho do texto que indica a distancia
[android-developers] Oriented Overlay
Hello, I'm trying to make my USER POSITION overlay to rotate according to the orientation. Here is the method that calls for the overlay: protected void createAndShowUserOverlay(Location newLocation) { List useroverlays = mapView.getOverlays(); // first remove old overlay if (useroverlays.size() > 0) { for (Iterator iterator = useroverlays.iterator(); iterator.hasNext();) { iterator.next(); iterator.remove(); } } // transform the location to a geoPoint GeoPoint geopoint = new GeoPoint((int) (newLocation.getLatitude() * 1E6), (int) (newLocation.getLongitude() * 1E6)); float bear = newLocation.getBearing(); // initialize icon Drawable icon = getResources().getDrawable(R.drawable.user2); icon.setBounds(0, 0, icon.getIntrinsicWidth(), icon.getIntrinsicHeight()); // create my overlay and show it userOverlay useroverlay = new userOverlay(icon); OverlayItem item = new OverlayItem(geopoint, "I'm here", null); useroverlay.addItem(item); mapView.getOverlays().add(useroverlay); mc.animateTo(geopoint); mapView.postInvalidate(); } And here is the draw method on the userOverlay class: @Override public void draw(Canvas canvas, MapView mapView, boolean shadow) { super.draw(canvas, mapView, false); boundCenter(marker); } I want to implement this matrix to make the marker rotate, but I don't know where or how to place it, in order to make the marker rotate depending on the ''ori'' value, which I'll implement after: Paint paint = new Paint(); Point pt = new Point(); mapView.getProjection().toPixels(p, pt); Bitmap bmp = BitmapFactory.decodeResource(getResources(),R.drawable.pointer); Matrix matrix = new Matrix(); matrix.postTranslate(-25, -25); matrix.postRotate(ori); matrix.postTranslate(pt.x, pt.y); paint.setAntiAlias(true); paint.setFilterBitmap(true); canvas.drawBitmap(bmp, matrix, paint); Any suggestions ? Should I override the draw method on the userOverlay class? Or I have to put this on the main class? I'm mixing 2 or 3 tutorials and I'm not quite sure how to merge them together.. -- 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: ItemizedOverlay using both onTap methods
Any news on how to implement this ? Is overriding the class that extends itemizedOverlay on the onTap method enough? I need to show information when the user clicks a marker and cant seem to find possibilities On Jun 29, 9:52 pm, Steve Howard wrote: > Trying to resend this reply as I think it may not have gone through the > first time... > > Steve > > > > On Thu, Jun 24, 2010 at 11:24 AM, Steve Howard wrote: > > I think the ideal usage would be something like this: > > > public boolean onTap(GeoPoint point, MapView mapView) { > > // first, let the superclass check if the event hit a marker; if so, > > it'll call onTap(index) > > // if it returns true, that means onTap(index) returned true, > > meaning the event has been handled already > > if (super.onTap(point, mapView)) { > > return true; > > } > > > // the event wasn't handled as a tap on an existing marker, so let's > > add a new marker > > addNewMarkerAt(point); > > return true; > > } > > > public boolean onTap(int index) { > > // an existing marker was tapped > > // ...display info by whatever means are appropriate... > > return true; // indicate that we've handled this tap, and it > > shouldn't propagate to other potential handlers > > } > > > You can override both, but the key is to call the superclass > > implementation of onTap(GeoPoint, MapView) and examine its return > > value. > > > Let me know if that helps. > > > Steve > > > On Thu, Jun 24, 2010 at 9:57 AM, Carlos Silva wrote: > > > On Thu, Jun 24, 2010 at 17:49, TreKing wrote: > > > >> On Jun 15, 9:15 am, tfriest wrote: > > >> > Does anyone know of a better way to do this? > > > >> As you've seen, the maps documentation is pretty pathetic. What I know > > >> of the onTap functions has been gleamed from trial and error and > > >> experimentation. This is how I believe it works: > > > >> onTap(int) determines whether the item at the specified index will > > >> handle tap events at all. If you return false, the other onTap > > >> function will always return false. > > > >> onTap(Point, MapView) determines whether an item in the overlay was > > >> tapped given the touch point, if onTap(int) return true for it's > > >> index. > > > >> OK, with that, what you can do is: > > >> return true for onTap(int) always. > > >> in onTap(Point, MapView) call through to the base implementation to > > >> determine if something was tapped. And that's it. > > > >> public boolean onTap(point, mapview) > > >> { > > >> boolean tapped = super.onTap(point, mapView); > > >> if (tapped) > > >> showInfo(); > > >> else > > >> dropNewItem(point); > > > >> return true; // irrelevant if you only have one itemized overlay > > >> } > > > >> Hope that helps. > > > >> -- > > >> 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 > >> cr...@googlegroups.com> > > >> For more options, visit this group at > > >>http://groups.google.com/group/android-developers?hl=en > > > > I don't really agree with this. > > > I use onTap(int) to detect if an overlayItem was clicked. And use > > > onTap(point, mapview) to handle every other click on the map. I use the > > > first to show a ballow, and the second to hide it. > > > > -- > > > 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 > > cr...@googlegroups.com> > > > For more options, visit this group at > > >http://groups.google.com/group/android-developers?hl=en -- 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: ItemizedOverlay using both onTap methods
Thank you very much, I've implemented some parts of the code you gave me in my code and works like a charm. I just had my overlay class in a separate file and i'm not sure how to access the variables like the map from there. I'd like to keep the format I had before, but if its not possible, this works perfectly so I changed my code a little bit and now it works. Thank you very much for this :)) On Jul 5, 2010, at 11:03 PM, Mark Murphy wrote: On Mon, Jul 5, 2010 at 5:58 PM, Pedro Teixeira wrote: Any news on how to implement this ? Is overriding the class that extends itemizedOverlay on the onTap method enough? I need to show information when the user clicks a marker and cant seem to find possibilities Here are examples of how I've done it: http://github.com/commonsguy/cw-android/tree/master/Maps/NooYawk/ http://github.com/commonsguy/cw-advandroid/tree/master/Maps/EvenNooerYawk/ -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android Consulting: http://commonsware.com/consulting -- 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 Pedro Teixeira www.pedroteixeira.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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] organizing the code
I'm having a hard time keeping my code clean... mainlly because all the try's and catches... I'm simple doing an HTTP request on which the response is then converted to JSON Array.. but now it's a mess of {}'s .. is there anyway to agregate all this try and catches? The code really looks bad and unreadable like this... and worst, it's executing correctly because I'm not finishing in the correct places.. nameValuePairs.add(new BasicNameValuePair("id", picId)); InputStream content = null; HttpClient httpclient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost("http://www.pedroteixeira.org/ thennnow/alg_showpopup.php"); try { httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); } catch (UnsupportedEncodingException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } try { response = httpclient.execute(httpPost); } catch (ClientProtocolException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } try { content = response.getEntity().getContent(); } catch (IllegalStateException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } StringBuilder sb = new StringBuilder(); String line; BufferedReader reader; try { reader = new BufferedReader(new InputStreamReader(content, "UTF-8")); while ((line = reader.readLine()) != null) { sb.append(line); String pic_values = sb.toString(); try { picvalues = new JSONArray(pic_values); } catch (JSONException e) { // TODO Auto-generated catch block picvalues = new JSONArray(""); // just so it's not null. } -- 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] get GeoPoint from the onTap method
Hi, I have this snippet of code that generates overlays on my map: GeoPoint Y = gpItems.get(j); float orientation = orientItems.get(j); Paint paint = new Paint(); Point pt = new Point(); mapView.getProjection().toPixels(Y, pt); Bitmap bmp = BitmapFactory.decodeResource(getResources(),R.drawable.overlay); Matrix matrix = new Matrix(); matrix.postTranslate(-25, -25); matrix.postRotate(orientation); matrix.postTranslate(pt.x, pt.y); paint.setAntiAlias(true); paint.setFilterBitmap(true); int width = bmp.getWidth(); int height = bmp.getHeight(); Bitmap changedBitmap = Bitmap.createBitmap(bmp, 0, 0, width, height, matrix, true); BitmapDrawable icon = new BitmapDrawable(changedBitmap); icon.setBounds(0, 0, icon.getIntrinsicWidth(), icon.getIntrinsicHeight()); picOverlay overlay = new picOverlay(icon); OverlayItem item = new OverlayItem(Y,"pic",null); overlay.addItem(item); On my picOverlay class I have onTap method with this snippet: @Override protected boolean onTap(int i) { OverlayItem item=getItem(i); GeoPoint geo=item.getPoint(); Point pt=mapView.getProjection().toPixels(geo, null); My question is... is it possible to know exactly from which GeoPoint ( in this case Y ) the overlay was created? ... I want to perform an HTTP request from onTap on which I compare the lat/long of the overlay with the lat/long of the place the user tapped... but I can't seem to get the numbers right.. longitude and latitude suffer approximations during the convertions which is making my job impossible.. so if I have access from the onTap method to the actual GeoPoint that ''created'' that overlay I could compare them... Any 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 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: ItemizedOverlay using both onTap methods
Is there anyway to get the values that created this overlay and compare them with the values of GeoPoint geo ? My code is aproximmating values so I never get the numbers right... I don't know which values can I use from the onTap method to compare with the ones that created the overlay itself besides the latitude and longitude values... protected boolean onTap(int i) { OverlayItem item=getItem(i); GeoPoint geo=item.getPoint(); Point pt=map.getProjection().toPixels(geo, null); View view=panel.getView(); ((TextView)view.findViewById(R.id.latitude)) .setText(String.valueOf(geo.getLatitudeE6()/100.0)); ((TextView)view.findViewById(R.id.longitude)) .setText(String.valueOf(geo.getLongitudeE6()/100.0)); ((TextView)view.findViewById(R.id.x)) .setText(String.valueOf(pt.x)); ((TextView)view.findViewById(R.id.y)) .setText(String.valueOf(pt.y)); panel.show(pt.y*2>map.getHeight()); return(true); } On Jul 5, 2010, at 11:03 PM, Mark Murphy wrote: On Mon, Jul 5, 2010 at 5:58 PM, Pedro Teixeira wrote: Any news on how to implement this ? Is overriding the class that extends itemizedOverlay on the onTap method enough? I need to show information when the user clicks a marker and cant seem to find possibilities Here are examples of how I've done it: http://github.com/commonsguy/cw-android/tree/master/Maps/NooYawk/ http://github.com/commonsguy/cw-advandroid/tree/master/Maps/EvenNooerYawk/ -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android Consulting: http://commonsware.com/consulting -- 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 Pedro Teixeira www.pedroteixeira.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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Keep the same value when converting from String to Float
Hello, I have a JSON Object with a latitude and longitude String on which I get the values doing this: String latitude = picInfo.getString("latitude"); String longitude = picInfo.getString("longitude"); Then I convert them to floats like this: float latInt = Float.valueOf(latitude).floatValue(); float longInt = Float.valueOf(longitude).floatValue(); And place them on a GeoPoint like this: GeoPoint X = new GeoPoint((int) (latInt*1E6),(int) (longInt*1E6) ); Debugging this values I can see JAVA approximates the values, is there anyway to keep them exactly the same? In my example: String latitude = 32.649162 String longitude = -16.907325 float latInt = 32.649162 float longInt = -16.907326 GeoPoint X = 32649162,-16907325 -- 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] get GeoPoint from the onTap method
Basiclly on the onTap method I want to : 1. Know the value of latitude and longitude which I'm tapping - I can get this by GeoPoint geo=item.getPoint(); and taking the lat/ long out of it 2. Perform an HTTP request to a server that delivers me a lat/long 3. If the lat/long from the server are the same as the ones from that point I execute another command that shows me the picture. Basiclly is a sort off hit test comparison. The overlays are created from the lat/long of the server in the first place so I should be dealing with same values, but I'm dealing with latitude/longitude values that are being automaticlly converted for example: The longitude that creates one of the Geopoint retrieved from the server is : -16.9073252 The longitude from the actual GeoPoint that was created is : -16.907326 So when I compare them, they are not the same, obviously, and my picture isin't shown. On Jul 8, 2010, at 5:57 PM, TreKing wrote: You might want to elaborate on your problem. I know I'm confused. On Thu, Jul 8, 2010 at 11:24 AM, Pedro Teixeira > wrote: My question is... is it possible to know exactly from which GeoPoint ( in this case Y ) the overlay was created? Why does this matter? The overlay item has a point attached to it with the location. ... I want to perform an HTTP request from onTap on which I compare the lat/long of the overlay with the lat/long of the place the user tapped... but I can't seem to get the numbers right.. What numbers? longitude and latitude suffer approximations during the convertions which is making my job impossible.. What conversions? so if I have access from the onTap method to the actual GeoPoint that ''created'' that overlay I could compare them... The GeoPoint that "created" the overlay is attached to the overlay item, isn't it? And compare what? - TreKing - Chicago transit tracking app for Android-powered devices http://sites.google.com/site/rezmobileapps/treking -- 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 Pedro Teixeira www.pedroteixeira.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 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: Keep the same value when converting from String to Float
Thanks for the reply, but in my case the issue is more about not being able to execute a command because the decimals change not the precision itself. If there is some way of ignoring the last digits, I'll give it a try, maybe a Java syntax thingy, anyone knows about this? For example if I have a value of 12,746356 trim always to 5 decimals digits 12,74635 On Jul 8, 2010, at 6:03 PM, Maps.Huge.Info (Maps API Guru) wrote: I can tell you that the difference is less than 3cm, so what does it matter? Geo coordinates are really only accurate to 5 decimals, even less in the real world. The GPS signal is accurate to 12m at best, so any coordinate that exceeds this precision is just extra digits. In the future (like a decade), GPS and Galileo based coordinates will be better but for the foreseeable time frame, 12m is going to be the best it gets. -John Coryat -- 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 Pedro Teixeira www.pedroteixeira.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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: ItemizedOverlay using both onTap methods
Hello MArk, I used your NooYawk example to help build my code. I'm just having some issues changing the appearance of the onTap overlay. Is it possible to change it from a TableLayout to a RelativeLayout? This XML is sometimes complicated. I just wanted to appear some sort of box in the center with information and buttons, and when Tap outside the box the box disappears, and if tapped in another item another box and so on. At this point I have the information appearing on the screen and being overlaid with each other, its a little bit confusing. On Jul 10, 7:02 pm, Brad Gies wrote: > Hi Pedro, > > There are several ways to do it, but you probably want to do it when you > create the overlay. If you are not using the overlayItem tag for > anything else, just set the tag to the Geopoint, and then you can access > it by casting the tag to a Geopoint after you get the item in the code > below. As I said, there are lots of other ways.. but that is normally my > preferred way, because it keeps the information you want with the item. > > On 08/07/2010 9:28 AM, Pedro Teixeira wrote: > > > > > > > Is there anyway to get the values that created this overlay and > > compare them with the values of GeoPoint geo ? My code is > > aproximmating values so I never get the numbers right... I don't know > > which values can I use from the onTap method to compare with the ones > > that created the overlay itself besides the latitude and longitude > > values... > > protected boolean onTap(int i) { > > OverlayItem item=getItem(i); > > GeoPoint geo=item.getPoint(); > > Point pt=map.getProjection().toPixels(geo, null); > > View view=panel.getView(); > > ((TextView)view.findViewById(R.id.latitude)) > > .setText(String.valueOf(geo.getLatitudeE6()/100.0)); > > ((TextView)view.findViewById(R.id.longitude)) > > .setText(String.valueOf(geo.getLongitudeE6()/100.0)); > > ((TextView)view.findViewById(R.id.x)) > > .setText(String.valueOf(pt.x)); > > ((TextView)view.findViewById(R.id.y)) > > .setText(String.valueOf(pt.y)); > > panel.show(pt.y*2>map.getHeight()); > > return(true); > > } > > > On Jul 5, 2010, at 11:03 PM, Mark Murphy wrote: > > >> On Mon, Jul 5, 2010 at 5:58 PM, Pedro Teixeira > >> mailto:pedroteixeir...@gmail.com>> wrote: > >>> Any news on how to implement this ? Is overriding the class that > >>> extends itemizedOverlay on the onTap method enough? > >>> I need to show information when the user clicks a marker and cant seem > >>> to find possibilities > > >> Here are examples of how I've done it: > > >>http://github.com/commonsguy/cw-android/tree/master/Maps/NooYawk/ > >>http://github.com/commonsguy/cw-advandroid/tree/master/Maps/EvenNooer... > > >> -- > >> Mark Murphy (a Commons Guy) > >>http://commonsware.com|http://github.com/commonsguy > >>http://commonsware.com/blog|http://twitter.com/commonsguy > > >> Android Consulting:http://commonsware.com/consulting > > >> -- > >> 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 > > > Pedro Teixeira > > >www.pedroteixeira.org<http://www.pedroteixeira.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 > > android-developers+unsubscr...@googlegroups.com > > For more options, visit this group at > >http://groups.google.com/group/android-developers?hl=en > > -- > Sincerely, > > Brad Gies > --- > Bistro Bot - Bistro > Blurbhttp://www.bgies.comhttp://www.bistroblurb.comhttp://www.ihottonight.com > --- > > Never doubt that a small group of thoughtful, committed people can > change the world. Indeed. It is the only thing that ever has - Margaret Mead -- 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: ItemizedOverlay using both onTap methods
The popup.xml isn't a table layout? On Jul 23, 2010, at 3:31 PM, Mark Murphy wrote: On Fri, Jul 23, 2010 at 10:25 AM, Pedro Teixeira wrote: I used your NooYawk example to help build my code. I'm just having some issues changing the appearance of the onTap overlay. Is it possible to change it from a TableLayout to a RelativeLayout? NooYawk does not use a TableLayout. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _Android Programming Tutorials_ Version 2.9 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 Pedro Teixeira www.pedroteixeira.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 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: ItemizedOverlay using both onTap methods
Thanks Carlos, I'll take a look just now ;) On Jul 23, 2010, at 3:32 PM, Carlos Silva wrote: On Fri, Jul 23, 2010 at 15:25, Pedro Teixeira > wrote: Hello MArk, I used your NooYawk example to help build my code. I'm just having some issues changing the appearance of the onTap overlay. Is it possible to change it from a TableLayout to a RelativeLayout? This XML is sometimes complicated. I just wanted to appear some sort of box in the center with information and buttons, and when Tap outside the box the box disappears, and if tapped in another item another box and so on. At this point I have the information appearing on the screen and being overlaid with each other, its a little bit confusing. That's what I have on Farmácias. Check http://github.com/r3pek/Farmacias/blob/master/src/org/r3pek/pharmacies/PharmaciesOverlay.java to see if it helps you. -- 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 Pedro Teixeira www.pedroteixeira.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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Set a panel transparent
Hi, I have a class to make a transparent panel to overlay in any view of my application which I found the tutorial on the internet. The thing is.. it's not painting with transparency .. just gray... does it have to do with this element? How can I change this values to make it be transparent? innerPaint = new Paint(); innerPaint.setARGB(255, 75, 75, 75); //gray innerPaint.setAntiAlias(true); -- 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: Set a panel transparent
I've tried lowering the first attribute to different values and nothing. I also tried the setAlpha and nothing.. maybe something in the xml ? I'm not sure if something is impeding from the alpha to work..in some other part of the code.. On Jul 24, 2010, at 6:34 PM, Joseph Earl wrote: You are using innerPaint.setARGB(255, 75, 75, 75); //gray Since you are setting the Alpha to 255 you will have an opaque image. If you want some transparency change that value to somewhere between 0 and 255. On Jul 24, 5:41 pm, Pedro Teixeira wrote: Hi, I have a class to make a transparent panel to overlay in any view of my application which I found the tutorial on the internet. The thing is.. it's not painting with transparency .. just gray... does it have to do with this element? How can I change this values to make it be transparent? innerPaint = new Paint(); innerPaint.setARGB(255, 75, 75, 75); //gray innerPaint.setAntiAlias(true); -- 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 Pedro Teixeira www.pedroteixeira.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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] XML issue
Hello there, I've been going on and on with my XML file and I can't seem to find any problem... The file doesn't show any problem in the code but there's the red box on the right which reads: Multiple annotations found at this line: - The processing instruction target matching "[xX][mM][lL]" is not allowed. - No grammar constraints (DTD or XML schema) detected for the document. Here is the XML code: http://schemas.android.com/apk/res/ android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@color/black" android:padding="6dp" > And the message is in the last line after "" Any ideias about this? I googled it, tried to take all white spaces etc.. and nothing.. -- 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: XML issue
Thank you for your replies. @Toomy: I added the "+" in all the missing places and still didn't solved. @Kostya: I actually don't have any errors to erase, eclipse allows me to run it. I debugged it and this is the error I get: android.view.InflateException: Binary XML file line #19: Error inflating class java.lang.reflect.Constructor My 19 line is simply: android:id="@+id/header" Doesn't make any sense to me... On Jul 29, 2010, at 5:39 PM, Tommy wrote: android:text="Facebook" android:id="@+id/facebook" android:layout_height="wrap_content" android:layout_toRightOf="@+id/picpreview" android:layout_width="wrap_content" android:layout_alignLeft="@id/email" android:layout_below="@+id/email"> Shouldn't you have @+id/email for alignLeft? I noticed that in some other places as well -Original Message- From: android-developers@googlegroups.com [mailto:android-develop...@googlegroups.com] On Behalf Of DanH Sent: Thursday, July 29, 2010 12:34 PM To: Android Developers Subject: [android-developers] Re: XML issue Cut out chunks until it passes, then add stuff back a little at a time until you get the problem again. On Jul 29, 10:15 am, Pedro Teixeira wrote: Hello there, I've been going on and on with my XML file and I can't seem to find any problem... The file doesn't show any problem in the code but there's the red box on the right which reads: Multiple annotations found at this line: - The processing instruction target matching "[xX][mM][lL]" is not allowed. - No grammar constraints (DTD or XML schema) detected for the document. Here is the XML code: http://schemas.android.com/apk/res/ android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@color/black" android:padding="6dp" > And the message is in the last line after "" Any ideias about this? I googled it, tried to take all white spaces etc.. and nothing.. -- 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 -- 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 Pedro Teixeira www.pedroteixeira.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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] facebook sdk
Hello, I just saw the Facebook SDK was released for Android. Can someone help me on how to install it? I don't get the instructions on the github... "Pull the read-only repository from github e.g. "git clone git://github.com/facebook/facebook-android-sdk.git" (if you have trouble, you could also try "git clone http://github.com/facebook/facebook-android-sdk.git";)" I guess I have downloaded the file already, I don't know how to combine it in my application. I'd like to make a certain picture of my application to be posted on the wall of the user. I was abble to do the Facebook connect tutorial than runs around the web but that only allows me to post text. I'd like to post a picture with caption. Can anyone help please? -- 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] create a New File ( to be sent ) from a Bitmap
Hi, I have a bitmap "picPrev" which I got from my online server. I want to turn it into a file so I can send it. I was exploring this method: try { FileOutputStream fos = super.openFileOutput("output.jpg", MODE_WORLD_READABLE); picPrev.compress(CompressFormat.JPEG, 75, fos); fos.flush(); fos.close(); } catch (Exception e) { Log.e("MyLog", e.toString()); } But the FileOutputStream fos = super.openFileOutput("output.jpg", MODE_WORLD_READABLE); command is not working... Is there anyway to convert a bitmap to stream ? Or any other way to create a New File from a Bitmap ? I also have the opportunity to use the URL on which the file is placed. Maybe an HTTP connection to a php file that will return a header with the file location? Can "new File" use that location url? Please give me some feedback on this. I could really use some help. Thank you very much -- 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] create a New File ( to be sent ) from a Bitmap
I found the JoshKraker way to do this: Saving the file first to the phone: FileOutputStream Os = getAppContext().openFileOutput("Img" + _PicId + ".jpg", Context.MODE_WORLD_READABLE); Bm.compress(Bitmap.CompressFormat.JPEG, 100, Os); Os.close(); Then getting the Uri to send to the Chooser intent: File F = getAppContext().getFileStreamPath("Img" + _PicId + ".jpg"); Uri U = Uri.fromFile(F); Intent i = new Intent(Intent.ACTION_SEND); i.setType("image/jpg"); i.putExtra(Intent.EXTRA_STREAM, U); getContext().startActivity(Intent.createChooser (i,"Send Image To:")); But I'd like to do this without having to save the bitmap.. I get my image from my server and I want users to be able to share it with somebody else. On Jul 30, 2010, at 9:41 AM, Pedro Teixeira wrote: Hi, I have a bitmap "picPrev" which I got from my online server. I want to turn it into a file so I can send it. I was exploring this method: try { FileOutputStream fos = super.openFileOutput("output.jpg", MODE_WORLD_READABLE); picPrev.compress(CompressFormat.JPEG, 75, fos); fos.flush(); fos.close(); } catch (Exception e) { Log.e("MyLog", e.toString()); } But the FileOutputStream fos = super.openFileOutput("output.jpg", MODE_WORLD_READABLE); command is not working... Is there anyway to convert a bitmap to stream ? Or any other way to create a New File from a Bitmap ? I also have the opportunity to use the URL on which the file is placed. Maybe an HTTP connection to a php file that will return a header with the file location? Can "new File" use that location url? Please give me some feedback on this. I could really use some help. Thank you very much -- 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 Pedro Teixeira www.pedroteixeira.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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Upload Images to server
Hey, I'm trying to upload a image file. Might be .jpg or .png to my server. I found some confusing tutorials which people are doing it in different ways. Is there any simple or at least clear tutorial for this? Thank you -- 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] Change drawable onTap
Hi, I have an Overlays class named picOverlay which extends ItemizedOverlay that uses a drawable named ''overlay''. I'd like for my application to change the drawable to let's say ''overlay_hover'' when the user touches the overlay. Can I do this in the onTap method? Can someone enlight me a little bit on how to change the drawable that I'm actually touching? Thank you very much -- 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: Upload Images to server
// to fulfill the request > case HttpURLConnection.HTTP_BAD_GATEWAY: > { > bSuccess = false; > break; > } > // 503: The server is currently unable to handle the > request due > // to > // a temporary overloading or maintenance of the server > case HttpURLConnection.HTTP_UNAVAILABLE: > { > bSuccess = false; > break; > } > } > } catch (Exception e) > { > bSuccess = false; > Logger.Log("Exception in downloading File::: Donwloader UTIL:::" > + e); > throw new Exception(""); > } finally > { > try > { > // close inputStream > if (null != oInputStream) > { > try > { > oInputStream.close(); > } catch (Exception e){} > > oInputStream = null; > } > > // close outputStream > if (null != oOutputStream) > { > try > { > oOutputStream.close(); > } catch (Exception e){} > > oOutputStream = null; > } > > // close FileInputStream > if (null != oFileInputStream) > { > try > { > oFileInputStream.close(); > } catch (Exception e){} > > oFileInputStream = null; > } > // close http connection > if (null != oHttpConnection) > { > try > { > oHttpConnection.disconnect(); > } catch (Exception e){} > > oHttpConnection = null; > } > } catch (Exception ex) { > bSuccess = false; > Logger.Log("Exception in closing connection::: Donwloader > UTIL:::" + ex); > throw new Exception(""); > } > > On Tue, Aug 3, 2010 at 1:09 PM, Pedro Teixeira > wrote: > > > > > Hey, > > > I'm trying to upload a image file. Might be .jpg or .png to my server. > > I found some confusing tutorials which people are doing it in > > different ways. > > Is there any simple or at least clear tutorial for this? > > > Thank you > > > -- > > 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 > cr...@googlegroups.com> > > For more options, visit this group at > >http://groups.google.com/group/android-developers?hl=en -- 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] Store Bitmap in Device, hence creating a file
Hi there, I'm trying to upload an image to a Webserver. The examples I find around mention to send a file that is stored in the device. Does anyone know how to work this around with a Bitmap I got from the internet for example? Instead of a file? Or maybe how to convert a Bitmap to a File, store it on the device, and then send it? Is that possible? Thank you -- 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] Overlay a transparent bitmap on Camera
Hello, I'm passing a bitmap through a bundle to an activity which I called cameraView on which the user has access to the camera of the device. I'd like to overlay that bitmap with transparency using the camera as the background. Is it possible? to put the bitmap in front of the camera? And how can I change the transparency level? Thank you very much Here is my code: This is the camview.xml: http://schemas.android.com/apk/res/android"; android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"> - And this is the java: public class cameraView extends Activity implements SurfaceHolder.Callback{ SurfaceView mSurfaceView; SurfaceHolder mSurfaceHolder; Camera mCamera; boolean mPreviewRunning=false; private Context mContext = this; public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.camview); Bundle f = getIntent().getExtras(); picture = f.getParcelable("bitmap"); mSurfaceView = (SurfaceView) findViewById(R.id.surface_camera); mSurfaceHolder = mSurfaceView.getHolder(); mSurfaceHolder.addCallback(this); mSurfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); } @Override // Create the Surface and Open the Camera public void surfaceCreated(SurfaceHolder holder) { mCamera = Camera.open(); } @Override // Reacts for camera changes public void surfaceChanged(SurfaceHolder holder, int format, int w,int h) { if (mPreviewRunning) { mCamera.stopPreview(); } Camera.Parameters p = mCamera.getParameters(); p.setPreviewSize(w, h); mCamera.setParameters(p); try { mCamera.setPreviewDisplay(holder); } catch (IOException e) { e.printStackTrace(); } mCamera.startPreview(); mPreviewRunning = true; } @Override // When the camera is closed public void surfaceDestroyed(SurfaceHolder holder) { mCamera.stopPreview(); mPreviewRunning = false; mCamera.release(); } // When the picure is taken. This method gives the byte[] of the picture Camera.PictureCallback mPictureCallback = new Camera.PictureCallback() { public void onPictureTaken(byte[] imageData, Camera c) { } }; } -- 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] Overlay a transparent bitmap on Camera
Thank you very much. Worked fine. The setAlpha also worked. At least on the simulator. Ill have to try on the device itself. thanks On Aug 10, 2010, at 6:34 PM, Mark Murphy wrote: On Tue, Aug 10, 2010 at 1:27 PM, Pedro Teixeira wrote: I'm passing a bitmap through a bundle to an activity which I called cameraView on which the user has access to the camera of the device. I'd like to overlay that bitmap with transparency using the camera as the background. Is it possible? to put the bitmap in front of the camera? Put an ImageView in your RelativeLayout, after the SurfaceView, set to the same dimensions (which are rather strange in your current implementation). Then, put the bitmap in the ImageView. Later children in a RelativeLayout stack over top (on the Z axis) of earlier children, so your ImageView will appear over top of the SurfaceView. And how can I change the transparency level? You can try the under-documented setAlpha() on ImageView. If not, you may need to modify the bitmap itself, somehow -- that's not my cup of tea, so I don't have a specific implementation in mind. Bear in mind that compositing the ImageView and the SurfaceView may slow down the frame rate of your camera preview. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android Training...At Your Office: http://commonsware.com/training -- You received this message because you are subscribed to the Google Groups "Android 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 Pedro Teixeira www.pedroteixeira.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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Logging actions
Sorry for the previous post. I actually missed Kostya E-mail in- between all android groups emails. That's just perfect Kostya. It covers exactly what I'm trying to do. I'll digg on that. Sorry again. Greetings On Dec 8, 11:21 pm, TreKing wrote: > On Tue, Dec 7, 2010 at 1:51 AM, Pedro Teixeira > wrote: > > > Help please ... > > Help with what? > > Kostya posted links related to pretty much every point you raised. > > You covered a bunch of different topics and didn't really elaborate on what > specifically you're stuck on. ... so ... again ... help with what? > > --- > -- > TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago > transit tracking app for Android-powered devices -- 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] Logging actions
Hello, I'd like to make a user test with my application. In order to not be following the user or make him write things down I would like to implement some kind of logging system. This logging would be triggered by pressing a button and stopped by taking a picture which are actions that I have already implemented. What I would like to log is just the POSITION and ORIENTATION in between this actions and also the TIME elapsed from one to another.. maybe to a file or some text document. Can anyone help me with this? Or give me a hint on an approach for it? Thank you very much -- 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] Logging actions
Any thoughts on this please? It seems quite easy but every time I search on internet I just find applications that already do this.. I kinda just want to send an email with the gps positions or something close to that.. like write in a txt the coordinates while the user is walking.. Anyway I need the position/orientation and time. On Dec 3, 2010, at 11:30 PM, Pedro Teixeira wrote: > Hello, > > I'd like to make a user test with my application. In order to not be > following the user or make him write things down I would like to > implement some kind of logging system. > This logging would be triggered by pressing a button and stopped by > taking a picture which are actions that I have already implemented. > What I would like to log is just the POSITION and ORIENTATION in > between this actions and also the TIME elapsed from one to another.. > maybe to a file or some text document. > > Can anyone help me with this? Or give me a hint on an approach for it? > > Thank you very much > > -- > 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 Pedro Teixeira Website/Portefolio: www.pedroteixeira.org Facebook: http://www.facebook.com/JosePedroSousaTeixeira -- 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