[android-developers] Re: startActivityforResult does not return any result on Samsung Galaxy
I had some problems with Samsung also, and it is due to getExternalStorageDirectory() . I cant find the link now but I read that Samsung threats the external storage differently so you have to hack your code or create your specific path. This code gives you the right path: try { path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM).getCanonicalPath(); } catch (IOException e) { path=/sdcard/DCIM/; e.printStackTrace(); } if(android.os.Build.DEVICE.contains(Samsung) || android.os.Build.MANUFACTURER.contains(Samsung)){ path = _path + /external_sd/; } On Tuesday, June 12, 2012 5:16:03 PM UTC+2, Tanja Zimmermann wrote: The following Code works for HTC but not on Samsung Galaxy: final Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(getTempFile(this)) ); startActivityForResult(intent, TAKE_PHOTO_CODE); private File getTempFile(Context context){ File path = new File( Environment.getExternalStorageDirectory(), context.getPackageName() ); if(!path.exists()){ path.mkdir(); } return new File(path, image.tmp); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode == RESULT_OK) { switch(requestCode){ case TAKE_PHOTO_CODE: final File file = getTempFile(this); captureBmp = Media.getBitmap(getContentResolver(), Uri.fromFile(file) ); int width = captureBmp.getWidth(); int height = captureBmp.getHeight(); int newWidth = width - ((width*40)/100); int newHeight = height - ((height*40)/100); float scaleWidth = ((float) newWidth) / width; float scaleHeight = ((float) newHeight) / height; Matrix matrix = new Matrix(); matrix.postScale(scaleWidth, scaleHeight); resizedBitmap = Bitmap.createBitmap(captureBmp, 0, 0, width, height, matrix, true); bmd = new BitmapDrawable(resizedBitmap); ImageView iv = (ImageView) findViewById (R.id.iv_foto_beleg); iv.setImageDrawable(bmd); SharedPreferences sharedPreferences = getPreferences(MODE_PRIVA long id = sharedPreferences.getLong(id, 0); break; } } After press saving the camera activity does not turn back to the activity, which launched the it. The picture is not on sdcard. Is there anybody can help? Thanks in advance. Greetings -- 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: Heap Memory and avoiding a crash
Well, it is true there is no fix answer for that problem. I used to have to deal with this exception quite a lot at the beginning. Then I discovered the magic tool memory analysis and cleaned my code. So now, I'm not getting that OutOfMemoryException due to my code. Mostly, what I did was releasing manually all the bitmaps every time my activity went to the background, and being sure to finish the activities I didnt need, specially those with large bitmaps on it. So, yeah, in my opinion, there is no a general solution for this problem but you have to adapt your code and make it clear and simple. On Jun 8, 3:47 pm, Thender thender...@gmail.com wrote: Hi Folks, I'm new, so be gentle. I've been reading all the other posts about OOM and OutOfMemoryException. Its seems I can't discover a good way to deal with impending memory exhaustion, and neither can anyone else. It would be great to confirm that I should stop trying. The essence is that as my code approaches the cliff, I can't find any way to back away from the cliff from within my own code. It seems I am doomed to be pushed over at some point, and will be caught only by the system itself without an opportunity to tell my user what happened. What I observe is that by the time my code has caught an OutOfMemoryError, The VM is being shut down. Thus my plans to inform and gracefully exit are foiled. Is this simply the state of affairs with Java on Android, or am I missing something. Thanks thender.th PS: It is also apparent the the available bits of information about allocated memory cannot be relied upon to keep you away from the edge of the cliff. -- 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] LocationListener Network provider not called
Hi all, I'm facing a really annoying problem. In some point of the program, I need to track the user position. For that I register a listener for all the providers available and request updates. This was working really good until I updated my phone to Android 4.0. But the same code is working perfectly in older versions. Now, the listener is not being called. But only under some conditions: - if i have gps coordinates, this works perfectly ok, even if the gps coordinates are lost, I get also network - but if there is no gps coordinates and there is no wifi signal (but the wifi on the phone is enable), I should be able to get the coordinates using the 3g. Here is were it's not working. If I debug, I can see how the listener is being registered but it is never called. Please, 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] Re: Etends two activity in one class file
you mean extending from two classes into one? That's not possible in Java. Try using interfaces or think again about your structure. If you reached the necessity of extending two classes, I'm pretty sure your structure is not well-orientated. On márc. 27, 08:10, jugni jugni1sm...@gmail.com wrote: Hello all, i have one class file in which i have extends preferenceActivity.now i also want to extends mainactivity because in main activity i have created the menu that menu i need in this preference class.so is it possiblem to extend preferenceactivity and mainactivity within on class file? -- 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: Camera application
Can you provide some logcat or some code? What's the error you get on htc? On Oct 12, 10:29 am, nageswara rao rajana nagu.raj...@gmail.com wrote: Hi, I developed an application on 2.1, i integrated built-in camera app in my application. Its working perfectly on Samsung pop device but not working on HTC mobile. Can any one suggest me what might be the issue. Thanking you, Nagu. -- 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: can i use google maps api for free in my company's inner using android app?
http://code.google.com/android/add-ons/google-apis/maps-overview.html get a debug certificate On Oct 12, 7:28 am, Jimmy Don dongjim...@gmail.com wrote: i am developing an android app for my company . it's for our inner using. can i use google maps api for free? or i need pay to google? -- 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: Open Google Maps with Route In Tab Using Activity
This link may help http://csie-tw.blogspot.com/2009/06/android-driving-direction-route-path.html On Jul 31, 8:40 pm, usafrmajor usafrma...@gmail.com wrote: Great for understanding what is happening. Just wondering if you, or anyone else, knows of any good android code examples on how to overlay the result on a map generated within an application. thanks -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Alert dialog shown but not visible
I have an activity where I start the built-in camera using onActivityResult. After taking a picture, I go back to my application and show a pop up asking to the user if he wants to take more pictures or no. It works fine, but after taking the picture, when I press the save button on the built-in camera app, and inmediatly I press the home button, If I go back to my application, my activity is visible but not active and the popup that should be visible is there but I cannot see it. If I press the back button and cancel the pop up, my activity is active again, but I dont want to allow the user cancelling the pop up, so I set my dialog not cancelable. Now, when this extrange behavior occurs, I cannot use my app, I just have to kill it... The question is, how can I force to the dialog being always on the top if it is shown? Cause seems like it is behind the activity, waiting for the user to interact with it... Thanks! PD: I also posted this question in StackOverflow: http://stackoverflow.com/questions/6858047/alert-dialog-shown-but-not-visible/6858112#comment-8156186 -- 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] restart application after Android's killed it
Hi all! As far as I know, Android kills an application after sometime if the user is not interacting with it, in order to save memory. If the user goes back to the application, the last activity is displayed again. What I would like to do is that when this situations occurs, I always would like to restart from my main activity. But only if my application was killed, not in other scenarios. Is there any way to do that? in the manifest for example? Thanks 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] Re: restart application after Android's killed it
Well, the problem is that when the program is killed, due to android policies or because of an error, sometimes the program is restarted in the last activity that was displayed. In my application, when this happens, I have an error and the program is force to close because I'm missing some data that I dont have if the program is restarted in that activity. So I would like, in that case, to force the program to restart in my main activity. I'm using MVPC (Model view presenter controller), so if Android restarts in the last activity, some data dont exists, that's why I would like to restarts in the main activity. On Jul 20, 3:24 pm, Mark Murphy mmur...@commonsware.com wrote: On Wed, Jul 20, 2011 at 7:02 AM, Fina Perez fina.pere...@gmail.com wrote: As far as I know, Android kills an application after sometime if the user is not interacting with it, in order to save memory. If the user goes back to the application, the last activity is displayed again. That depends on how the user goes back to the application. If they click on the launcher icon, they will go to the launcher activity. If they navigated back to the destroyed activity via the BACK button or something like that, they will go to that specified activity. What I would like to do is that when this situations occurs, I always would like to restart from my main activity. But only if my application was killed, not in other scenarios. Why? -- 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] MapView and terms of service
Hi all! I use the Google API in my app and I have a question about the logo on the map. I don't modify it when I display the map, but If I display the route between two points, I paint two buttons onto the map. One of this buttons is drawn over the logo (left corner on the bottom of the screen) and this button is only visible if I'm displaying a route. Do you think this a violation of the terms of service (http:// code.google.com/apis/maps/terms.html)? Exactly, this point: 9.4 Attribution. (a) Content provided to you through the Service may contain the trade names, trademarks, service marks, logos, domain names, and other distinctive brand features of Google, its partners, or other third party rights holders of content indexed by Google. When Google provides this attribution, you must display it as provided through the Service or as described in the Maps APIs Documentation and may not delete or in any manner alter these trade names, trademarks, service marks, logos, domain names, and other distinctive brand features Thanks -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: MapView and terms of service
Just in case, I moved the buttons to the top of the screen, so the logo is always visible. But, yes...I guess the one with the best answer is a lawyer On Jul 7, 12:16 pm, Mark Murphy mmur...@commonsware.com wrote: This is a fine question to ask your attorney. On Thu, Jul 7, 2011 at 4:18 AM, Fina Perez fina.pere...@gmail.com wrote: Hi all! I use the Google API in my app and I have a question about the logo on the map. I don't modify it when I display the map, but If I display the route between two points, I paint two buttons onto the map. One of this buttons is drawn over the logo (left corner on the bottom of the screen) and this button is only visible if I'm displaying a route. Do you think this a violation of the terms of service (http:// code.google.com/apis/maps/terms.html)? Exactly, this point: 9.4 Attribution. (a) Content provided to you through the Service may contain the trade names, trademarks, service marks, logos, domain names, and other distinctive brand features of Google, its partners, or other third party rights holders of content indexed by Google. When Google provides this attribution, you must display it as provided through the Service or as described in the Maps APIs Documentation and may not delete or in any manner alter these trade names, trademarks, service marks, logos, domain names, and other distinctive brand features Thanks -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- 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] Re: Geocoder nightmare
I had that exception once and it was because I didn't have any connection (network, wifi, gps), but I was testing in a real phone. Do you use the emulator? in that case, seems there is a bug (http:// code.google.com/p/android/issues/detail?id=8816) On Jul 5, 3:42 am, bob b...@coolgroups.com wrote: This is the exception 07-04 20:38:19.969: WARN/System.err(2861): java.io.IOException: Unable to parse response from server 07-04 20:38:19.979: WARN/System.err(2861): at android.location.Geocoder.getFromLocationName(Geocoder.java:159) 07-04 20:38:19.979: WARN/System.err(2861): at com.coolfone.hmm.onCreate(hmm.java:24) 07-04 20:38:19.989: WARN/System.err(2861): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java: 1047) 07-04 20:38:19.989: WARN/System.err(2861): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java: 2627) 07-04 20:38:19.999: WARN/System.err(2861): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java: 2679) 07-04 20:38:19.999: WARN/System.err(2861): at android.app.ActivityThread.access$2300(ActivityThread.java:125) 07-04 20:38:20.009: WARN/System.err(2861): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033) 07-04 20:38:20.009: WARN/System.err(2861): at android.os.Handler.dispatchMessage(Handler.java:99) 07-04 20:38:20.019: WARN/System.err(2861): at android.os.Looper.loop(Looper.java:123) 07-04 20:38:20.019: WARN/System.err(2861): at android.app.ActivityThread.main(ActivityThread.java:4627) 07-04 20:38:20.029: WARN/System.err(2861): at java.lang.reflect.Method.invokeNative(Native Method) 07-04 20:38:20.029: WARN/System.err(2861): at java.lang.reflect.Method.invoke(Method.java:521) 07-04 20:38:20.029: WARN/System.err(2861): at com.android.internal.os.ZygoteInit $MethodAndArgsCaller.run(ZygoteInit.java:860) 07-04 20:38:20.039: WARN/System.err(2861): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) 07-04 20:38:20.039: WARN/System.err(2861): at dalvik.system.NativeStart.main(Native Method) Here's what I read about 7 and 8 http://s1190.photobucket.com/albums/z449/m75214/?action=viewcurrent=... On Jul 4, 9:43 am, Fina Perez fina.pere...@gmail.com wrote: which exception do you have? And about the thing with the AVD 7 and 8, I use 8 and for me it works. Of course, check the manifest and the internet connection. On Jul 3, 9:56 pm, bob b...@coolgroups.com wrote: Yes, I did this. I read in a book that geocoding doesn't work in AVD 7 and 8. It said to use AVD 6. I'm going to try AVD 6 in a bit. On Jul 3, 1:53 am, Ali Chousein ali.chous...@gmail.com wrote: Your code should work without problems. I use very similar code in my application and it just works. ForGeocoderyou need to set android.permission.INTERNET in your manifest file. Did you do this? -- Ali Chousein Geo-Filtered Assistanthttp://geo-filtered-assistant.blogspot.com/ On Jul 2, 6:53 pm, bob b...@coolgroups.com wrote: I've been playing around withGeocoderstuff, and it is anightmare. Nothing works. Is there any version of the emulator where this code does not give a weird exception? import java.io.IOException; import java.util.List; import android.app.Activity; import android.location.Address; import android.location.Geocoder; import android.os.Bundle; public class hmm extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); boolean ok=Geocoder.isPresent(); finalGeocodergeocoder= newGeocoder(this); final String locName = 1600 Amphitheatre Parkway, Mountain View, CA; try { final ListAddress list =geocoder.getFromLocationName(locName, 1); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } -- 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: Calculate Distance like GoogleMap
Hi, you can get a kml file from google maps, parse it onto your application and paint the result in the map. Check the links below: http://csie-tw.blogspot.com/2009/06/android-driving-direction-route-path.html http://stackoverflow.com/questions/3109158/how-to-draw-a-path-on-a-map-using-kml-file On Jul 4, 2:56 pm, TreKing treking...@gmail.com wrote: On Fri, Jul 1, 2011 at 5:37 AM, Kubilay D. Yılmaz kubilayd.yil...@gmail.com wrote: I want to get results over road.(like google map) How can I handle this on android? There's nothing built-in to Android for this, AFAIK. - 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] Re: Geocoder nightmare
which exception do you have? And about the thing with the AVD 7 and 8, I use 8 and for me it works. Of course, check the manifest and the internet connection. On Jul 3, 9:56 pm, bob b...@coolgroups.com wrote: Yes, I did this. I read in a book that geocoding doesn't work in AVD 7 and 8. It said to use AVD 6. I'm going to try AVD 6 in a bit. On Jul 3, 1:53 am, Ali Chousein ali.chous...@gmail.com wrote: Your code should work without problems. I use very similar code in my application and it just works. For Geocoder you need to set android.permission.INTERNET in your manifest file. Did you do this? -- Ali Chousein Geo-Filtered Assistanthttp://geo-filtered-assistant.blogspot.com/ On Jul 2, 6:53 pm, bob b...@coolgroups.com wrote: I've been playing around with Geocoder stuff, and it is a nightmare. Nothing works. Is there any version of the emulator where this code does not give a weird exception? import java.io.IOException; import java.util.List; import android.app.Activity; import android.location.Address; import android.location.Geocoder; import android.os.Bundle; public class hmm extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); boolean ok=Geocoder.isPresent(); final Geocoder geocoder = new Geocoder(this); final String locName = 1600 Amphitheatre Parkway, Mountain View, CA; try { final ListAddress list = geocoder.getFromLocationName(locName, 1); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } -- 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: Camera bitmap too small
Hi! If you are using the same intent and if you dont specify any new place to save the pictures, they will be automatically saved by default in the same place that the camera usually uses and they will appear automatically in the gallery app, so you dont need to do anything special. About the permissions, to use the camera you need this: uses- permission android:name=android.permission.CAMERA /, and I think that's all. Let me know if you have any problem. On Jun 15, 7:08 pm, J Handal jhand...@gmail.com wrote: Hi Fina, I'm using t also he built-in camera app in my Xoom,tryng to store the picture in the AppGallery that comes by default. same intent : new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); Something to with permissions? THX -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Camera bitmap too small
Hi! If you are using the same intent and if you dont specify any new place to save the pictures, they will be automatically saved by default in the same place that the camera usually uses and they will appear automatically in the gallery app, so you dont need to do anything special. About the permissions, to use the camera you need this: uses- permission android:name=android.permission.CAMERA /, and I think that's all. Let me know if you have any problem. On Jun 15, 7:08 pm, J Handal jhand...@gmail.com wrote: Hi Fina, I'm using t also he built-in camera app in my Xoom,tryng to store the picture in the AppGallery that comes by default. same intent : new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); Something to with permissions? THX -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Camera bitmap too small
Thanks for your reply. I tried to get the Uri but I'm facing the same problem I had a few months ago. In the Samsung, when I try to get Uri, the result is null... I really have no idea how to get the uri from this device. This is my intent: Intent camara = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); and on onActivityResult(...) I did : Uri picUri = data.getData(); //data is the intent I have as a parameter in the method. but picUri is null in the samsung. Any ideas? On Jun 14, 3:18 pm, Streets Of Boston flyingdutc...@gmail.com wrote: Instead of getting the raw (but very small) bitmap data, get the Uri of the (full-sized) bitmap instead. The Uri is part of the result of an ACTION_PICK intent, if i'm not mistaken. Then, given the Uri, read the full bitmap data yourself. -- 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] Camera bitmap too small
Hi all! I'm using the built-in camera app and in every phone I test it, I receive a bitmap really small (for example, samsung galaxy mini: 256x192, htc wildfire: 324x244). How can I get the picture in the real size? I searched in Google but nothing seems to be clear, some people says it is a bug. Any idea? Thanks a lot! -- 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] Adding a bookmark different behavior on Galaxy S
Hi all! I wanted to add a bookmark to the default browser of the phone from my app with an url where the client can download an app. So the url ends with .../myApp.apk It's working perfect in almost all the devices except in the Samsung. I have to add an/ after .apk to make the bookmark visible in the browser. Without this character, was being added properly to list of bookmarks but you couldn't see it in the browser. But, of course, with this character, the url is not working. And as I said, this only happens in the Galaxy S (I guess in the rest of samsungs too...) Any idea why it's happens? and how can I make it works in the samsung too? Thanks! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: onRestart from Home button or from back button
Thanks for your replies, I'll let you know which one works On Jun 2, 5:03 am, albnok alb...@gmail.com wrote: Have Activity B call Activity C using startActivityOnResult(intent, requestCode), override Activity C's onBackPressed to pass a kill flag via intent and setResult. In Activity B override onActivityResult and see if the kill flag is there and the request code matches then call finish(). So pressing back in C will go to A. On May 30, 3:22 pm, Fina Perez fina.pere...@gmail.com wrote: Hi! I thought to use that, but I'm not sure if it's going to work. The thing is sometimes I break the normal flow between activities, I mean, from activity A I start activity B, and from B, C. But when I finish activity C, I go back to the activity A, so I really dont know if onStartActivityForResult waits for the result of the activity it launched or just for a result. On May 26, 7:56 pm, TreKing treking...@gmail.com wrote: On Thu, May 26, 2011 at 3:44 AM, Fina Perez fina.pere...@gmail.com wrote: when I press the back button and navigate from one activity to the previous one inside my app. In this case, I dont need to check anything, but I really dont know who to handle this situation. any ideas? http://developer.android.com/reference/android/app/Activity.html#star..., int)http://developer.android.com/reference/android/app/Activity.html#onAc..., int, android.content.Intent) --- -- 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] Re: onRestart from Home button or from back button
I'm using the MVC model, I mean I have activities, presenters and controllers. And activity can have difererent presenters, and can be started from different points of the flow. And the controller decides which presenter has the control, so if a presenter loses it, finishes the activity and go back to the controller that was handling him. That's how I do that. On May 30, 8:43 pm, TreKing treking...@gmail.com wrote: On Mon, May 30, 2011 at 2:22 AM, Fina Perez fina.pere...@gmail.com wrote: The thing is sometimes I break the normal flow between activities, I mean, from activity A I start activity B, and from B, C. But when I finish activity C, I go back to the activity A How do you do that? - 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] Re: onRestart from Home button or from back button
Hi! I thought to use that, but I'm not sure if it's going to work. The thing is sometimes I break the normal flow between activities, I mean, from activity A I start activity B, and from B, C. But when I finish activity C, I go back to the activity A, so I really dont know if onStartActivityForResult waits for the result of the activity it launched or just for a result. On May 26, 7:56 pm, TreKing treking...@gmail.com wrote: On Thu, May 26, 2011 at 3:44 AM, Fina Perez fina.pere...@gmail.com wrote: when I press the back button and navigate from one activity to the previous one inside my app. In this case, I dont need to check anything, but I really dont know who to handle this situation. any ideas? http://developer.android.com/reference/android/app/Activity.html#star..., int)http://developer.android.com/reference/android/app/Activity.html#onAc..., int, android.content.Intent) - 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] onRestart from Home button or from back button
Hi! I need to handle in someway if my activity is being restarted after pressing the home button or is it just happend thanks to the back button. The scenario is as follow: Everytime I go out from my app and then go back, I have to make some security checks. So I override the onRestart() method, but this method is also call when I press the back button and navigate from one activity to the previous one inside my app. In this case, I dont need to check anything, but I really dont know who to handle this situation. any ideas? -- 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: Built-in camera problem deleting files
hey, thanks for your options. At the end, as a temporal solution I'm just running the media scanner when I exit my application. It is not the best option, but it's the only one that works in every device I can test in. I tried the option you said using ContentResolver, but it didn't work on the Galaxy S. If I can fix it, I'll post the solution. Thanks!! On Apr 27, 9:16 am, Liang Wang mr.lia...@gmail.com wrote: Sorry, I thought you saved one file to SD card by yourself but the file was media-scanned. Things seems to be that you can get the bitmap from Camera but camera always save a copy into MediaStore. So you can see it in Gallery. I think there are two options: 1. Leave it alone. Since user capture the image using Camera, it is normal that the user can see it in Gallery. 2. I don't know how you implement _helper.deleteFiles(). Seems you have got the file path. You can try to use ContentResolver.delete(android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI, ...) to match and delete that record. Or you can query that record firstly then delete it using ContentResolver.delete(). On Tue, Apr 26, 2011 at 9:39 PM, Fina Perez fina.pere...@gmail.com wrote: Sorry for my really bad explanation, this problem drives me up the wall... The situation is: from my app, I call Camera application, take a picture and go back to my app. So, I do as follows: Intent camara = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(camara, CAMERA_PIC_REQUEST); Then, when I go back to my app, I handle the picture: protected void onActivityResult(int requestCode, int resultCode, Intent data) { if(requestCode == CAMERA_PIC_REQUEST) { if(data == null) { //do some stuff, }else { //get the bitmap Bitmap myPicture = (Bitmap)data.getExtras().get(data); //save the bitmap _pictures.add(myPicture); //and delete the picture from the device _helper.deleteFiles(); //this method, delete the picture from the sdcard _helper = null; //in the gallery app, remains a picture or thumbnail of the picture I've just taken, and //here is where I have the problem, because I cannot find a good solution to delete or clean //the gallery. //I'll write my options below } } } So, the things I tried are: 1) //This option doesn't work on some devices like the galaxy S (I don't know why) Uri uri = data.getData(); getContentResolver().delete(uri, null, null); 2) //This option works but launch the mediaScanner, and makes some devices (like the galaxy S) really slow, so I'm trying // to avoid this option: sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse(file:// + Environment.getExternalStorageDirectory(; 3) //This option tries to change the directory, but I think I'm missing something, because the pictures are displayed in the gallery app (and i don't want that) //Where I launch the camera, I wrote: _path = Environment.getExternalStorageDirectory()+/ tempPictures/.nomedia; File file = new File(_path); Uri uri = Uri.fromFile( file ); Intent camara = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); camara.putExtra( MediaStore.EXTRA_OUTPUT, uri); startActivityForResult(camara, CAMERA_PIC_REQUEST); 4) I tried to do what Liang proposed: You can let camera return bitmap data, then you handle the data by yourself. There is no file saved this way. I did using Intent.#setType(String) but It never worked. So, what am I missing? what am I doing wrong? Thanks for reading and helping! On Apr 26, 2:26 pm, Liang Wang mr.lia...@gmail.com wrote: 1. For first option, if you provide more details , that will be helpful. 2. For second option. It will be better if you store the file into a directory in sd card instead of root directory. For example: in /sdcard/TempDir/, there are two files .nomedia (empty file, to stop media scanner) youfile.jpg (you specified file) 3. Maybe camera saved another image that can be seen in gallery beside saving to your file. If this is true, you can delete your file safely with .nomedia protection. It will not influence the gallery. Hope these are helpful. But camera implementation of different phones may
[android-developers] Re: Mapactivity
check the manifest, to see if you have the library and the mapactivity there. But as Mark says, look at the stack treace in the logcat, it's really helpful On Apr 28, 1:42 pm, Mark Murphy mmur...@commonsware.com wrote: On Thu, Apr 28, 2011 at 7:30 AM, kaushik p kaushiks...@gmail.com wrote: I have almost gone through all the pages on web to get information on intent mapactivity , i have not found anything that solves my problem . Does anyone know about it ?any help is greatly appreciated Use adb logcat, DDMS, or the DDMS perspective in Eclipse to examine LogCat and look at the stack trace associated with your force close. Then, fix the bug(s). -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy Warescription: Three Android Books, Plus Updates, One Low Price! -- 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: Built-in camera problem deleting files
Hi Liang! thanks a lot for your answer. I was trying the first option but I'm having problems to tell the camera that I want a bitmap. I tryed to use the method Inteng.#setType(String) but I got an exception And I don't know where the code you wrote comes from, I mean Is that the way to ask for a bitmap object as result? I thought it was more intuitive hehehe On Apr 22, 11:56 am, Liang Wang mr.lia...@gmail.com wrote: 1. You can let camera return bitmap data, then you handle the data by yourself. There is no file saved this way. 2. If you let camera save the image to file in a specified directory(through provider), making a empty file named .nomedia in that directory can prevent mediascanner from scanning it. This way this image will not appear in gallery. See the code below in Camera: if (mSaveUri != null) { OutputStream outputStream = null; try { outputStream = mContentResolver.openOutputStream(mSaveUri); outputStream.write(data); outputStream.close(); setResult(RESULT_OK); finish(); } catch (IOException ex) { // ignore exception } finally { Util.closeSilently(outputStream); } } else { Bitmap bitmap = createCaptureBitmap(data); setResult(RESULT_OK, new Intent(inline-data).putExtra(data, bitmap)); finish(); } On Fri, Apr 22, 2011 at 4:51 PM, Fina Perez fina.pere...@gmail.com wrote: Hi! I answer myself: maybe is not the best solution but after deleting the file, this is what I do: sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse(file:// + Environment.getExternalStorageDirectory(; we need to add this to the manifest: intent-filter action android:name=android.intent.action.MEDIA_MOUNTED / data android:scheme=file / /intent-filter (I found the solution here: http://stackoverflow.com/questions/4430888/android-file-delete-leaves... ) On Apr 21, 11:32 am, Fina Perez fina.pere...@gmail.com wrote: Hi all! I'm using the built-in camera in my app to take a picture and to save it in a database. So, from my activity, I launch the camera, take a picture and go back to the activity (thanks to onActivityResult method). Here, I store the picture in the database and I delete it from the phone. Seems to be working properly: the picture is being deleted from the sdcard but if you go to the gallery app that comes with the device, the picture is being displayed but as a wrong file, so you can see that there is/was a picture there but you can't open it or even see the preview. But I can delete it from the gallery app manually (selecting them and then deleting). How can i do this programatically? Thanks a lot! I really need help with this -- 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
[android-developers] Re: Built-in camera problem deleting files
Hi, that's what I'm using now, because I cannot make the first option runs. But I'm having problems with the second option too.. _path = Environment.getExternalStorageDirectory() + .nomedia; Intent camara = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); File file = new File(_path); Uri uri = Uri.fromFile(file); camara.putExtra(MediaStore.EXTRA_OUTPUT, uri); startActivityForResult(camara, CAMERA_PIC_REQUEST); this is the code I'm using to hide the pictures I take with the camera, but they still appear in the Gallery app, which is what I want to avoid. And I want to avoid the mediascanner runs too... Please, please, help! On Apr 26, 10:28 am, Liang Wang mr.lia...@gmail.com wrote: Hi Fina, I think below code will work: Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(intent, ...); Then you can handle the bitmap in onActivityResult(). The code you mentioned is from android built-in Camera application. There you can see how camera app give result to you. From that you can get how to handle the result. On Tue, Apr 26, 2011 at 3:51 PM, Fina Perez fina.pere...@gmail.com wrote: Hi Liang! thanks a lot for your answer. I was trying the first option but I'm having problems to tell the camera that I want a bitmap. I tryed to use the method Inteng.#setType(String) but I got an exception And I don't know where the code you wrote comes from, I mean Is that the way to ask for a bitmap object as result? I thought it was more intuitive hehehe On Apr 22, 11:56 am, Liang Wang mr.lia...@gmail.com wrote: 1. You can let camera return bitmap data, then you handle the data by yourself. There is no file saved this way. 2. If you let camera save the image to file in a specified directory(through provider), making a empty file named .nomedia in that directory can prevent mediascanner from scanning it. This way this image will not appear in gallery. See the code below in Camera: if (mSaveUri != null) { OutputStream outputStream = null; try { outputStream = mContentResolver.openOutputStream(mSaveUri); outputStream.write(data); outputStream.close(); setResult(RESULT_OK); finish(); } catch (IOException ex) { // ignore exception } finally { Util.closeSilently(outputStream); } } else { Bitmap bitmap = createCaptureBitmap(data); setResult(RESULT_OK, new Intent(inline-data).putExtra(data, bitmap)); finish(); } On Fri, Apr 22, 2011 at 4:51 PM, Fina Perez fina.pere...@gmail.com wrote: Hi! I answer myself: maybe is not the best solution but after deleting the file, this is what I do: sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse(file:// + Environment.getExternalStorageDirectory(; we need to add this to the manifest: intent-filter action android:name=android.intent.action.MEDIA_MOUNTED / data android:scheme=file / /intent-filter (I found the solution here: http://stackoverflow.com/questions/4430888/android-file-delete-leaves. .. ) On Apr 21, 11:32 am, Fina Perez fina.pere...@gmail.com wrote: Hi all! I'm using the built-in camera in my app to take a picture and to save it in a database. So, from my activity, I launch the camera, take a picture and go back to the activity (thanks to onActivityResult method). Here, I store the picture in the database and I delete it from the phone. Seems to be working properly: the picture is being deleted from the sdcard but if you go to the gallery app that comes with the device, the picture is being displayed but as a wrong file, so you can see that there is/was a picture there but you can't open it or even see the preview. But I can delete it from the gallery app manually (selecting them and then deleting). How can i do this programatically? Thanks a lot! I really need help with this -- 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
[android-developers] Re: Built-in camera problem deleting files
I read about Mediastore functions, and the one that I thought it could fit is for API 9, and I'm developing for api 8... Seriously, it's seems to be a really stupid problem but I can't do it work! On Apr 26, 1:11 pm, lbendlin l...@bendlin.us wrote: I believe you have to use Mediastore functions to remove the file, rather than deleting it manually from the SD card. The Mediastore has caching mechanisms that will keep references to files independently of their physical presence. Yes, you could force a re-scan but that seems like overkill. -- 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: Built-in camera problem deleting files
Sorry for my really bad explanation, this problem drives me up the wall... The situation is: from my app, I call Camera application, take a picture and go back to my app. So, I do as follows: Intent camara = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(camara, CAMERA_PIC_REQUEST); Then, when I go back to my app, I handle the picture: protected void onActivityResult(int requestCode, int resultCode, Intent data) { if(requestCode == CAMERA_PIC_REQUEST) { if(data == null) { //do some stuff, }else { //get the bitmap Bitmap myPicture = (Bitmap)data.getExtras().get(data); //save the bitmap _pictures.add(myPicture); //and delete the picture from the device _helper.deleteFiles(); //this method, delete the picture from the sdcard _helper = null; //in the gallery app, remains a picture or thumbnail of the picture I've just taken, and //here is where I have the problem, because I cannot find a good solution to delete or clean //the gallery. //I'll write my options below } } } So, the things I tried are: 1) //This option doesn't work on some devices like the galaxy S (I don't know why) Uri uri = data.getData(); getContentResolver().delete(uri, null, null); 2) //This option works but launch the mediaScanner, and makes some devices (like the galaxy S) really slow, so I'm trying // to avoid this option: sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse(file:// + Environment.getExternalStorageDirectory(; 3) //This option tries to change the directory, but I think I'm missing something, because the pictures are displayed in the gallery app (and i don't want that) //Where I launch the camera, I wrote: _path = Environment.getExternalStorageDirectory()+/ tempPictures/.nomedia; File file = new File(_path); Uri uri = Uri.fromFile( file ); Intent camara = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); camara.putExtra( MediaStore.EXTRA_OUTPUT, uri); startActivityForResult(camara, CAMERA_PIC_REQUEST); 4) I tried to do what Liang proposed: You can let camera return bitmap data, then you handle the data by yourself. There is no file saved this way. I did using Intent.#setType(String) but It never worked. So, what am I missing? what am I doing wrong? Thanks for reading and helping! On Apr 26, 2:26 pm, Liang Wang mr.lia...@gmail.com wrote: 1. For first option, if you provide more details , that will be helpful. 2. For second option. It will be better if you store the file into a directory in sd card instead of root directory. For example: in /sdcard/TempDir/, there are two files .nomedia (empty file, to stop media scanner) youfile.jpg (you specified file) 3. Maybe camera saved another image that can be seen in gallery beside saving to your file. If this is true, you can delete your file safely with .nomedia protection. It will not influence the gallery. Hope these are helpful. But camera implementation of different phones may differ. I'm not sure if above can work. On Tue, Apr 26, 2011 at 6:42 PM, Fina Perez fina.pere...@gmail.com wrote: Hi, that's what I'm using now, because I cannot make the first option runs. But I'm having problems with the second option too.. _path = Environment.getExternalStorageDirectory() + .nomedia; Intent camara = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); File file = new File(_path); Uri uri = Uri.fromFile(file); camara.putExtra(MediaStore.EXTRA_OUTPUT, uri); startActivityForResult(camara, CAMERA_PIC_REQUEST); this is the code I'm using to hide the pictures I take with the camera, but they still appear in the Gallery app, which is what I want to avoid. And I want to avoid the mediascanner runs too... Please, please, help! On Apr 26, 10:28 am, Liang Wang mr.lia...@gmail.com wrote: Hi Fina, I think below code will work: Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(intent, ...); Then you can handle the bitmap in onActivityResult(). The code you mentioned is from android built-in Camera application. There you can see how camera app give result to you. From that you can get how to handle the result. On Tue, Apr 26, 2011 at 3:51 PM, Fina Perez fina.pere...@gmail.com wrote
[android-developers] Re: Built-in camera problem deleting files
Hi! I answer myself: maybe is not the best solution but after deleting the file, this is what I do: sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse(file:// + Environment.getExternalStorageDirectory(; we need to add this to the manifest: intent-filter action android:name=android.intent.action.MEDIA_MOUNTED / data android:scheme=file / /intent-filter (I found the solution here: http://stackoverflow.com/questions/4430888/android-file-delete-leaves-empty-placeholder-in-gallery) On Apr 21, 11:32 am, Fina Perez fina.pere...@gmail.com wrote: Hi all! I'm using the built-in camera in my app to take a picture and to save it in a database. So, from my activity, I launch the camera, take a picture and go back to the activity (thanks to onActivityResult method). Here, I store the picture in the database and I delete it from the phone. Seems to be working properly: the picture is being deleted from the sdcard but if you go to the gallery app that comes with the device, the picture is being displayed but as a wrong file, so you can see that there is/was a picture there but you can't open it or even see the preview. But I can delete it from the gallery app manually (selecting them and then deleting). How can i do this programatically? Thanks a lot! I really need help with this -- 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] Built-in camera problem deleting files
Hi all! I'm using the built-in camera in my app to take a picture and to save it in a database. So, from my activity, I launch the camera, take a picture and go back to the activity (thanks to onActivityResult method). Here, I store the picture in the database and I delete it from the phone. Seems to be working properly: the picture is being deleted from the sdcard but if you go to the gallery app that comes with the device, the picture is being displayed but as a wrong file, so you can see that there is/was a picture there but you can't open it or even see the preview. But I can delete it from the gallery app manually (selecting them and then deleting). How can i do this programatically? Thanks a lot! I really need help with this -- 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: move view on touch
In this link http://blahti.wordpress.com/2011/02/10/moving-views-part-3/ you will have a really good tutorial about that. On Apr 11, 1:35 pm, Y@g*E!s^H SARKAR yog16pa...@gmail.com wrote: i am using android-2.1, is it possible to move one view over other view with finger touch on one screen? i am using framelayout as parent and linearlayout(which i want to move over screen) as child. which layout should i use for 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 For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: draw text with html format inside a rectangle
Thanks a lot Kostya, that helped so much! DynamicLayout was what I need, and now it is working. And lbendin, your list is really usefull too, thanks! On Mar 19, 8:11 pm, Kostya Vasilyev kmans...@gmail.com wrote: Fina, TextView draws text using this: http://developer.android.com/reference/android/text/Layout.html - note the draw() method Specifically, it uses this subclass, which may be only necessary for editing (not just drawing): http://developer.android.com/reference/android/text/DynamicLayout.html Layout.draw() already handles drawing text that may consist of multiple Spannable objects, that's what actually provides support for various HTML tags, as listed by lbendin. It should be possible to use android.text.Layout in your own code. Look at TextView source to see how it can be instantiated and how to make it draw() itself. -- Kostya 19.03.2011 21:50, lbendlin пишет: I thought you are using a textview. I don't know if the canvas actually supports it. do something like myTextView.setText(Html.fromHtml(myHtmlString)) by the way, I found the list of supported tags: •br •p •div •em •b •strong •cite •dfn •i •big •small •font •blockquote •tt •monospace •a •u •sup •sub On Mar 19, 9:09 am, Fina Perezfina.pere...@gmail.com wrote: Hi! Thanks for your answer. For my purpose, I just need the tags you mentioned. The problem is that when I send the text to the rectangle, it loose the format. I do something like: CharSequence myString; //it has for examplebHello/b world //I dont know if this is correct myString = Html.fromHtml(myString); //and now I paint the text canvas.drawText(myString,...); But this isn't working, and I can't use a webView(or even a textView) because I paint my view manually, with canvas and rectangles...I don't know if there is a way to paint a textView, for example, in a BitMap. On Mar 19, 1:18 pm, lbendlinl...@bendlin.us wrote: While it is possible, it is also very limited. Only a few HTML tags are honoured, like smaller/bigger, bold etc. I think that even for this little functionality you will spend a whole HTML rendering engine in memory, and that's just not worth it. If you must, use a webview. On Mar 18, 11:55 am, Fina Perezfina.pere...@gmail.com wrote: Hi!! I'm trying to paint a rectangle, and inside it, put some text which is html-format (sorry for my english, it is so bad ) I use CharSequence (because this supports html) instead of String, and I call drawText with those parameters, but the format isn't painted. Any idea? is it possible? Thanks a lot!- Hide quoted text - - Show quoted text - -- Kostya Vasilyev --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
[android-developers] Re: draw text with html format inside a rectangle
Hi! Thanks for your answer. For my purpose, I just need the tags you mentioned. The problem is that when I send the text to the rectangle, it loose the format. I do something like: CharSequence myString; //it has for example bHello/b world //I dont know if this is correct myString = Html.fromHtml(myString); //and now I paint the text canvas.drawText(myString,...); But this isn't working, and I can't use a webView(or even a textView) because I paint my view manually, with canvas and rectangles...I don't know if there is a way to paint a textView, for example, in a BitMap. On Mar 19, 1:18 pm, lbendlin l...@bendlin.us wrote: While it is possible, it is also very limited. Only a few HTML tags are honoured, like smaller/bigger, bold etc. I think that even for this little functionality you will spend a whole HTML rendering engine in memory, and that's just not worth it. If you must, use a webview. On Mar 18, 11:55 am, Fina Perez fina.pere...@gmail.com wrote: Hi!! I'm trying to paint a rectangle, and inside it, put some text which is html-format (sorry for my english, it is so bad ) I use CharSequence (because this supports html) instead of String, and I call drawText with those parameters, but the format isn't painted. Any idea? is it possible? Thanks a lot! -- 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: onItemLongClick and onItemClick for a gridview
Hi! I haven't seen your code, but have you tried using a GestureDetector? (see http://developer.android.com/reference/android/view/GestureDetector.OnGestureListener.html) Using the method onTouchEvent + a gestureDetector, you can be able of detecting a simple click, a long click, or even a fling, so you can implement the drag and drop easily. On Mar 18, 10:15 am, varinag gold varinagg...@gmail.com wrote: Below is the code: OnItemClickListener listener1 = new OnItemClickListener() { @Override public void onItemClick(AdapterView? parent, View view, int position, long id) { Log.d(TAG1, OnItemClickListener); final String message = OnTouchGrid:Icon No. + id+ is Touched.; Toast.makeText(myCardList.this, message, Toast.LENGTH_SHORT).show(); } }; mGrid.setClickable(true); mGrid.setOnItemClickListener(listener1); OnItemLongClickListener listener2 = new OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView? parent, View view, int position, long id) { Log.i(TAG1, OnItemLongClickListener); final String message = OnLongTouchGrid:Icon No. + id + is Touched.; Toast.makeText(myCardList.this, message, Toast.LENGTH_SHORT).show(); return true; } }; mGrid.setLongClickable(true); mGrid.setOnItemLongClickListener(listener2); Here is what I tried but found its not working when I implement both onItemClickListener and onItemClickLongListener then only onItemClickLongListener works and onItemClickListener doesn't work. If I just implement onItemClickListener it works but with onItemClickListener. Any Idea? Regards, varinag On Mar 17, 12:55 pm, Kostya Vasilyev kmans...@gmail.com wrote: There is a long item click listener in grid view - you do know that, right? 17.03.2011 4:30 пользователь varinag gold varinagg...@gmail.com написал: I want to activate a drag and drop function once a user long press the GridView items. I am not sure if OnCreateContextMenuListener and handle it straightforwardly. Thanks, Varinag On Mar 17, 1:20 am, Justin Anderson magouyaw...@gmail.com wrote: Are you just wanting to display a context menu with the long press? If so you can implement OnCreateContextMenuListener and use setOnCreateContextMenuListener() http://developer.android.com/reference/android/view/View.html#setOnCr... Thanks, Justin Anderson MagouyaWare Developerhttp://sites.google.com/site/magouyaware On Wed, Mar 16, 2011 at 12:41 AM, varinag gold varinagg...@gmail.com wrote: Any one? On Mar 15, 4:38 pm, varinag gold varinagg...@gmail.com wrote: Hello, For a gridview I am able to set the onItemClick and it works fine but I don't know how should I implement onItemLongClick so that I can get both type of responses from a gridview items. I googled but could'n get an understandable code where both have been implemented properly. Please respond if you have done it . Regards, varinag -- 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 -- 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] draw text with html format inside a rectangle
Hi!! I'm trying to paint a rectangle, and inside it, put some text which is html-format (sorry for my english, it is so bad ) I use CharSequence (because this supports html) instead of String, and I call drawText with those parameters, but the format isn't painted. Any idea? is it possible? Thanks a lot! -- 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] drag an object from a view and drop in another view in a viewSwitcher
Hi! I have implemented something similar to an agenda. I'm using a viewSwitcher to move between different days. At this moment, I'm able to move a task to a different hour in the same day but If I try to change the day by dragging, the day switch correctly but the object I'm moving reminds in the first view. I can draw it again in the new view but, If I do, I lose the movement, I mean, although I haven't release the finger, the object doesn't move in the new view. I hope that what I'm trying to do it is not impossible. I'm working with Android 2.2. Any tip? Thanks in advance! PS: I'm so sorry, my english is a mess! -- 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