[android-developers] Re: Saving Data on External Storage
Hello, I am able to write on the external storage (sdcard) but I am not able to write on the secondary storage ( external sd card) which is microsd or usb devices. Did you have a solution for this? Il giorno domenica 3 luglio 2016 06:10:25 UTC+2, gjs ha scritto: > > See https://developer.android.com/training/basics/data-storage/files.html > and > https://developer.android.com/reference/android/content/Context.html#getExternalFilesDir(java.lang.String) > > On Friday, July 1, 2016 at 11:35:27 PM UTC+10, Paolo Turatti wrote: >> >> Hello everybody! >> >> I am not able to save data from my appication (in my case video or >> picture) on the external sdcard) I think it is related to the write >> permission introduced with android 4.4. >> I am able to write data on the /sdcard whitout problem, but if the device >> has an external sd card i get the "permission denied" error. >> How is it possbile to save data on this memories? >> >> Thank you! >> > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. To post to this group, send email to android-developers@googlegroups.com. Visit this group at https://groups.google.com/group/android-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/android-developers/8e0b-95af-4c08-a527-97fe45cb1165%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[android-developers] Re: Access Problem External SD-Card Android 6.01
Hello, did you check your app permissions? In Android 6 many things have changed on permissions, go under android settings, applications, select you app, select rights, give the applications the right to read and write external storage, then on the top right corner, all permissions. Open you app again and check if it is working. Il giorno lunedì 20 giugno 2016 19:38:15 UTC+2, Susanne ha scritto: > > I am very deperate: After my Samsung Galaxy Note 4 updated to Android > 6.0.1., my application (written in Java - Android Studio and running since > Android 3.3) no longer can access data on the external sd-card. > > I manage to address internal sd-card via "System.getenv( > "EXTERNAL_STORAGE")" but alas on the web so far I found no path working > with the external sd-card. > > Of course I have no problem to read/write external sd-card via > file-explorer. > > I would be very grateful for any help, > thanks a lot in advance > Susanne > > > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. To post to this group, send email to android-developers@googlegroups.com. Visit this group at https://groups.google.com/group/android-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/android-developers/f8b1fafd-e58c-42f2-8e69-efca9ddf972f%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[android-developers] Saving Data on External Storage
Hello everybody! I am not able to save data from my appication (in my case video or picture) on the external sdcard) I think it is related to the write permission introduced with android 4.4. I am able to write data on the /sdcard whitout problem, but if the device has an external sd card i get the "permission denied" error. How is it possbile to save data on this memories? Thank you! -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. To post to this group, send email to android-developers@googlegroups.com. Visit this group at https://groups.google.com/group/android-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/android-developers/407f29c3-c613-4dc2-b7f8-86f18c6e5590%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[android-developers] FileChooser
I'm really sorry, but I have find nothing that explains also with examples download how to do a FileChooser for the last Android technology. Can and want you help me??? -- -- You received this message because you are subscribed to the Google 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 unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [android-developers] Unsubscribe
For those still encountering this issue, I resolved it adding the flag http://developer.android.com/reference/android/content/Intent.html#FLAG_RECEIVER_FOREGROUND to the broadcast pending intent, this doesn't force the service to get restarted. Paolo On Sunday, August 12, 2012 9:35:34 PM UTC-7, dnk wrote: I am interested too. On Saturday, August 11, 2012 4:06:19 PM UTC-7, Andy dev wrote: Dianne, did you have any luck with that sample APK and reproducing the issue? Thanks On Friday, July 27, 2012 12:47:17 PM UTC+1, Kostya Vasilyev wrote: 2012/7/27 Jim Graham spook...@gmail.com On Thu, Jul 26, 2012 at 10:35:18PM -0700, Andy dev wrote: Anyone made any progress with this issue, I still cannot pinpoint what causes it? It's like life after death - no-one who knows for sure is able to share his knowledge :) It's nothing new...e-mail lists have been plagued with unsubscribe requests sent to the list despite very specific instructions given to users of the list since the day they signed up. As to why people do that, I'm going to be nice and not answer that part. Another mystery in the same category: a refund request for an in-app purchase from a user claming he didn't buy it (and no, neither he or his phone is being held captive). Later, --jim -- You received this message because you are subscribed to the Google 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: Jelly Bean Speech Recognition API (local ASR)
Me too. Hope to have a reply soon Thanks/Regards martin.p Il giorno domenica 16 settembre 2012 06:55:35 UTC+2, Kevin Claypool ha scritto: I also would like to develop using the offline speech recognition engine... but so far it's been impossible to find any documentation regarding its implementation. Can someone help us with some links? That would be awesome! I'm wanting to develop a hands-free NFC triggered application with offline speech recognition for note-taking, but I can't find any information ANYWHERE about how the engine is implemented, and/or what can be edited. Thanks in advance, Kevin On Tuesday, September 4, 2012 10:48:42 AM UTC-5, Nicolamaria Manes wrote: how can the new local speech recognition engine of jelly bean version of android can be used by developers thanks in advance Nicola -- You received this message because you are subscribed to the Google 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] Detect when activity destruction come from rotation
Hi, how can I detect when an activity destruction come from a rotation instead a normal application end? 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] Context() getDir() without creation
Hi, I need to create some directory inside the application to maintain some internal data. To obtain this, I use context.getDir() and It works fine. Sometimes I need to know if some dir exists without create it..and to do it I can't use the context.getDir() cause this function create the directory if needed. How can I obtain this? Thanks -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Context() getDir() without creation
For instance: I create a new Test dir with: context.getDir(Test,Context.MODE_PRIVATE); If after in another part of code I want to check if Test exist without create it, which is the correct procedure?! thanks Il giorno venerdì 19 ottobre 2012 18:00:40 UTC+2, TreKing ha scritto: On Fri, Oct 19, 2012 at 3:47 PM, Paolo Mancini paol...@gmail.comjavascript: wrote: How can I obtain this? http://developer.android.com/reference/android/content/Context.html#getFilesDir%28%29 And standard Java IO. - 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] XmlPullParser tag position
Hi, I'm using the XmlPullParser to parse a large XML file. I need to obtain position (bytes) for each tag but I haven't found any method. I need this cause I want to trace the progression of the parsing (with the total length). Is it possible? Does somebody know another solution? Many 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
Re: [android-developers] XmlPullParser tag position
Sorry, i've duplicated the topic…it's the same problem! Il giorno 18/ott/2012, alle ore 12:42, Harri Smått ha scritto: On Oct 18, 2012, at 12:36 PM, Paolo Mancini paolo8...@gmail.com wrote: I need to obtain position (bytes) for each tag but I haven't found any method. Yesterday you needed an approximation of current position for setting up a progress bar, which one is it? -- H -- You received this message because you are subscribed to the Google 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] XmlPullParser and tag position
Hi, I'm using the XmlPullParser to parse a large XML file. I need to obtain position (bytes) for each tag but I haven't found any method. I need this cause I want to trace the progression of the parsing (with the total length). Is it possible? Does somebody know another solution? Many 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] Android Licensing LVL
Hi, I'm using the LVL ServerManagedPolicy but I've a couple of question. This is my case. A client buy my app and after try to open and use it without internet connection. I've seen that the server response always dontAllow() RETRY. Is it possible to obtain that the ServerManagedPolicy allow the user for a number of retry, so my client can use the app also it use the app without internet connection (my client never open the app with internet connection)? Many 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] Best Practices: Which SDK should I choose for a new project?
Hi there, I'd like to understand if there is a best practice when I have to choose the SDK Target for a Android project. For example: I have to develop an app that must be supported on Android OS version from v2.1 to v4.0 (included). Which target should I choose? -- You received this message because you are subscribed to the Google 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: Best Practices: Which SDK should I choose for a new project?
Thanks Kris, but the answer I'm looking for is not referred to the Android distribution problem, but rather to a technical one. I want to understand if there is best practice for choosing the SDK to use. I should use alway the latest version of the sdk, and so it is my responsibility to provide a mechanism of backward compatibility? Or instead... is better using the min version supported as target? In this case If I use v2.1 as target I can be sure that all the APIs are always supported in v4.0? I hope to be clear :) On 23 Gen, 11:18, Kristopher Micinski krismicin...@gmail.com wrote: Choose the target corresponding to 2.1, there is also a nice little pie chart showing you how many people have what: http://developer.android.com/resources/dashboard/platform-versions.html kris On Mon, Jan 23, 2012 at 5:12 AM, Paolo brand...@gmail.com wrote: Hi there, I'd like to understand if there is a best practice when I have to choose the SDK Target for a Android project. For example: I have to develop an app that must be supported on Android OS version from v2.1 to v4.0 (included). Which target should I choose? -- You received this message because you are subscribed to the Google 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: Best Practices: Which SDK should I choose for a new project?
Can I assume the same for the v3.x? On 23 Gen, 11:39, Kristopher Micinski krismicin...@gmail.com wrote: Basically, yes, if you use something from 2.1 you can be sure it will be in 4.0. There are occasionally deprecated methods, and APIs (for example, the old contacts provider, or a number of older utility classes for things like security, etc..), but in general things are only being added, not dropped. kris On Mon, Jan 23, 2012 at 5:35 AM, Paolo brand...@gmail.com wrote: Thanks Kris, but the answer I'm looking for is not referred to the Android distribution problem, but rather to a technical one. I want to understand if there is best practice for choosing the SDK to use. I should use alway the latest version of the sdk, and so it is my responsibility to provide a mechanism of backward compatibility? Or instead... is better using the min version supported as target? In this case If I use v2.1 as target I can be sure that all the APIs are always supported in v4.0? I hope to be clear :) On 23 Gen, 11:18, Kristopher Micinski krismicin...@gmail.com wrote: Choose the target corresponding to 2.1, there is also a nice little pie chart showing you how many people have what: http://developer.android.com/resources/dashboard/platform-versions.html kris On Mon, Jan 23, 2012 at 5:12 AM, Paolo brand...@gmail.com wrote: Hi there, I'd like to understand if there is a best practice when I have to choose the SDK Target for a Android project. For example: I have to develop an app that must be supported on Android OS version from v2.1 to v4.0 (included). Which target should I choose? -- You received this message because you are subscribed to the Google 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] Re: Best Practices: Which SDK should I choose for a new project?
In conclusion if there is not special reasons to use the latest sdk version, like new features, new APIs... etc. it is better use the min target I want to support? On 23 Gen, 11:44, Paolo brand...@gmail.com wrote: Can I assume the same for the v3.x? On 23 Gen, 11:39, Kristopher Micinski krismicin...@gmail.com wrote: Basically, yes, if you use something from 2.1 you can be sure it will be in 4.0. There are occasionally deprecated methods, and APIs (for example, the old contacts provider, or a number of older utility classes for things like security, etc..), but in general things are only being added, not dropped. kris On Mon, Jan 23, 2012 at 5:35 AM, Paolo brand...@gmail.com wrote: Thanks Kris, but the answer I'm looking for is not referred to the Android distribution problem, but rather to a technical one. I want to understand if there is best practice for choosing the SDK to use. I should use alway the latest version of the sdk, and so it is my responsibility to provide a mechanism of backward compatibility? Or instead... is better using the min version supported as target? In this case If I use v2.1 as target I can be sure that all the APIs are always supported in v4.0? I hope to be clear :) On 23 Gen, 11:18, Kristopher Micinski krismicin...@gmail.com wrote: Choose the target corresponding to 2.1, there is also a nice little pie chart showing you how many people have what: http://developer.android.com/resources/dashboard/platform-versions.html kris On Mon, Jan 23, 2012 at 5:12 AM, Paolo brand...@gmail.com wrote: Hi there, I'd like to understand if there is a best practice when I have to choose the SDK Target for a Android project. For example: I have to develop an app that must be supported on Android OS version from v2.1 to v4.0 (included). Which target should I choose? -- You received this message because you are subscribed to the Google 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] Re: How to change color for item selected in Gallery
anyone? On 4 Ago, 09:13, Paolo brand...@gmail.com wrote: I've done a Gallery view composed by just textviews as numbers. By default if I don't set any colors the item in the centre is black. I want to change it. Using a selector it doesn't work, any ideas? UPDATE: if I try to use a selector also the default behavior gone and I can see only grey textview So, this is the getVIew of my TextAdapter that extends BaseAdapter public View getView(int position, View convertView, ViewGroup parent) { TextView t = new TextView(mContext); int val = position + 1; t.setText( + val); t.setTextSize(30f); t.setTextColor(R.drawable.numericgallery_selector); return t; } and this is my selector. selector xmlns:android=http://schemas.android.com/apk/res/ android item android:state_selected=true android:color=#FDF132/ item item android:state_selected=false android:color=#CADDCD/ item item android:color=#FF/item /selector but it doen't work :( -- You received this message because you are subscribed to the Google 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] Multi Style with external fonts
Here my problem: I have a string formatted like this in string.xml My string is bmulti style/b and use external font and I have two external fonts one for regular and one for bold (DINR.ttf and DINBD.ttf) I want to set the string above with my fonts. I've written this static method: public static void setDefaultTypeFace(Context c, TextView view, String text) { Typeface tf = Typeface.createFromAsset(c.getAssets(), fonts/ DINR.TTF); view.setTypeface(tf); view.setText(Html.formatHtml(text)); } but... it simulates the bold font using only the regular one. If I use the default android font with Html.formatHtml the OS is able to render the text with multiple styles correctly using bold and regular. I'd like to have the same behaviour with my two fonts. I hope to have explained it well. Please help me. Thanks in advance. How to tell Android to use regular and bold for a formatted html string? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] How to change color for item selected in Gallery
I've done a Gallery view composed by just textviews as numbers. By default if I don't set any colors the item in the centre is black. I want to change it. Using a selector it doesn't work, any ideas? UPDATE: if I try to use a selector also the default behavior gone and I can see only grey textview So, this is the getVIew of my TextAdapter that extends BaseAdapter public View getView(int position, View convertView, ViewGroup parent) { TextView t = new TextView(mContext); int val = position + 1; t.setText( + val); t.setTextSize(30f); t.setTextColor(R.drawable.numericgallery_selector); return t; } and this is my selector. selector xmlns:android=http://schemas.android.com/apk/res/ android item android:state_selected=true android:color=#FDF132/ item item android:state_selected=false android:color=#CADDCD/ item item android:color=#FF/item /selector but it doen't work :( -- You received this message because you are subscribed to the Google 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: Avoid to handle click event on a LinearLayout
anyone, please? On 29 Lug, 15:44, Paolo brand...@gmail.com wrote: Hi there, I have a FrameLayout with two inner LinerLayouts overlayed. + FrameLayout + LinearLayout 1 + LinearLayout 2 In some cases I'd like the LinearLayout 2 doesn't handle the click event. I can't set Visibility to GONE, but only to INVISIBLE. The aim is that the LinearLayout 1, that is under, can handle that click. is it possible to do that without using onTouchListener? 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: Avoid to handle click event on a LinearLayout
I got a partial solution! I set the OnTouchListener for the LinearLayout2. When I want to pass the event down, I do linearLayout1.dispatchToucheEvent(event) and return true. The LL1 gets the event and it seems to work, but the LL1 doesn't pass the event to its own children. I have a Button inside it and when I touch or click it, I only see that the LL1 catches it. I expected the LL1 passes the event also to the child Am I wrong? Could you help me please? On 30 Lug, 16:41, Paolo brand...@gmail.com wrote: anyone, please? On 29 Lug, 15:44, Paolo brand...@gmail.com wrote: Hi there, I have a FrameLayout with two inner LinerLayouts overlayed. + FrameLayout + LinearLayout 1 + LinearLayout 2 In some cases I'd like the LinearLayout 2 doesn't handle the click event. I can't set Visibility to GONE, but only to INVISIBLE. The aim is that the LinearLayout 1, that is under, can handle that click. is it possible to do that without using onTouchListener? 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] Avoid to handle click event on a LinearLayout
Hi there, I have a FrameLayout with two inner LinerLayouts overlayed. + FrameLayout + LinearLayout 1 + LinearLayout 2 In some cases I'd like the LinearLayout 2 doesn't handle the click event. I can't set Visibility to GONE, but only to INVISIBLE. The aim is that the LinearLayout 1, that is under, can handle that click. is it possible to do that without using onTouchListener? 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] Problem with Layout with WEIGHT and VISIBILITY params
Hi there! I have a LinearLayout composed by 4 RelativeLayout. Every RelativeLayout has the weight params set in order to fill all the screen. All layouts are set as fill_parent for W and H. + LinearLayout + Relative 1 weight = 4 (visible) + Relative 2 weight = 5 (gone) + Relative 3 weight = 5 (visible) + Relative 4 weight = 5 (visible) I want to animate the Relative 3 and 4 and then hide them, so I set VISIBILITY.GONE when the animation ends. At this point I'd like to show the Relative 2, which was gone before, so I set it to VISIBLE So I get: + LinearLayout + Relative 1 weight = 4 (visible) + Relative 2 weight = 5 (visible) + Relative 3 weight = 5 (gone) + Relative 4 weight = 5 (gone) I expected that the dimensions didn't changed and that the Relative 2 substituted all the space covered by the others (3 and 4). Instead the Relative 1 changes its own height... I guess it depends on the weight params how to avoid it? Please help me... it's quite urgent! -- You received this message because you are subscribed to the Google 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] Call to requestLayou() after an Animation ends
Hi there! I'd try to move with Animation a LinearLayout with some stuff inside when clicking on it. Apply the Animation is pretty simple. I've done something like this. //ANIMATION public static Animation animationTest(int duration) { Animation anim = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 1.0f); anim.setDuration(duration); Interpolator inter = new DecelerateInterpolator(0.4f); anim.setInterpolator(inter); anim.setAnimationListener(new AnimationListener(){ @Override public void onAnimationEnd(Animation animation) { changeLayoutPosition(layout); } }); return anim; } Than I want to be able to click again the layout which is moved to an other position, so as I read in many topic, I have to change the layout, so I've done... public static void changeLayoutPosition(LinearLayout layout) { LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, 100); params.topMargin = layout.getHeight(); layout.setLayoutParams(params); layout.requestLayout(); } It works! But at the end of the animation, probably when requestLayout is called, the LinearLayout produces a sort of artefact, as if it was drawn once again. Is it possible? Why? I expected to see the animation that works normally and to change the layout position in background without to be draw again... Am I wrong something? Is there some tricks to avoid this kind of flickering? Thanks in advance Paolo -- You received this message because you are subscribed to the Google 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] NFC - writing data that only my app can read
Hi there! as the title of my topic, I'd like to write some simple data (i.e. an ID and/or a Name-Text) on some NFC tags. Currently I'm able to write text and read it, but I want my app is the only one can read it. I guess I have to create a kind of custom mimetype, in order to handle it with the intent-filter when the device read the NFC Tag, right? something like: intent-filter action android:name=android.nfc.action.NDEF_DISCOVERED / data android:mimeType=myMime/myType / category android:name=android.intent.category.DEFAULT/ /intent-filter but how to achieve it? and how to write my data with this custom mimetype on my tag? Thanks in advance! Paolo -- You received this message because you are subscribed to the Google 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] Starting an app at BOOT
Hi there! I'd like to start a service when the device completes booting up. I know I have to use a BrodcastReceiver with ACTION_BOOT_COMPLETED, but as documentation this only works if the app installed in the internal storage. What about the external storage? Is there a workaround to get a quite similar behavior also in this case? For app on external storage I tried to wait for receiving ACTION_MEDIA_MOUNTED, but I wasn't able to get it in my BrodcastReceiver... :( This is my intent-filter in the manifest receiver android:name=*.ReceiverBootEvent intent-filter action android:name=android.intent.action.BOOT_COMPLETED / /intent-filter intent-filter action android:name=android.intent.action.MEDIA_MOUNTED / data android:scheme=file / /intent-filter /receiver uses-permission android:name=android.permission.RECEIVE_BOOT_COMPLETED / I haven't found any permission to check MEDIA_MOUNTED. -- You received this message because you are subscribed to the Google 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: Starting an app at BOOT
Why? Just because I would give the user the possibility to decide 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: Change grandient color for a shape programmatically
Hi SofB thanks for your answer. I did it, but the problem is here. From ShapeDrawable object I don't figure out how to set the gradient color in the shape. Maybe I miss something, please give me a tip. http://developer.android.com/reference/android/graphics/drawable/ShapeDrawable.html On 27 Giu, 16:26, Streets Of Boston flyingdutc...@gmail.com wrote: Depends. Let's say you attach this drawable as the background of some View. Call 'getBackgroundDrawable()' on this one and cast it to the correct sub-class of Drawable. In your case that would be ShapeDrawable. Then consult the online documentation to navigate your way to access and change the gradient. -- You received this message because you are subscribed to the Google 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: Change grandient color for a shape programmatically
Exactly! It seems the only way is to create a new GradientDrawable using the constructor programmatically. GradientDrawable(GradientDrawable.Orientation orientation, int[] colors) Do you think this is the only way? :| On 28 Giu, 10:47, Kostya Vasilyev kmans...@gmail.com wrote: How about GradientDrawable instead? http://developer.android.com/reference/android/graphics/drawable/Grad... ( I don't see any methods to set gradient colors, though ) -- Kostya 28.06.2011 12:40, Paolo пишет: Hi SofB thanks for your answer. I did it, but the problem is here. From ShapeDrawable object I don't figure out how to set the gradient color in the shape. Maybe I miss something, please give me a tip. http://developer.android.com/reference/android/graphics/drawable/Shap... On 27 Giu, 16:26, Streets Of Bostonflyingdutc...@gmail.com wrote: Depends. Let's say you attach this drawable as the background of some View. Call 'getBackgroundDrawable()' on this one and cast it to the correct sub-class of Drawable. In your case that would be ShapeDrawable. Then consult the online documentation to navigate your way to access and change the gradient. -- Kostya Vasilyev -- You received this message because you are subscribed to the Google 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 grandient color for a shape programmatically
Hi there! I'd like know how can I change programmatically the gradient color in a shape previously defined in XML. This is my shape, as background of a View: shape xmlns:android=http://schemas.android.com/apk/res/android; android:shape=rectangle corners android:radius=5dp / gradient android:startColor=#00CC5B android:endColor=#007D21 android:angle=90 / /shape I would change the gradient color from code. How can I do that? -- You received this message because you are subscribed to the Google 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: multiple opengl context and shared textures
UPDATE 2: I've understand I have to create an EGLContext in the first rendering thread and share it with the second one, as explained here http://comments.gmane.org/gmane.comp.handhelds.android.devel/130165 But it isn't enough... At this link http://groups.google.com/group/android-platform/browse_thread/thread/a9931ef61a5648c5 there is a topic where it is explained how to achieve texture sharing (see the answer on 30th May), using EGLImage Object and glEGLImageTargetTexture2DOES() function. The second one is present in Android inside GLES11Ext class, but what about the EGLImage... I can't find it anywhere. It seems that Android provides an older EGL specs or simply a partial EGL specs. Am I wrong? In this case, is there any other way to achieve texture sharing? Thanks in advance! Paolo On 15 Giu, 18:36, Paolo brand...@gmail.com wrote: UPDATE 1: I have been able to show two different GLsurfaceview showing one simple square for every surface with OpenGL and it works. Then I applied a texture on one square and it works. Now I'd like to share textures within the second square on the second GLSurfaceView, but it seems a bit complicated. Is there anyone who knows how to work it out? Here my code... it's bad code, but it just for testing... private static int id_text = -1; //id texture public void onSurfaceCreated(GL10 gl, EGLConfig config) { gl.glShadeModel(GL10.GL_SMOOTH); gl.glClearColor(0, 0, 0, 0); gl.glClearDepthf(1.0f); gl.glEnable(GL10.GL_DEPTH_TEST); gl.glDepthFunc(GL10.GL_LEQUAL); gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_NICEST); //TEXTTURE gl.glEnable(GL11.GL_TEXTURE_2D); // create vertex buffer for texture textureBuffer = setTextureVertex(); //if I am the first glsurfaceview (it means texture sharing == false) I create my texture, otherwise i get the shared one. if(!textureSharing) //id_text is the texture id generated, see below methods id_text = GlRenderer.loadTexture(gl, context, R.drawable.texture); gl.glDisable(GL11.GL_TEXTURE_2D); } public void onDrawFrame(GL10 gl) { gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); gl.glMatrixMode(GL10.GL_MODELVIEW); gl.glLoadIdentity(); //if my texture id isn't generated yet, nop, else I use it do for drawing if (id_text != -1) { // draw quad gl.glPushMatrix(); gl.glColor4f(1, 1, 1, 1); // create texture gl.glEnable(GL10.GL_TEXTURE_2D); gl.glBindTexture(GL10.GL_TEXTURE_2D, id_text); gl.glTranslatef(0, 0, -4f); gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY); gl.glVertexPointer(3, GL10.GL_FLOAT, 0, quadBuffer); gl.glTexCoordPointer(2, GL11.GL_FLOAT, 0, textureBuffer); gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, 4); gl.glDisableClientState(GL10.GL_VERTEX_ARRAY); // Disable the vertices buffer. gl.glDisableClientState(GL11.GL_VERTEX_ARRAY); gl.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY); gl.glDisable(GL11.GL_TEXTURE_2D); gl.glPopMatrix(); } } public void onSurfaceChanged(GL10 gl, int width, int height) { // avoid division by zero if (height == 0) height = 1; // draw on the entire screen gl.glViewport(0, 0, width, height); // setup projection matrix gl.glMatrixMode(GL10.GL_PROJECTION); gl.glLoadIdentity(); GLU.gluPerspective(gl, 45.0f, (float)width / (float)height, 1.0f, 100.0f); } /* * Generate a new ID for texture */ private static int newTextureID(GL10 gl) { int[] temp = new int[1]; gl.glGenTextures(1, temp, 0); return temp[0]; } /* * Load Texture */ private static int loadTexture(GL10 gl, Context context, int resource) { int id = id_text; BitmapFactory.Options opts = new BitmapFactory.Options(); opts.inScaled = false; Bitmap temp = BitmapFactory.decodeResource(context.getResources(), resource, opts); Bitmap texture = Bitmap.createBitmap(temp, 0, 0, temp.getWidth
[android-developers] Re: multiple opengl context and shared textures
UPDATE 1: I have been able to show two different GLsurfaceview showing one simple square for every surface with OpenGL and it works. Then I applied a texture on one square and it works. Now I'd like to share textures within the second square on the second GLSurfaceView, but it seems a bit complicated. Is there anyone who knows how to work it out? Here my code... it's bad code, but it just for testing... private static int id_text = -1; //id texture public void onSurfaceCreated(GL10 gl, EGLConfig config) { gl.glShadeModel(GL10.GL_SMOOTH); gl.glClearColor(0, 0, 0, 0); gl.glClearDepthf(1.0f); gl.glEnable(GL10.GL_DEPTH_TEST); gl.glDepthFunc(GL10.GL_LEQUAL); gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_NICEST); //TEXTTURE gl.glEnable(GL11.GL_TEXTURE_2D); // create vertex buffer for texture textureBuffer = setTextureVertex(); //if I am the first glsurfaceview (it means texture sharing == false) I create my texture, otherwise i get the shared one. if(!textureSharing) //id_text is the texture id generated, see below methods id_text = GlRenderer.loadTexture(gl, context, R.drawable.texture); gl.glDisable(GL11.GL_TEXTURE_2D); } public void onDrawFrame(GL10 gl) { gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); gl.glMatrixMode(GL10.GL_MODELVIEW); gl.glLoadIdentity(); //if my texture id isn't generated yet, nop, else I use it do for drawing if (id_text != -1) { // draw quad gl.glPushMatrix(); gl.glColor4f(1, 1, 1, 1); // create texture gl.glEnable(GL10.GL_TEXTURE_2D); gl.glBindTexture(GL10.GL_TEXTURE_2D, id_text); gl.glTranslatef(0, 0, -4f); gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY); gl.glVertexPointer(3, GL10.GL_FLOAT, 0, quadBuffer); gl.glTexCoordPointer(2, GL11.GL_FLOAT, 0, textureBuffer); gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, 4); gl.glDisableClientState(GL10.GL_VERTEX_ARRAY); // Disable the vertices buffer. gl.glDisableClientState(GL11.GL_VERTEX_ARRAY); gl.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY); gl.glDisable(GL11.GL_TEXTURE_2D); gl.glPopMatrix(); } } public void onSurfaceChanged(GL10 gl, int width, int height) { // avoid division by zero if (height == 0) height = 1; // draw on the entire screen gl.glViewport(0, 0, width, height); // setup projection matrix gl.glMatrixMode(GL10.GL_PROJECTION); gl.glLoadIdentity(); GLU.gluPerspective(gl, 45.0f, (float)width / (float)height, 1.0f, 100.0f); } /* * Generate a new ID for texture */ private static int newTextureID(GL10 gl) { int[] temp = new int[1]; gl.glGenTextures(1, temp, 0); return temp[0]; } /* * Load Texture */ private static int loadTexture(GL10 gl, Context context, int resource) { int id = id_text; BitmapFactory.Options opts = new BitmapFactory.Options(); opts.inScaled = false; Bitmap temp = BitmapFactory.decodeResource(context.getResources(), resource, opts); Bitmap texture = Bitmap.createBitmap(temp, 0, 0, temp.getWidth(), temp.getHeight()); id = newTextureID(gl); //generate the ID texture gl.glBindTexture(GL10.GL_TEXTURE_2D, id); // setup texture parameters gl.glTexParameterx(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR); gl.glTexParameterx(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_LINEAR); GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, texture, 0); temp.recycle(); texture.recycle(); return id; } What happen? The first glsurfaceview shows the correct square textured, the second one show only a white square My goal is share only the ID and the to call glBindTexture(), but maybe I'm wrong. Please help me to undestand! Thanks Paolo On 8 Giu, 20:37, Paolo brand...@gmail.com wrote: Hi there, as the Object of this topic... is it possible to create two different OpenGL Contexts in the same activity? I mean creating two different
[android-developers] Fonts on Android, how are they manage by the OS?
Hi there! I need some clarifications how Android uses fonts/typefaces. Questions: 1) my app must supported a huge lists of language so I need a font, which is able to match the max possible number of characters UNICODE. Is there in Android a font like that? 2) I have noticed that on my N1 are present many fonts on the system folder fonts Droidxxx.ttf. How can I be sure those fonts always will be on all Android devices like on Samsung, HTC or LG...? Is there any guarantee? 3) Suppose I choose a DroidXXX.ttf font as default of my app. If I need a particular glyph and it isn't in my chosen fonts, how does Android manage this situation? Please answer me ASAP. Thanks in advance! Paolo -- You received this message because you are subscribed to the Google 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: Fonts on Android, how are they manage by the OS?
On 8 Giu, 10:28, Shine shineange...@gmail.com wrote: 2)I guess there is no guarantee. To be certain of the font availability, considering .ttf file size, it should be better for you to include desired font inside /assets directory, and then load it with something like this: ok, but there is no guarentee also for the system fonts? It seems a bit strange... because it would be the default typeface fro Android. I expect to find the DroidSans typeface everywhere! I need a confirm! 3) it will draw another 'special char', like ? or #. You'll have to test it extensively. Also in this case I expect a different behavior... something like: a typeface like Sans doesn't provide a specified glyph I expect the system automatically checks for another typeface which is able to render it. How does Android work? And how can I test it? On 8 Giu, 10:07, Paolo brand...@gmail.com wrote: Hi there! I need some clarifications how Android uses fonts/typefaces. Questions: 1) my app must supported a huge lists of language so I need a font, which is able to match the max possible number of characters UNICODE. Is there in Android a font like that? 2) I have noticed that on my N1 are present many fonts on the system folder fonts Droidxxx.ttf. How can I be sure those fonts always will be on all Android devices like on Samsung, HTC or LG...? Is there any guarantee? 3) Suppose I choose a DroidXXX.ttf font as default of my app. If I need a particular glyph and it isn't in my chosen fonts, how does Android manage this situation? Please answer me ASAP. Thanks in advance! Paolo -- You received this message because you are subscribed to the Google 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: Fonts on Android, how are they manage by the OS?
yes those fonts are for the last platform, I guess Gingerbread that provides an extended language support. However I noticed something strange... On my Nexus S there are a lot of languages supported selectable, on the other hand on my Nexus One (always 2.3.4) there are only a subset of those. I expected they were the same... I am a bit confused! :| On 8 Giu, 12:23, James Ots james...@gmail.com wrote: Here are the fonts in the android source. http://android.git.kernel.org/?p=platform/frameworks/base.git;a=tree;... These are listed in the makefile DroidSans.ttf DroidSans-Bold.ttf DroidSansArabic.ttf DroidSansHebrew.ttf DroidSansThai.ttf DroidSerif-Regular.ttf DroidSerif-Bold.ttf DroidSerif-Italic.ttf DroidSerif-BoldItalic.ttf DroidSansMono.ttf Clockopia.ttf Although I can't see any guarantee that these will be there, I think you can probably assume that any Compatible Android device will have these fonts available. James -- You received this message because you are subscribed to the Google 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] multiple opengl context and shared textures
Hi there, as the Object of this topic... is it possible to create two different OpenGL Contexts in the same activity? I mean creating two different glsurfaceviews, where every of them use a different EGLConfig and Renderer. And also... what about texture? Can I share texture through the two OGL Context? I need to use it either with 2.1, 2.2. 2.3 or 3.0 with tablets for a dual indipendent 3D window. Thanks in advance Paolo -- You received this message because you are subscribed to the Google 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: Building composed shapes
UPDATE: I have been able to write (layers.xml) what I want on a XML file using Layer-List. so I can use this drawable on a ImageView normally doing: ImageView android:layout_height=wrap_content android:layout_width=wrap_content android:src=@drawable/layers / Everything works fine! But this isn't my aim. Actually I'd like to use this drawable as a background of my custom view, so I need to use it into the onDraw() method applying it on the canvas of my View. ... Bitmap img = BitmapFactory.decodeResource(context.getResources(), R.drawable.layers); canvas.drawBitmap(img, null, rect, paint); ... I've this error at runtime: 05-31 10:59:35.289: ERROR/AndroidRuntime(1702): java.lang.NullPointerException 05-31 10:59:35.289: ERROR/AndroidRuntime(1702): at android.graphics.Canvas.throwIfRecycled(Canvas.java:954) 05-31 10:59:35.289: ERROR/AndroidRuntime(1702): at android.graphics.Canvas.drawBitmap(Canvas.java:1012) 05-31 10:59:35.289: ERROR/AndroidRuntime(1702): at it.myPackageTest.view.test.CustomView.onDraw(CustomView.java:79) ... I don't call recycle(), so how it is possible? Maybe I can't use layers on a canvas? I really don't know! :( Please tell me something! Thanks in advance! On 30 Mag, 18:50, Paolo brand...@gmail.com wrote: Hi there! I need to draw a drawable on a canvas. I'd like to avoid using a png file, but I'd like to draw it with shapes. The final result must be an unique drawable composed by two rects overlayed, one smallest than the other one. How can I do that in XML? I've seen layer-list but I can't figure out if it is useful for my achivement besides the fact I have a runtime exception... .:( Can anyone hepl me, please? 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: Building composed shapes
UPDATE 2: I found out the problem! BitmapFactory.decodeResource(context.getResources(), R.drawable.layers); return always NULL, what could be the problem for you? On 31 Mag, 11:15, Paolo brand...@gmail.com wrote: UPDATE: I have been able to write (layers.xml) what I want on a XML file using Layer-List. so I can use this drawable on a ImageView normally doing: ImageView android:layout_height=wrap_content android:layout_width=wrap_content android:src=@drawable/layers / Everything works fine! But this isn't my aim. Actually I'd like to use this drawable as a background of my custom view, so I need to use it into the onDraw() method applying it on the canvas of my View. ... Bitmap img = BitmapFactory.decodeResource(context.getResources(), R.drawable.layers); canvas.drawBitmap(img, null, rect, paint); ... I've this error at runtime: 05-31 10:59:35.289: ERROR/AndroidRuntime(1702): java.lang.NullPointerException 05-31 10:59:35.289: ERROR/AndroidRuntime(1702): at android.graphics.Canvas.throwIfRecycled(Canvas.java:954) 05-31 10:59:35.289: ERROR/AndroidRuntime(1702): at android.graphics.Canvas.drawBitmap(Canvas.java:1012) 05-31 10:59:35.289: ERROR/AndroidRuntime(1702): at it.myPackageTest.view.test.CustomView.onDraw(CustomView.java:79) ... I don't call recycle(), so how it is possible? Maybe I can't use layers on a canvas? I really don't know! :( Please tell me something! Thanks in advance! On 30 Mag, 18:50, Paolo brand...@gmail.com wrote: Hi there! I need to draw a drawable on a canvas. I'd like to avoid using a png file, but I'd like to draw it with shapes. The final result must be an unique drawable composed by two rects overlayed, one smallest than the other one. How can I do that in XML? I've seen layer-list but I can't figure out if it is useful for my achivement besides the fact I have a runtime exception... .:( Can anyone hepl me, please? 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: Building composed shapes
SOLUTION: layer = (LayerDrawable) getResources().getDrawable(R.drawable.layers); layer.setBounds(** what you want **); layer.mutate(); layer.draw(canvas); On 31 Mag, 11:29, Paolo brand...@gmail.com wrote: UPDATE 2: I found out the problem! BitmapFactory.decodeResource(context.getResources(), R.drawable.layers); return always NULL, what could be the problem for you? On 31 Mag, 11:15, Paolo brand...@gmail.com wrote: UPDATE: I have been able to write (layers.xml) what I want on a XML file using Layer-List. so I can use this drawable on a ImageView normally doing: ImageView android:layout_height=wrap_content android:layout_width=wrap_content android:src=@drawable/layers / Everything works fine! But this isn't my aim. Actually I'd like to use this drawable as a background of my custom view, so I need to use it into the onDraw() method applying it on the canvas of my View. ... Bitmap img = BitmapFactory.decodeResource(context.getResources(), R.drawable.layers); canvas.drawBitmap(img, null, rect, paint); ... I've this error at runtime: 05-31 10:59:35.289: ERROR/AndroidRuntime(1702): java.lang.NullPointerException 05-31 10:59:35.289: ERROR/AndroidRuntime(1702): at android.graphics.Canvas.throwIfRecycled(Canvas.java:954) 05-31 10:59:35.289: ERROR/AndroidRuntime(1702): at android.graphics.Canvas.drawBitmap(Canvas.java:1012) 05-31 10:59:35.289: ERROR/AndroidRuntime(1702): at it.myPackageTest.view.test.CustomView.onDraw(CustomView.java:79) ... I don't call recycle(), so how it is possible? Maybe I can't use layers on a canvas? I really don't know! :( Please tell me something! Thanks in advance! On 30 Mag, 18:50, Paolo brand...@gmail.com wrote: Hi there! I need to draw a drawable on a canvas. I'd like to avoid using a png file, but I'd like to draw it with shapes. The final result must be an unique drawable composed by two rects overlayed, one smallest than the other one. How can I do that in XML? I've seen layer-list but I can't figure out if it is useful for my achivement besides the fact I have a runtime exception... .:( Can anyone hepl me, please? 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] Building composed shapes
Hi there! I need to draw a drawable on a canvas. I'd like to avoid using a png file, but I'd like to draw it with shapes. The final result must be an unique drawable composed by two rects overlayed, one smallest than the other one. How can I do that in XML? I've seen layer-list but I can't figure out if it is useful for my achivement besides the fact I have a runtime exception... .:( Can anyone hepl me, please? 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] How to kill service for debugging purpose
Hi there! I'd like to know how can I kill my service without to kill my whole process too, as the system does when it need memory. In particular I want to test if the the service re-start using the flag START_STICKY returned by onStartCommand(). Can anyone help me? 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] Avoiding service to be killed by the system
Hi there, some weeks ago I ask you about service life cycle and about the START_STICKY flag returned from onStartCommand(), for allowing the service to be restarted after it has been killed by the system. This way works fine on Android 2.1 and 2.2 but not in Android 2.3 (Gingerbread)... the system never calls onStartCommand() after the service has been killed. here: https://groups.google.com/group/android-developers/browse_thread/thread/b5c4aaa0ff1a609a/429fe6ab69ab72d2?hl=it#429fe6ab69ab72d2 I found a topic about this and it confirm it is a gingerbread bug. here: https://groups.google.com/group/android-developers/browse_thread/thread/d87fb390c13d141d/063e74b9e1e98f9a?hl=itlnk=gstq=Gingerbread+BroadcastReceiver+Issue# As a workaround I try to set the service as visible with startForeground(). Anyway I guess that this flag can't guarantee my service is always running for a long time, isn't it? Because after a long time my service has been killed again and it isn't restarted anymore. Maybe it is my fault... when I call startForeground an ongoing notification is set until I call stopForeground. While the service is running I set new ongoing notifications overriding that one has been passed from startForeground. Can this break the service foreground state? Sorry if my english isn't perfect, I hope it's clear anyway what I want to tell you. If you have any questions, please ask me. Thanks Paolo -- You received this message because you are subscribed to the Google 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 Service after it has been killed by the system
Hi TreKing, for short time I mean at least 30min, not more. Using START_STICKY my service doesn't restart anymore. It has happened to start again only once, but after 6 hours more or less... I'd like to understand if this is the normal behaviour or there is something wrong. On 19 Mar, 02:55, TreKing treking...@gmail.com wrote: On Fri, Mar 18, 2011 at 6:02 AM, Paolo brand...@gmail.com wrote: How can avoid it? You can't. Or at least how can I restart my service as soon as possible? Attach it to an ongoing notification to indicate it's something the user cares about and should have slightly higher priority. I found that can return from onStartCommand START_REDELIVER_INTENT or START_STIKY. They seem to be what I'm looking for, but the Service seems not to restart in a short time... Define in a short time. Could someone get me some suggestions or clarify it to me this situation? Is there a trick? Not really. It should just work this way by default. --- -- 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] Restart Service after it has been killed by the system
Hi there! I'm in trouble with the service as the topic title says. I put my app in background running a service for tracking my position. As normal, the system could require resources and kill him. How can avoid it? Or at least how can I restart my service as soon as possible? I found that can return from onStartCommand START_REDELIVER_INTENT or START_STIKY. They seem to be what I'm looking for, but the Service seems not to restart in a short time... Could someone get me some suggestions or clarify it to me this situation? Is there a trick? Thanks in advance! Paolo -- You received this message because you are subscribed to the Google 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 startPreview() failed on Nexus S with Gingerbread
Thanks Mark. I'll compare my code with yours, to understand where the problem is. On 8 Mar, 15:17, Mark Murphy mmur...@commonsware.com wrote: The Nexus S works just fine with camera previews. See: https://github.com/commonsguy/cw-advandroid/tree/master/Camera/Previewhttps://github.com/commonsguy/cw-advandroid/tree/master/Camera/Picture The first one is just preview, working with the default camera. The second one also takes pictures and will use the FFC on Android 2.3 and newer devices (if there is an FFC), otherwise it will use the default camera. On Tue, Mar 8, 2011 at 9:07 AM, Paolo brand...@gmail.com wrote: I guess the problem is that Nexus S has two cameras (front and back). With Froyo I can't manage this situation. I expect that Android use the back one without problem with the same code I use for Froyo, The startPreview() faild and I don't undestrand why. If I run the same app on a Nexus One with Gingerbread installed, it works fine... I suppose because N1 has only one camera. Please help me! Paolo On 7 Mar, 18:00, Paolo brand...@gmail.com wrote: Hi there! I've tested my app developed with SDK 2.2 as target on a Nexus S with Gingerbread. All it goes ok, except the activity that uses the Camera hardware to take pictures. I don't know what's wrong... :( Is there anyone who has had the same problem? Please help me! Thanks in advance! This is my logcat: 03-07 17:47:04.457: ERROR/SecCamera(75): ERR(int android::fimc_v4l2_reqbufs(int, v4l2_buf_type, int)):VIDIOC_REQBUFS failed 03-07 17:47:04.457: ERROR/SecCamera(75): int android::SecCamera::startPreview()::828 fail. errno: Out of memory, m_camera_id = 0 03-07 17:47:04.457: ERROR/CameraHardwareSec(75): ERR(virtual android::status_t android::CameraHardwareSec::startPreview()):Fail on mSecCamera-startPreview() 03-07 17:47:04.460: DEBUG/AndroidRuntime(793): Shutting down VM 03-07 17:47:04.460: WARN/dalvikvm(793): threadid=1: thread exiting with uncaught exception (group=0x40015560) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): FATAL EXCEPTION: main 03-07 17:47:04.468: ERROR/AndroidRuntime(793): java.lang.RuntimeException: startPreview failed 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at android.hardware.Camera.startPreview(Native Method) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at it.visitotuscany.CameraActivity.surfaceChanged(CameraActivity.java: 330) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at android.view.SurfaceView.updateWindow(SurfaceView.java:549) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at android.view.SurfaceView.dispatchDraw(SurfaceView.java:348) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at android.view.ViewGroup.drawChild(ViewGroup.java:1644) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at android.view.ViewGroup.drawChild(ViewGroup.java:1644) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at android.view.View.draw(View.java:6883) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at android.widget.FrameLayout.draw(FrameLayout.java:357) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at android.view.ViewGroup.drawChild(ViewGroup.java:1646) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at android.view.View.draw(View.java:6883) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at android.widget.FrameLayout.draw(FrameLayout.java:357) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at com.android.internal.policy.impl.PhoneWindow $DecorView.draw(PhoneWindow.java:1862) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at android.view.ViewRoot.draw(ViewRoot.java:1522) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at android.view.ViewRoot.performTraversals(ViewRoot.java:1258) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at android.view.ViewRoot.handleMessage(ViewRoot.java:1859) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at android.os.Handler.dispatchMessage(Handler.java:99) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at android.os.Looper.loop(Looper.java:123) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at android.app.ActivityThread.main(ActivityThread.java:3683) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at java.lang.reflect.Method.invokeNative(Native Method) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at java.lang.reflect.Method.invoke(Method.java:507) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at com.android.internal.os.ZygoteInit $MethodAndArgsCaller.run(ZygoteInit.java:839) 03-07 17:47:04.468: ERROR/AndroidRuntime
[android-developers] Retrive which activity has started a local service
hi there! I have a single activity that starts a local service. I'd like to know from the service class which activity has called it. Is it possible? I notice the startCommand method has as parameters the intent used to call the service. Is there anything I can do with it for my purpose? Thanks in advance. Paolo -- You received this message because you are subscribed to the Google 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: Retrive which activity has started a local service
Sorry, maybe my english isn't good enough or I explain not well what I'd like to do... :) I'd like my service knows which activity has started it. I want to have the Activity Object in order to get some variables value into the service. I can't put them into the intent as extras, because they changed dinamically at runtime. If I have the caller activity obj I could retrieve them directly. I hope I explain better my problem, if not... sorry ;) Paolo On 8 Mar, 12:30, Kostya Vasilyev kmans...@gmail.com wrote: Sure, put some extras in the intent or specify an action string - your service will be able to examine those. 08.03.2011 14:23 пользователь Paolo brand...@gmail.com написал: hi there! I have a single activity that starts a local service. I'd like to know from the service class which activity has called it. Is it possible? I notice the startCommand method has as parameters the intent used to call the service. Is there anything I can do with it for my purpose? Thanks in advance. Paolo -- You received this message because you are subscribed to the Google 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: Camera startPreview() failed on Nexus S with Gingerbread
I guess the problem is that Nexus S has two cameras (front and back). With Froyo I can't manage this situation. I expect that Android use the back one without problem with the same code I use for Froyo, The startPreview() faild and I don't undestrand why. If I run the same app on a Nexus One with Gingerbread installed, it works fine... I suppose because N1 has only one camera. Please help me! Paolo On 7 Mar, 18:00, Paolo brand...@gmail.com wrote: Hi there! I've tested my app developed with SDK 2.2 as target on a Nexus S with Gingerbread. All it goes ok, except the activity that uses the Camera hardware to take pictures. I don't know what's wrong... :( Is there anyone who has had the same problem? Please help me! Thanks in advance! This is my logcat: 03-07 17:47:04.457: ERROR/SecCamera(75): ERR(int android::fimc_v4l2_reqbufs(int, v4l2_buf_type, int)):VIDIOC_REQBUFS failed 03-07 17:47:04.457: ERROR/SecCamera(75): int android::SecCamera::startPreview()::828 fail. errno: Out of memory, m_camera_id = 0 03-07 17:47:04.457: ERROR/CameraHardwareSec(75): ERR(virtual android::status_t android::CameraHardwareSec::startPreview()):Fail on mSecCamera-startPreview() 03-07 17:47:04.460: DEBUG/AndroidRuntime(793): Shutting down VM 03-07 17:47:04.460: WARN/dalvikvm(793): threadid=1: thread exiting with uncaught exception (group=0x40015560) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): FATAL EXCEPTION: main 03-07 17:47:04.468: ERROR/AndroidRuntime(793): java.lang.RuntimeException: startPreview failed 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at android.hardware.Camera.startPreview(Native Method) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at it.visitotuscany.CameraActivity.surfaceChanged(CameraActivity.java: 330) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at android.view.SurfaceView.updateWindow(SurfaceView.java:549) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at android.view.SurfaceView.dispatchDraw(SurfaceView.java:348) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at android.view.ViewGroup.drawChild(ViewGroup.java:1644) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at android.view.ViewGroup.drawChild(ViewGroup.java:1644) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at android.view.View.draw(View.java:6883) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at android.widget.FrameLayout.draw(FrameLayout.java:357) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at android.view.ViewGroup.drawChild(ViewGroup.java:1646) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at android.view.View.draw(View.java:6883) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at android.widget.FrameLayout.draw(FrameLayout.java:357) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at com.android.internal.policy.impl.PhoneWindow $DecorView.draw(PhoneWindow.java:1862) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at android.view.ViewRoot.draw(ViewRoot.java:1522) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at android.view.ViewRoot.performTraversals(ViewRoot.java:1258) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at android.view.ViewRoot.handleMessage(ViewRoot.java:1859) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at android.os.Handler.dispatchMessage(Handler.java:99) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at android.os.Looper.loop(Looper.java:123) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at android.app.ActivityThread.main(ActivityThread.java:3683) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at java.lang.reflect.Method.invokeNative(Native Method) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at java.lang.reflect.Method.invoke(Method.java:507) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at com.android.internal.os.ZygoteInit $MethodAndArgsCaller.run(ZygoteInit.java:839) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at dalvik.system.NativeStart.main(Native Method) -- You received this message because you are subscribed to the Google 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 startPreview() failed on Nexus S with Gingerbread
Hi there! I've tested my app developed with SDK 2.2 as target on a Nexus S with Gingerbread. All it goes ok, except the activity that uses the Camera hardware to take pictures. I don't know what's wrong... :( Is there anyone who has had the same problem? Please help me! Thanks in advance! This is my logcat: 03-07 17:47:04.457: ERROR/SecCamera(75): ERR(int android::fimc_v4l2_reqbufs(int, v4l2_buf_type, int)):VIDIOC_REQBUFS failed 03-07 17:47:04.457: ERROR/SecCamera(75): int android::SecCamera::startPreview()::828 fail. errno: Out of memory, m_camera_id = 0 03-07 17:47:04.457: ERROR/CameraHardwareSec(75): ERR(virtual android::status_t android::CameraHardwareSec::startPreview()):Fail on mSecCamera-startPreview() 03-07 17:47:04.460: DEBUG/AndroidRuntime(793): Shutting down VM 03-07 17:47:04.460: WARN/dalvikvm(793): threadid=1: thread exiting with uncaught exception (group=0x40015560) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): FATAL EXCEPTION: main 03-07 17:47:04.468: ERROR/AndroidRuntime(793): java.lang.RuntimeException: startPreview failed 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at android.hardware.Camera.startPreview(Native Method) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at it.visitotuscany.CameraActivity.surfaceChanged(CameraActivity.java: 330) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at android.view.SurfaceView.updateWindow(SurfaceView.java:549) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at android.view.SurfaceView.dispatchDraw(SurfaceView.java:348) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at android.view.ViewGroup.drawChild(ViewGroup.java:1644) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at android.view.ViewGroup.drawChild(ViewGroup.java:1644) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at android.view.View.draw(View.java:6883) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at android.widget.FrameLayout.draw(FrameLayout.java:357) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at android.view.ViewGroup.drawChild(ViewGroup.java:1646) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at android.view.View.draw(View.java:6883) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at android.widget.FrameLayout.draw(FrameLayout.java:357) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at com.android.internal.policy.impl.PhoneWindow $DecorView.draw(PhoneWindow.java:1862) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at android.view.ViewRoot.draw(ViewRoot.java:1522) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at android.view.ViewRoot.performTraversals(ViewRoot.java:1258) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at android.view.ViewRoot.handleMessage(ViewRoot.java:1859) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at android.os.Handler.dispatchMessage(Handler.java:99) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at android.os.Looper.loop(Looper.java:123) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at android.app.ActivityThread.main(ActivityThread.java:3683) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at java.lang.reflect.Method.invokeNative(Native Method) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at java.lang.reflect.Method.invoke(Method.java:507) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at com.android.internal.os.ZygoteInit $MethodAndArgsCaller.run(ZygoteInit.java:839) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 03-07 17:47:04.468: ERROR/AndroidRuntime(793): at dalvik.system.NativeStart.main(Native Method) -- You received this message because you are subscribed to the Google 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] SSL certificates on Android
Hi there, I'm new on SSL and I have one question for you about it on Android. So, sorry me if I say something that isn't correct :) I have to start a communication with a REST Web Service. There are two steps I should clarify to myself... the second one is the most important for my target. 1) I must be sure I'm starting to communicate with the WS. So I need its own certificate (it is on the server side). I know how to do that and the troubles connected to a CA or a self-signed certificate, after reading this article: http://blog.antoine.li/index.php/2010/10/android-trusting-ssl-certificates/ I believe there is no problem to do that. 2) step 2 here... Now I have also the opposite problem. The WS must to be sure to communicate with a mobile device (me) and not with other one. To do that I need a certificate on the device embedded in the app, in order to allow the WS to know who I am and then we can starts the communication. In other words... I need to know with who I'm speaking and the same is for the WS. This is my problem. Usually only the first step is the important one, in my case the second one is the most important. I hope to be clear. If you have some questions o doubts, please ask me. Thanks to all in advance. Paolo -- You received this message because you are subscribed to the Google 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: licensing live wallpapers
more infos from the debugger: The application licensing class is working good and runs correctly until the here: private void startMainActivity() { Log.i(MY WALLPAPER LICENSING,license ok); startService(new Intent(this, MyLiveWallpaperService.class)); this line fires the security exception finish(); } the runtime error reported is: [AndroidRuntime: FATAL EXCEPTION: background thread] the line above was different in the example because was meant to work with a normal Intent, it was startIntent.. but with a stroke on ctrl+space I found the method startService,, since a wallpaper is a service, am I so 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
[android-developers] drawing and refreshing small paint over static bitmap
Hello. I thought it was an easy find over all these android forums but it seems i cannot find if there is a pre-built way to draw my sprite (made up with a couple of shapes) over a static bitmap as background. What I currently do is redrawing the background and drawing over same canvas the sprite, for each onDraw() event, with some performance issues ofcourse. I remember some mode 0x13h experiments in old C, so there surely are ways to copy-pixels behind the sprite, move the sprite, rederaw the copied part of background to cover the old sprite, and draw the new sprite position. My question is different: is there a way to set up a certain number of layers/levels and leave the bitmap on the bottom layer and going on erasing-drawing only the sprite in the top layer? That would you normally do for instance in actionscript3, you create 2 canvas, and operate them individually. But if you want to be old-school you can work with copypixel but there is almost never the need. But whenever I search for layers or overlays searches spit out GoogleMaps layers coding, MapView overlays stuff which really don't matter :D So what classes am I missing for doing this very basic thing? 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] Package name problem during apk installation
Hi there, I created a project for my app with a package name like this: com._3towns.app, but when I try to install and launch the app, the device reboots and the installation failed. Why? The I thought underscore is supported, isn't it? 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: Customizing a RelativeLayout
any ideas? On 16 Dic, 13:40, Paolo brand...@gmail.com wrote: Thanks a lot for your answer ;) Before to use my own nine-patch, I'd like to understand what I'm wrong extending the RelativeLayout. So, in other topics I found that Roman Guy suggested to use setWillNotDraw(false). Using this flag I can show my Custom Layout correctly running on a device (why?), but I continue to not see its own child in the Eclipse editor. It isn't a big problem, because I know what I'm doing, but I'd like that all the things work fine also with the editor. About this Eclipse shows me a warining that says: AndroidManifest: Ignoring unknown 'TextView' XML element - com.android.ide.eclipse.adt where TextView is RelativeLayout's chid. Maybe I'm forgetting something... :( On 16 Dic, 12:42, Kostya Vasilyev kmans...@gmail.com wrote: 16.12.2010 14:34, Paolo пишет: I've tried, but I don't like that nine-patch. Maybe I should draw end substitute my own nine patch. Anyway in this way I can simply manage it in the Eclipse Layout editor, and that's is good! Yes, you can certainly use other nine-patches from Android (see my previous message on where to find them), or draw your own: http://developer.android.com/guide/topics/graphics/2d-graphics.html#n... The only thing I don't like of the nine-patch way is that I have to draw one nine-patch for all the time I want to change, for example the color of the background or the alpha value, while extending RelativeLayout I can to that by code programmatically. Is it right? You can change the background from code: http://developer.android.com/reference/android/view/View.html#setBack...) http://developer.android.com/reference/android/view/View.html#setBack...) On the other hand, overriding onDraw does give you complete control, so it's a judgment call on flexibility vs. effort (isn't everything?) -- 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
[android-developers] Re: Customizing a RelativeLayout
Thanks for your help anyway ;) I hope someone can answer at my question. On 17 Dic, 09:58, Kostya Vasilyev kmans...@gmail.com wrote: I don't know what setWillNotDraw does, but the XML error looks suspicious. -- Kostya 17.12.2010 11:49, Paolo пишет: any ideas? On 16 Dic, 13:40, Paolobrand...@gmail.com wrote: Thanks a lot for your answer ;) Before to use my own nine-patch, I'd like to understand what I'm wrong extending the RelativeLayout. So, in other topics I found that Roman Guy suggested to use setWillNotDraw(false). Using this flag I can show my Custom Layout correctly running on a device (why?), but I continue to not see its own child in the Eclipse editor. It isn't a big problem, because I know what I'm doing, but I'd like that all the things work fine also with the editor. About this Eclipse shows me a warining that says: AndroidManifest: Ignoring unknown 'TextView' XML element - com.android.ide.eclipse.adt where TextView is RelativeLayout's chid. Maybe I'm forgetting something... :( On 16 Dic, 12:42, Kostya Vasilyevkmans...@gmail.com wrote: 16.12.2010 14:34, Paolo пишет: I've tried, but I don't like that nine-patch. Maybe I should draw end substitute my own nine patch. Anyway in this way I can simply manage it in the Eclipse Layout editor, and that's is good! Yes, you can certainly use other nine-patches from Android (see my previous message on where to find them), or draw your own: http://developer.android.com/guide/topics/graphics/2d-graphics.html#n... The only thing I don't like of the nine-patch way is that I have to draw one nine-patch for all the time I want to change, for example the color of the background or the alpha value, while extending RelativeLayout I can to that by code programmatically. Is it right? You can change the background from code: http://developer.android.com/reference/android/view/View.html#setBack...) http://developer.android.com/reference/android/view/View.html#setBack...) On the other hand, overriding onDraw does give you complete control, so it's a judgment call on flexibility vs. effort (isn't everything?) -- 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
[android-developers] Customizing a RelativeLayout
Hi! I'm trying to customize a RelativeLayout on order to show a nice trasparent black content box. So my class has extended RelativeLayout and has overridden the onDraw() method, but nothing appears in the Eclipse layout editor; the same happens if I try to run my app on the device. I read I have to override dispatchDraw() and this works. I can see my custom layout in the editor, but I'm not able to add child view to the layout. Or better... I add a child in my layout from XML, but I can't see it on the Eclipse layout editor. In this case if I run the app on the device I see my layout drawn not correctly.. only a part of it is drawn or it appears cut. Why? What am I 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
[android-developers] Re: Customizing a RelativeLayout
Because I'd like to draw something similar to this. http://pocketjourney.files.wordpress.com/2008/03/goal.gif?w=500 On 16 Dic, 10:53, Zsolt Vasvari zvasv...@gmail.com wrote: Why would you need to extend RelativeLayout just to change the background? On Dec 16, 5:36 pm, Paolo brand...@gmail.com wrote: Hi! I'm trying to customize a RelativeLayout on order to show a nice trasparent black content box. So my class has extended RelativeLayout and has overridden the onDraw() method, but nothing appears in the Eclipse layout editor; the same happens if I try to run my app on the device. I read I have to override dispatchDraw() and this works. I can see my custom layout in the editor, but I'm not able to add child view to the layout. Or better... I add a child in my layout from XML, but I can't see it on the Eclipse layout editor. In this case if I run the app on the device I see my layout drawn not correctly.. only a part of it is drawn or it appears cut. Why? What am I 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
[android-developers] Re: Customizing a RelativeLayout
ah... and using nine-patch drawable is better than the way I'm following? Why should I prefer this way? I'm asking just to understand :) On 16 Dic, 11:16, Kostya Vasilyev kmans...@gmail.com wrote: Just use android:background with a nine-patch drawable. No need to subclass. You can even copy one of Android's nine-patch backgrounds into your project. Take a look inside the Android SDK directory, then platforms\android-X\data\res\drawable-mdpi (-hdpi). There are some very nice one in there, in particular toast_frame.9.png, zoom_plate, panel_background, etc. -- Kostya 16.12.2010 13:03, Paolo пишет: Because I'd like to draw something similar to this. http://pocketjourney.files.wordpress.com/2008/03/goal.gif?w=500 On 16 Dic, 10:53, Zsolt Vasvarizvasv...@gmail.com wrote: Why would you need to extend RelativeLayout just to change the background? On Dec 16, 5:36 pm, Paolobrand...@gmail.com wrote: Hi! I'm trying to customize a RelativeLayout on order to show a nice trasparent black content box. So my class has extended RelativeLayout and has overridden the onDraw() method, but nothing appears in the Eclipse layout editor; the same happens if I try to run my app on the device. I read I have to override dispatchDraw() and this works. I can see my custom layout in the editor, but I'm not able to add child view to the layout. Or better... I add a child in my layout from XML, but I can't see it on the Eclipse layout editor. In this case if I run the app on the device I see my layout drawn not correctly.. only a part of it is drawn or it appears cut. Why? What am I wrong? -- 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
[android-developers] Re: Customizing a RelativeLayout
Ok I'm going to try it ;) On 16 Dic, 11:31, Kostya Vasilyev kmans...@gmail.com wrote: Paolo, Yes, using a nine-patch drawable background is easy, efficient, and produces great results. Try this: open a layout in XML mode and add this attribute: android:background=@android:drawable/toast_frame Think you'll like it :) -- Kostya 16.12.2010 13:24, Paolo пишет: ah... and using nine-patch drawable is better than the way I'm following? Why should I prefer this way? I'm asking just to understand :) On 16 Dic, 11:16, Kostya Vasilyevkmans...@gmail.com wrote: Just use android:background with a nine-patch drawable. No need to subclass. You can even copy one of Android's nine-patch backgrounds into your project. Take a look inside the Android SDK directory, then platforms\android-X\data\res\drawable-mdpi (-hdpi). There are some very nice one in there, in particular toast_frame.9.png, zoom_plate, panel_background, etc. -- Kostya 16.12.2010 13:03, Paolo пишет: Because I'd like to draw something similar to this. http://pocketjourney.files.wordpress.com/2008/03/goal.gif?w=500 On 16 Dic, 10:53, Zsolt Vasvarizvasv...@gmail.com wrote: Why would you need to extend RelativeLayout just to change the background? On Dec 16, 5:36 pm, Paolobrand...@gmail.com wrote: Hi! I'm trying to customize a RelativeLayout on order to show a nice trasparent black content box. So my class has extended RelativeLayout and has overridden the onDraw() method, but nothing appears in the Eclipse layout editor; the same happens if I try to run my app on the device. I read I have to override dispatchDraw() and this works. I can see my custom layout in the editor, but I'm not able to add child view to the layout. Or better... I add a child in my layout from XML, but I can't see it on the Eclipse layout editor. In this case if I run the app on the device I see my layout drawn not correctly.. only a part of it is drawn or it appears cut. Why? What am I wrong? -- 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
[android-developers] Re: Customizing a RelativeLayout
I've tried, but I don't like that nine-patch. Maybe I should draw end substitute my own nine patch. Anyway in this way I can simply manage it in the Eclipse Layout editor, and that's is good! The only thing I don't like of the nine-patch way is that I have to draw one nine-patch for all the time I want to change, for example the color of the background or the alpha value, while extending RelativeLayout I can to that by code programmatically. Is it right? On 16 Dic, 12:18, Paolo brand...@gmail.com wrote: Ok I'm going to try it ;) On 16 Dic, 11:31, Kostya Vasilyev kmans...@gmail.com wrote: Paolo, Yes, using a nine-patch drawable background is easy, efficient, and produces great results. Try this: open a layout in XML mode and add this attribute: android:background=@android:drawable/toast_frame Think you'll like it :) -- Kostya 16.12.2010 13:24, Paolo пишет: ah... and using nine-patch drawable is better than the way I'm following? Why should I prefer this way? I'm asking just to understand :) On 16 Dic, 11:16, Kostya Vasilyevkmans...@gmail.com wrote: Just use android:background with a nine-patch drawable. No need to subclass. You can even copy one of Android's nine-patch backgrounds into your project. Take a look inside the Android SDK directory, then platforms\android-X\data\res\drawable-mdpi (-hdpi). There are some very nice one in there, in particular toast_frame.9.png, zoom_plate, panel_background, etc. -- Kostya 16.12.2010 13:03, Paolo пишет: Because I'd like to draw something similar to this. http://pocketjourney.files.wordpress.com/2008/03/goal.gif?w=500 On 16 Dic, 10:53, Zsolt Vasvarizvasv...@gmail.com wrote: Why would you need to extend RelativeLayout just to change the background? On Dec 16, 5:36 pm, Paolobrand...@gmail.com wrote: Hi! I'm trying to customize a RelativeLayout on order to show a nice trasparent black content box. So my class has extended RelativeLayout and has overridden the onDraw() method, but nothing appears in the Eclipse layout editor; the same happens if I try to run my app on the device. I read I have to override dispatchDraw() and this works. I can see my custom layout in the editor, but I'm not able to add child view to the layout. Or better... I add a child in my layout from XML, but I can't see it on the Eclipse layout editor. In this case if I run the app on the device I see my layout drawn not correctly.. only a part of it is drawn or it appears cut. Why? What am I wrong? -- 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
[android-developers] Re: Customizing a RelativeLayout
Thanks a lot for your answer ;) Before to use my own nine-patch, I'd like to understand what I'm wrong extending the RelativeLayout. So, in other topics I found that Roman Guy suggested to use setWillNotDraw(false). Using this flag I can show my Custom Layout correctly running on a device (why?), but I continue to not see its own child in the Eclipse editor. It isn't a big problem, because I know what I'm doing, but I'd like that all the things work fine also with the editor. About this Eclipse shows me a warining that says: AndroidManifest: Ignoring unknown 'TextView' XML element - com.android.ide.eclipse.adt where TextView is RelativeLayout's chid. Maybe I'm forgetting something... :( On 16 Dic, 12:42, Kostya Vasilyev kmans...@gmail.com wrote: 16.12.2010 14:34, Paolo пишет: I've tried, but I don't like that nine-patch. Maybe I should draw end substitute my own nine patch. Anyway in this way I can simply manage it in the Eclipse Layout editor, and that's is good! Yes, you can certainly use other nine-patches from Android (see my previous message on where to find them), or draw your own: http://developer.android.com/guide/topics/graphics/2d-graphics.html#n... The only thing I don't like of the nine-patch way is that I have to draw one nine-patch for all the time I want to change, for example the color of the background or the alpha value, while extending RelativeLayout I can to that by code programmatically. Is it right? You can change the background from code: http://developer.android.com/reference/android/view/View.html#setBack...) http://developer.android.com/reference/android/view/View.html#setBack...) On the other hand, overriding onDraw does give you complete control, so it's a judgment call on flexibility vs. effort (isn't everything?) -- 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
[android-developers] double buffering OpenGL ES
Hi there, I'm a newbie in OpenGL and OpenGL ES. I need some clarifications about double buffering in Android. I read Android supports implicit double-buffering for OpenGL, is right? Could I manage it or it is totally controlled by Android? Thanks in advance. Paolo -- You received this message because you are subscribed to the Google 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] double buffering OpenGL ES
Hi there, I'm a newbie in OpenGL and OpenGL ES. I need some clarifications about double buffering in Android. I read Android supports implicit double-buffering for OpenGL, is right? Could I manage it or it is totally controlled by Android? Thanks in advance. Paolo -- You received this message because you are subscribed to the Google 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] Native Browser intent filters
Hello, There is something I cannot understand in the native browser application (com.android.browser/.BrowserActivity) intent filters for the VIEW intent. Specifically these 2 filters: (/packages/apps/Browser/AndroidManifest.xml) !-- For these schemes were not particular MIME type has been supplied, we are a good candidate. -- intent-filter action android:name=android.intent.action.VIEW / category android:name=android.intent.category.DEFAULT / category android:name=android.intent.category.BROWSABLE / data android:scheme=http / data android:scheme=https / data android:scheme=about / data android:scheme=javascript / /intent-filter !-- For these schemes where any of these particular MIME types have been supplied, we are a good candidate. -- intent-filter action android:name=android.intent.action.VIEW / category android:name=android.intent.category.BROWSABLE / category android:name=android.intent.category.DEFAULT / data android:scheme=http / data android:scheme=https / data android:scheme=inline / data android:mimeType=text/html/ data android:mimeType=text/plain/ data android:mimeType=application/xhtml+xml/ data android:mimeType=application/vnd.wap.xhtml+xml/ /intent-filter Now, it seems to me that the second filter is partially redundant compared to the first one. Specifically, why to put there these again? data android:scheme=http / data android:scheme=https / A VIEW intent over http or https with any mime type specified will be still handled by the first filter. Can anyone please explain me why that section has been duplicated? Is it just a matter of style or best practice? 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: Detect touch event on a OpenGL object
Yes you are right. is white, sorry I was confused. :) So, I have tried to implement the color-picking solution, without fortune, because I always get from glReadPixels... and I don't understand why... Maybe I can't read from the frame buffer? I'm using Android 2.2 and 2.1. :( This is my code, where x and y are the coordinates of point on the screen where I touch. ByteBuffer buff = ByteBuffer.allocateDirect(4); buff.order(ByteOrder.nativeOrder()); byte [] array = new byte[4]; gl.glReadPixels(x, y, 1, 1, GL10.GL_RGBA, GL10.GL_UNSIGNED_BYTE, buff); buff.get(array); Log.d(DEBUG, + array[0] + - + array[1] + - + array[2] + - + array[3]); On 29 Nov, 19:52, Phil Endecott spam_from_goo...@chezphil.org wrote: gl.glColor4f(colorCount, 0, 0, 1); markers.get(i).draw(); colorCount++; but unfortunately it doesn't work. The color remains always white (0,0,0,1) in RGBA. White is 1,1,1,1. The colour components passed to glColor4f are floats and should range between 0 and 1. So colorCount++ is probably not what you want. Maybe it will work if you do colorCount+=0.01. But I suggest using glColour4ub (if that's available in the Java binding) as that lets you pass bytes and you know you'll get the exact same values back without any float-to-int conversion issues. -- You received this message because you are subscribed to the Google 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] Detect touch event on a OpenGL object
Hi there! I have developed an Augmented Reality App using OpenGL ES 1.1. It's really cool and I'm very happy for that, because Im' an opengl beginner. Now I have a problem... :( I'd like to detect touch events on some opengl objects. I know I can't use View.EventListener with those, because these objects don't inherit from View class. They are simply subclasses of Object that implement an opengl draw function. I've read about picking in OpenGL, but before to take this way, I want to understand if there are other solutions. So, which can the solution be to do that? Thanks in advance. Paolo -- You received this message because you are subscribed to the Google 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: Detect touch event on a OpenGL object
Yes I have just seen that selected mode is not available in OpenGL ES. So, I'm trying to follow the other ways, starting from color- solution, that seems the simplest. But I already get a problem... :( At every frame I'd draw many markers (every marker has different coordinates) in the scene and I do it in one draw function, something like this: public void onDrawFrame(GL10 gl) { float colorCount = 0.0f; gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); gl.glMatrixMode(GL10.GL_MODELVIEW); gl.glLoadIdentity(); gl.glLoadMatrixf(matrix.val, 0); for(int i = 0; imarkers.size(); i++){ gl.glColor4f(colorCount, 0, 0, 1); markers.get(i).draw(); colorCount++; } } but unfortunately it doesn't work. The color remains always white (0,0,0,1) in RGBA. I'm confused. I know it may be a stupid question, but I'm a beginner in OpenGL. On 29 Nov, 16:59, Phil Endecott spam_from_goo...@chezphil.org wrote: I've read about picking in OpenGL Beware that selection mode is not available in OpenGL ES. I want to understand if there are other solutions. You have various options, but none is simple: 1. unproject from the (x,y) screen coordinates to a ray in model space, and work out which object(s) intersect that ray. 2. unproject from the (x,y) screen coordinates and the corresponding z coordinate from the depth buffer to a point in model space, and work out which object includes that point. 3. Draw your entire scene a second time into an off-screen framebuffer (possibly at lower resolution), but instead of using the objects' actual textures or colours, use a unique colour for each object. Then just look at the colour in this framebuffer at the selected (x,y) point, and you can decode the corresponding object. These are all general techniques. Sometimes your application will have characteristics that let you do something simpler, e.g. a constrained projection or object layout. Good luck! Phil. -- You received this message because you are subscribed to the Google 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] Is it possible implement Zoom Feature in a custom Camera Activity or not?
Hi there, I'm develop a custom Camera Activity in my app, to take pictures etc... now I'd like to add a new feature like Zoom. I remember that Eclair doesn't provide API for the zoom feature for the Camera, but I've noticed that Froyo does it, right? Reading the Froyo API there is Camera.OnZoomChangeListener interface and the Camera class provides also some methods, I think they are related to it, like starSmoothZoom() and many others in Camera.Parameters etc... I use the N1 to test my app and checking if the smoothZoom is supported with isSmoothZoomSupported and I obtain false, it could be ok, maybe the N1 doesn't support it... but if I check if the N1 support the zoom with isZoomSupported I obtained true, but there isn't no methods to do that... what does it mean? It's strange that the device support Zoom , but the API doesn't provide mechanisms for that. Where am I wrong? Is it possible that the only solution is to do the zoom manually working on the surfaceview or on the preview frame? Thanks in advance. Paolo -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: How to manage severla bitrmap for a ListView avoiding OutOfMemory?
Thanks Victor, for your answer, but the adapter alone doesn't solve my problem. The softreference is cleared, by definition, when the system needs memory, not when then objects looses all the references. Thanks to Streets of Boston too, I haven't thounght about your solution with LinkedHashMap, overriding removeEldestEntry() to limit the cache-size. It' very interesting as solution. I'm going to try quickly. I will inform you about the result. Thanks to all. On 17 Nov, 20:37, Streets Of Boston flyingdutc...@gmail.com wrote: Use a LinkedHashmap for a cache and implement the method 'removeEldestEntry(...)' appropriately to limit the cache-size. If the LinkedHashmap cache contains your image, code the 'getView(...)' of your list-adapter to immediately assign the (thumbnail) image to the image-view. If the LinkedHashmap cache does not contain your image, code the 'getView(...)' to assign a temporary 'loading...' placeholder to the image-view and start (asynchronously) loading the missing thumbnail. When the thumbnail is loaded, add it to the cache. When the cache changes and/or the list stops scrolling (see List13.java from the APIDemos as an example), replace any temporary 'loading...' placeholder with the newly loaded image(s). On Nov 17, 8:50 am, Paolo brand...@gmail.com wrote: Hi there! I have to manage several Bitmap in a ListView where each row is composed by one thumbnail and one textview. This ListView can be very long, over 500 rows... There are two problems I have to solve: 1) it is better if I cache all the bitmaps, maybe using SoftReferences in a HashMap. I've tried this way, but I noticed a strange behavior with the SoftReferences. It seems that the GC clean them too fast. Why? 2) In order to implement the cache correctly I'd also like to understand which is the best practice you suggest me to realize a image lazy loading. For example... I'm thinking to load all the data for first and then to load only the thumbnails, but only those really visible on the device screen at the and of the scroll action. Thanks in advance. Paolo -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] How to manage severla bitrmap for a ListView avoiding OutOfMemory?
Hi there! I have to manage several Bitmap in a ListView where each row is composed by one thumbnail and one textview. This ListView can be very long, over 500 rows... There are two problems I have to solve: 1) it is better if I cache all the bitmaps, maybe using SoftReferences in a HashMap. I've tried this way, but I noticed a strange behavior with the SoftReferences. It seems that the GC clean them too fast. Why? 2) In order to implement the cache correctly I'd also like to understand which is the best practice you suggest me to realize a image lazy loading. For example... I'm thinking to load all the data for first and then to load only the thumbnails, but only those really visible on the device screen at the and of the scroll action. Thanks in advance. Paolo -- You received this message because you are subscribed to the Google 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: is there a limit for the lenght of a texview's text?
ok I try On 2 Nov, 22:01, TreKing treking...@gmail.com wrote: On Tue, Nov 2, 2010 at 3:43 PM, Paolo brand...@gmail.com wrote: the font color is the default. Change it and the background color just to see what happens. --- -- 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] is there a limit for the numebr of markers to show on a MapView?
As the object of this topic...is there a limit for the numebr of markers to show on a MapView at the same time with the Google API? -- You received this message because you are subscribed to the Google 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: is there a limit for the numebr of markers to show on a MapView?
ok. At this point i think it's better to show only the markers actually visible in the area... because i can have over 1000 markers to show in the map at the same time. On 3 Nov, 15:30, TreKing treking...@gmail.com wrote: On Wed, Nov 3, 2010 at 5:58 AM, Paolo brand...@gmail.com wrote: As the object of this topic...is there a limit for the numebr of markers to show on a MapView at the same time with the Google API? Officially? I don't think so, but at some point you're going to run out of memory, so there's SOME limit. --- -- 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] is there a limit for the lenght of a texview's text?
Hi there! I've found a problem with textview when i have to show a long text in a textview into a scroolview. The text is over 4800 characters and when I have to show it the textview is empty. Nothing is showed. is there a limit for the lenght of a texview's text by default? any solution? thanks to all. -- You received this message because you are subscribed to the Google 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: is there a limit for the lenght of a texview's text?
No, i haven't. If I cut the same string at smaller dimension, like 3000 characters instead of the real lenght (4782), the textview is showed correctly. Why this behaviour? On 2 Nov, 17:46, TreKing treking...@gmail.com wrote: On Tue, Nov 2, 2010 at 4:39 AM, Paolo brand...@gmail.com wrote: I've found a problem with textview when i have to show a long text in a textview into a scroolview. The text is over 4800 characters and when I have to show it the textview is empty. Nothing is showed. Did you test with smaller sized strings? Do you have the same problem? --- -- 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: is there a limit for the lenght of a texview's text?
I can scroll the the view unitl the end, it is very long, but empy and black. But in the code if I print the textview's content in the Log window I can see all the string. On 2 Nov, 19:40, Kumar Bibek coomar@gmail.com wrote: Nothing is shown? Are you sure?? On Nov 2, 10:32 pm, Paolo brand...@gmail.com wrote: No, i haven't. If I cut the same string at smaller dimension, like 3000 characters instead of the real lenght (4782), the textview is showed correctly. Why this behaviour? On 2 Nov, 17:46, TreKing treking...@gmail.com wrote: On Tue, Nov 2, 2010 at 4:39 AM, Paolo brand...@gmail.com wrote: I've found a problem with textview when i have to show a long text in a textview into a scroolview. The text is over 4800 characters and when I have to show it the textview is empty. Nothing is showed. Did you test with smaller sized strings? Do you have the same problem? --- -- 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: is there a limit for the lenght of a texview's text?
the font color is the default. It is very strange because if i cut the string at 3000 characters I can see it... On 2 Nov, 20:33, TreKing treking...@gmail.com wrote: On Tue, Nov 2, 2010 at 2:31 PM, Paolo brand...@gmail.com wrote: I can scroll the the view unitl the end, it is very long, but empy and black. But in the code if I print the textview's content in the Log window I can see all the string. May your string font color is black or transparent? Try explicitly setting it to something else. --- -- 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: How to compile Android Launcher source code?
Dianne thanks for your answer. Well, at the moment I don't want to place my Launcher on the Market, but only to do it for a private use on my Froyo 2.2 device. My idea is to compile the default Launcher in Eclipse and to modify/ extend it with different features, as ADW Launcher did. How can I do this? I'm thinking to re-compile Android from source code, is the right way? Please answer me. Thamks, Paolo On 21 Set, 19:14, Dianne Hackborn hack...@android.com wrote: Launcher currently uses a number of experimental/private APIs. If you are doing this to create something you will place on Market, you *must* change the code to not use those APIs. If you are doing this as part of platform development for a device, personally I would recommend just using the platform's build system. Any tricks one uses to build Launcher in Eclipse without fixing the code will *not* create an application that should be placed on market. (And if you do, I can guarantee that future versions of the platform will break the resulting app.) On Tue, Sep 21, 2010 at 9:26 AM, Paolo brand...@gmail.com wrote: I followed the guide you have posted. Thanks a lot. Now I can see the android SDK source code in Eclipse, but I'm still not able to compile the Launcher anyway... Eclipse always shows the same error on the Launcher code... why? Is there something I don't undestand? Thanks, Paolo On 21 Set, 13:01, mani smanikanda...@gmail.com wrote: Hi you cannot compile the Launcher code in eclipse with SDK. Certain API's are private not exposed to the public SDK. Ex. import android.renderscript.* But there are certain ways to compile AOSP in eclipse. Please go through this link. http://blog.michael-forster.de/2008/12/view-android-source-code-in-ec... Thanks, Mani On Sep 21, 6:21 pm, Paolo brand...@gmail.com wrote: I have just donwload the source code of the Android default Launcher here: http://android.git.kernel.org/?p=platform/packages/apps/Launcher.git;... But when I import the project, i can't compile it because there is a lot of errors. Many of this are unresolved name, package, class and variables... why? what is the problem? How can I solve it? Please help me.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.comandroid-developers%2Bunsubs cr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- You received this message because you are subscribed to the Google 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] Horizontal scroll with paging like iPad home screen
I have to implement this kind of feature for a custom home screen in Android. I've noticed that it's impossible to use GridView with an HorizontalScrollView... so this is a big problem... is there any other solution? I thought that i would have to do a sort of my DataGridView, with its own BaseAdapter, using it with the HorizontalScrolView... Could it be the right way? Another idea could be to use Animations with gesture to move the DataGridView? I'm not sure that is possible to do that, could you helpl me to undestrand which is the better way? 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] How to compile Android Launcher source code?
I have just donwload the source code of the Android default Launcher here: http://android.git.kernel.org/?p=platform/packages/apps/Launcher.git;a=summary But when I import the project, i can't compile it because there is a lot of errors. Many of this are unresolved name, package, class and variables... why? what is the problem? How can I solve it? Please help me.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: How to compile Android Launcher source code?
I followed the guide you have posted. Thanks a lot. Now I can see the android SDK source code in Eclipse, but I'm still not able to compile the Launcher anyway... Eclipse always shows the same error on the Launcher code... why? Is there something I don't undestand? Thanks, Paolo On 21 Set, 13:01, mani smanikanda...@gmail.com wrote: Hi you cannot compile the Launcher code in eclipse with SDK. Certain API's are private not exposed to the public SDK. Ex. import android.renderscript.* But there are certain ways to compile AOSP in eclipse. Please go through this link.http://blog.michael-forster.de/2008/12/view-android-source-code-in-ec... Thanks, Mani On Sep 21, 6:21 pm, Paolo brand...@gmail.com wrote: I have just donwload the source code of the Android default Launcher here:http://android.git.kernel.org/?p=platform/packages/apps/Launcher.git;... But when I import the project, i can't compile it because there is a lot of errors. Many of this are unresolved name, package, class and variables... why? what is the problem? How can I solve it? Please help me.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] Question about NDK
Hi there, I should port a framework written in C/C++ to Android, in order to allow developer to use it to implement application. Is the NDK the right way? and then... this framework won't open, so how can I distribute it ready to be used in every android app? Thanks to anyone helps me. -- You received this message because you are subscribed to the Google 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: Sensors with thread or not?
ok, i understand. Perfect. Thanks a lot. On 2 Set, 18:27, Bret Foreman bret.fore...@gmail.com wrote: The service is started automatically when you bind to it and stopped when the last customer unbinds from it. In this way, multiple activities or applications can all use the sensor service and it gets started and stopped by the system as appropriate. On Sep 2, 1:34 am, Paolo brand...@gmail.com wrote: Thanks for your answer! well... but how do you manage the service? I explain better... if you close your app or simply you don't need your activity anymore, what happens to the service? Do you stop 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: Sensors with thread or not?
Thanks for your answer! well... but how do you manage the service? I explain better... if you close your app or simply you don't need your activity anymore, what happens to the service? Do you stop it? On 1 Set, 17:05, Bret Foreman bret.fore...@gmail.com wrote: I use sensors extensively and find that they work best in a Service which you can bind to your Activity. -- You received this message because you are subscribed to the Google 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] Sensors with thread or not?
I have an activity, that uses sensor strongly. Until now I have managed the sensor with a background thread, because I thought it was better to understand and to develop my app, but now I'm not sure about it. The performance is very low. Do you think i should use sensor in the activity directly, without using thread? Generally which is the best way? -- You received this message because you are subscribed to the Google 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 all icons positions in wallpaper
How do I get (given it's possible to do) the position of every icon in the screen, talking about a live wallpaper? Some array with x and y's?? Hope so :) but how? 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] Dynamic add view to scrollview problem
Hi, i have a simple activity with a linearlayout and a scrollview. Dynamically i add a tablerow with one textview and a button into scrollview. But when i launch app scrollview doesn't contain all tablerow... infact the first row that i see is this is a text - 3 - Rows from 1 to 2 are cut off from screen! Why ? Link to screenshot : http://i30.tinypic.com/2vs0roh.jpg Here's code : int contatore = 0; final TableLayout tl = (TableLayout)findViewById(R.id.dettaglio); tl.setPadding(5, 0, 0, 0); if (text_to_do.moveToFirst()) { do { contatore=contatore+1; int index = text_to_do.getColumnIndex(testo); String testo = text_to_do.getString(index); final TableRow tr = new TableRow(this); final TextView casella_testo = new TextView(this); if (contatore%2==0) { tr.setBackgroundColor(getResources().getColor(R.color.pari)); } else { tr.setBackgroundColor(getResources().getColor(R.color.dispari)); } testo = This is a text - +contatore + -; casella_testo.setText(testo); casella_testo.setWidth(200); casella_testo.setPadding(10, 0, 0, 10); Button butt = new Button(this); butt.setBackgroundResource(R.drawable.try_this); Typeface font = Typeface.createFromAsset(getAssets(), BAARS___.TTF); casella_testo.setTextSize(20); casella_testo.setTypeface(font); tr.addView(casella_testo); tr.addView(butt); tr.setGravity(Gravity.CENTER); butt.setHeight(LayoutParams.WRAP_CONTENT); butt.setWidth(LayoutParams.WRAP_CONTENT); butt.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // do something startActivity(intent); } }); tr.setPadding(0,10,0,0); tl.addView(tr,new TableLayout.LayoutParams( LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); } while (text_to_do.moveToNext()); } And XML : ?xml version=1.0 encoding=utf-8? LinearLayout xmlns:android=http://schemas.android.com/apk/res/android; android:layout_height=wrap_content android:layout_width=fill_parent android:paddingLeft=0dip android:paddingRight=1dip android:orientation=vertical ScrollView android:id=@+id/scrllvwNo1 android:layout_width=fill_parent android:layout_height=wrap_content android:layout_gravity=center_vertical|center_horizontal TableLayout android:id=@+id/dettaglio android:orientation=vertical android:layout_height=wrap_content android:layout_width=fill_parent android:layout_gravity=center android:stretchColumns=0 /TableLayout /ScrollView /LinearLayout -- You received this message because you are subscribed to the Google 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: Leaked Window changing orientation with SubMenu
I tried, but nothing... I always get the leaked window... :( I have also tried a simple test app with only one Activity with a Button to show the submenu... I got the same problem, is it normal? I don't understand where is the problem! Try this, please public class SubMenuTestActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Posizione di riferimento int order = Menu.FIRST; // Definizione del gruppo int myGroupId = 0; // Aggiungiamo un menu normale menu.add(myGroupId, order, order++, Normal); // Aggiungiamo un sottomenu int subGroupId = 10; SubMenu subMenu = menu .addSubMenu(subGroupId, order, order++, SubMenu); subMenu.add(subGroupId + 1, order, order++, Prima Multipla) .setCheckable(true); subMenu.add(subGroupId + 1, order, order++, Seconda Multipla) .setCheckable(true); subMenu.add(subGroupId + 2, order, order++, Prima Exclusive); subMenu.add(subGroupId + 2, order, order++, Seconda Exclusive); subMenu.setGroupCheckable(subGroupId + 2, true, true); // Impostiamo il titolo subMenu.setHeaderTitle(R.string.sub_title); subMenu.setHeaderIcon(R.drawable.icon); subMenu.setIcon(R.drawable.icon); // Visualizziamo il menu return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { item.setChecked(!item.isChecked()); return super.onOptionsItemSelected(item); } } On 27 Lug, 18:57, Paolo brand...@gmail.com wrote: I thought Android managed it for me, too. But it doesn't seem to be so... Now I try your suggestion... I inform you soon. thanks. On 27 Lug, 18:15, TreKing treking...@gmail.com wrote: On Tue, Jul 27, 2010 at 5:52 AM, Paolo brand...@gmail.com wrote: I get a leaked window when I have a submenu visible on the screen and I rotate the screen. Weird. Seems like something the framework should handle automatically ... If it would be a Dialog I colud call dismiss() in the onStop() before to change the orientation, but with a SubMenu how do I can solve it? Maybe this?:http://developer.android.com/reference/android/app/Activity.html#clos...() http://developer.android.com/reference/android/app/Activity.html#clos...() --- -- 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] Leaked Window changing orientation with SubMenu
Hi there, I get a leaked window when I have a submenu visible on the screen and I rotate the screen. If it would be a Dialog I colud call dismiss() in the onStop() before to change the orientation, but with a SubMenu how do I can solve it? Thanks Paolo -- You received this message because you are subscribed to the Google 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: Leaked Window changing orientation with SubMenu
I thought Android managed it for me, too. But it doesn't seem to be so... Now I try your suggestion... I inform you soon. thanks. On 27 Lug, 18:15, TreKing treking...@gmail.com wrote: On Tue, Jul 27, 2010 at 5:52 AM, Paolo brand...@gmail.com wrote: I get a leaked window when I have a submenu visible on the screen and I rotate the screen. Weird. Seems like something the framework should handle automatically ... If it would be a Dialog I colud call dismiss() in the onStop() before to change the orientation, but with a SubMenu how do I can solve it? Maybe this?:http://developer.android.com/reference/android/app/Activity.html#clos...() http://developer.android.com/reference/android/app/Activity.html#clos...() --- -- 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: OpenGL strange Exception: Nexus one upgrade to 2.2 causes app to crash?
Hi there! I've the same problem... Have you solve it? Please let me know. Thanks Paolo On 5 Lug, 14:41, Aidan C aidanchu...@gmail.com wrote: Hey Guys, I've made some edits to my application but I'm pretty sure it crashing is linked to my updating my Nexus One. I've included the error as well as all code I think is relevant. Anyone got any ideas? 07-05 12:07:04.292: ERROR/AndroidRuntime(5751): FATAL EXCEPTION: GLThread 11 07-05 12:07:04.292: ERROR/AndroidRuntime(5751): java.lang.IllegalArgumentException: No config chosen 07-05 12:07:04.292: ERROR/AndroidRuntime(5751): at android.opengl.GLSurfaceView $BaseConfigChooser.chooseConfig(GLSurfaceView.java:771) 07-05 12:07:04.292: ERROR/AndroidRuntime(5751): at android.opengl.GLSurfaceView$EglHelper.start(GLSurfaceView.java:916) 07-05 12:07:04.292: ERROR/AndroidRuntime(5751): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java: 1246) 07-05 12:07:04.292: ERROR/AndroidRuntime(5751): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1116) public class GLCamTest extends Activity { private CamLayer mPreview; private GLLayer glView; static int counter=0; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); counter++; } /** Called when the activity is first created. */ @Override public void onResume() { super.onResume(); this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); final Window win = getWindow(); win.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); // Hide the window title. requestWindowFeature(Window.FEATURE_NO_TITLE); glView=new GLLayer(this); mPreview = new CamLayer(this, glView); setContentView(glView); addContentView(mPreview, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); } protected void onPause() { super.onPause(); if (counter=2) { System.exit(0); } } } public class GLLayer extends GLSurfaceView implements SurfaceHolder.Callback, Camera.PreviewCallback, Renderer { int onDrawFrameCounter=1; int[] cameraTexture; byte[] glCameraFrame=new byte[256*256]; //size of a texture must be a power of 2 FloatBuffer cubeBuff; FloatBuffer texBuff; public GLLayer(Context c) { super(c); this.setEGLConfigChooser(5, 6, 5, 8, 16, 0); this.setRenderer(this); this.getHolder().setFormat(PixelFormat.TRANSLUCENT); } public void onDrawFrame(GL10 gl) { onDrawFrameCounter++; gl.glEnable(GL10.GL_TEXTURE_2D); gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); bindCameraTexture(gl); gl.glLoadIdentity(); GLU.gluLookAt(gl, 0, 0, 4.2f, 0, 0, 0, 0, 1, 0); gl.glRotatef(onDrawFrameCounter,1,0,0); //Rotate the camera image gl.glRotatef((float)Math.sin(onDrawFrameCounter/ 20.0f)*40,0,1,0); //Rotate the camera image gl.glRotatef((float)Math.cos(onDrawFrameCounter/ 40.0f)*40,0,0,1); //Rotate the camera image gl.glNormal3f(0,0,1); gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, 4); gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 4, 4); gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 8, 4); gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP,12, 4); gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP,16, 4); gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP,20, 4); } public void onSurfaceChanged(GL10 gl, int width, int height) { gl.glViewport(0, 0, width, height); float ratio = (float) width / height; gl.glMatrixMode(GL10.GL_PROJECTION); gl.glLoadIdentity(); gl.glFrustumf(-ratio, ratio, -1, 1, 1, 10); gl.glMatrixMode(GL10.GL_MODELVIEW); gl.glLoadIdentity(); GLU.gluLookAt(gl, 0, 0, 4.2f, 0, 0, 0, 0, 1, 0); } public void onSurfaceCreated(GL10 gl, EGLConfig config) { gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_FASTEST); gl.glClearColor(0, 0, 0, 0); gl.glEnable(GL10.GL_CULL_FACE); gl.glShadeModel(GL10.GL_SMOOTH); gl.glEnable(GL10.GL_DEPTH_TEST); cubeBuff = makeFloatBuffer(camObjCoord); texBuff = makeFloatBuffer(camTexCoords); gl.glVertexPointer(3, GL10.GL_FLOAT, 0, cubeBuff); gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); gl.glTexCoordPointer(2, GL10
[android-developers] Re: OpenGL strange Exception: Nexus one upgrade to 2.2 causes app to crash?
I solved it today simply set a differente EGLConfigChooser... from: this.setEGLConfigChooser(5, 6, 5, 8, 16, 0); to: this.setEGLConfigChooser(8 8, 8, 8, 16, 0); It seems to work well, now. But I don't know why :( On 22 Lug, 11:38, Paolo brand...@gmail.com wrote: Hi there! I've the same problem... Have you solve it? Please let me know. Thanks Paolo On 5 Lug, 14:41, Aidan C aidanchu...@gmail.com wrote: Hey Guys, I've made some edits to my application but I'm pretty sure it crashing is linked to my updating my Nexus One. I've included the error as well as all code I think is relevant. Anyone got any ideas? 07-05 12:07:04.292: ERROR/AndroidRuntime(5751): FATAL EXCEPTION: GLThread 11 07-05 12:07:04.292: ERROR/AndroidRuntime(5751): java.lang.IllegalArgumentException: No config chosen 07-05 12:07:04.292: ERROR/AndroidRuntime(5751): at android.opengl.GLSurfaceView $BaseConfigChooser.chooseConfig(GLSurfaceView.java:771) 07-05 12:07:04.292: ERROR/AndroidRuntime(5751): at android.opengl.GLSurfaceView$EglHelper.start(GLSurfaceView.java:916) 07-05 12:07:04.292: ERROR/AndroidRuntime(5751): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java: 1246) 07-05 12:07:04.292: ERROR/AndroidRuntime(5751): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1116) public class GLCamTest extends Activity { private CamLayer mPreview; private GLLayer glView; static int counter=0; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); counter++; } /** Called when the activity is first created. */ @Override public void onResume() { super.onResume(); this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); final Window win = getWindow(); win.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); // Hide the window title. requestWindowFeature(Window.FEATURE_NO_TITLE); glView=new GLLayer(this); mPreview = new CamLayer(this, glView); setContentView(glView); addContentView(mPreview, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); } protected void onPause() { super.onPause(); if (counter=2) { System.exit(0); } } } public class GLLayer extends GLSurfaceView implements SurfaceHolder.Callback, Camera.PreviewCallback, Renderer { int onDrawFrameCounter=1; int[] cameraTexture; byte[] glCameraFrame=new byte[256*256]; //size of a texture must be a power of 2 FloatBuffer cubeBuff; FloatBuffer texBuff; public GLLayer(Context c) { super(c); this.setEGLConfigChooser(5, 6, 5, 8, 16, 0); this.setRenderer(this); this.getHolder().setFormat(PixelFormat.TRANSLUCENT); } public void onDrawFrame(GL10 gl) { onDrawFrameCounter++; gl.glEnable(GL10.GL_TEXTURE_2D); gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); bindCameraTexture(gl); gl.glLoadIdentity(); GLU.gluLookAt(gl, 0, 0, 4.2f, 0, 0, 0, 0, 1, 0); gl.glRotatef(onDrawFrameCounter,1,0,0); //Rotate the camera image gl.glRotatef((float)Math.sin(onDrawFrameCounter/ 20.0f)*40,0,1,0); //Rotate the camera image gl.glRotatef((float)Math.cos(onDrawFrameCounter/ 40.0f)*40,0,0,1); //Rotate the camera image gl.glNormal3f(0,0,1); gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, 4); gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 4, 4); gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 8, 4); gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP,12, 4); gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP,16, 4); gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP,20, 4); } public void onSurfaceChanged(GL10 gl, int width, int height) { gl.glViewport(0, 0, width, height); float ratio = (float) width / height; gl.glMatrixMode(GL10.GL_PROJECTION); gl.glLoadIdentity(); gl.glFrustumf(-ratio, ratio, -1, 1, 1, 10); gl.glMatrixMode(GL10.GL_MODELVIEW); gl.glLoadIdentity(); GLU.gluLookAt(gl, 0, 0, 4.2f, 0, 0, 0, 0, 1, 0); } public void onSurfaceCreated(GL10 gl, EGLConfig config) { gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_FASTEST); gl.glClearColor(0, 0, 0, 0); gl.glEnable(GL10.GL_CULL_FACE
[android-developers] [openGL] how to rotate quad around its center?
Hi guys! I'm a newbie in OpenGL. :D I'm trying to rotate a quad around its center. This is my scenario: I've a quad, drawn with TRIANGLE_STRIP, at specified coordinates. Now I want to rotate of 45 degrees around its center, without move it from its position, not around the origin of the aces. I hope you are able to understand my english... :) How can I do that? Thanks Paolo -- You received this message because you are subscribed to the Google 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: [openGL] how to rotate quad around its center?
Hi leigh! I've tried, but it doesn't work... the quad goes in a wrong position : ( My quad has these coordinates //vertex bottom left vertex[0] = 9.5f; vertex[1] = 10f; vertex[2] = 0.0f; //top left vertex[3] = 9.5f; vertex[4] = 11.0f; vertex[5] = 0.0f; //bottom right vertex[6] = 10.5f; vertex[7] = 10f; vertex[8] = 0.0f; //top right vertex[9] = 10.5; vertex[10] = 11f; vertex[11] = 0.0f; and this is my draw function... public void draw(GL10 gl){ gl.glPushMatrix(); gl.glTranslatef(-10, -10.5f, 0); //to the origin gl.glRotatef(45, 0, 0, -1); //rotate gl.glTranslatef(10, 10.5f, -2.0f); //back to previous position // Enabled the vertices buffer for writing and to be used during // rendering. gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); // Specifies the location and data format of an array of vertex // coordinates to use when rendering. gl.glVertexPointer(3, GL10.GL_FLOAT, 0, markerBuffer); gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, NUMERO_VERTICI); // Disable the vertices buffer. gl.glDisableClientState(GL10.GL_VERTEX_ARRAY); gl.glPopMatrix(); } On 18 Giu, 17:31, Leigh McRae leigh.mc...@lonedwarfgames.com wrote: Translate the quad to the origin, rotate, translate back. Leigh On 6/18/2010 11:12 AM, Paolo wrote: Hi guys! I'm a newbie in OpenGL. :D I'm trying to rotate a quad around its center. This is my scenario: I've a quad, drawn with TRIANGLE_STRIP, at specified coordinates. Now I want to rotate of 45 degrees around its center, without move it from its position, not around the origin of the aces. I hope you are able to understand my english... :) How can I do that? Thanks Paolo -- Leigh McRaewww.lonedwarfgames.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: [openGL] how to rotate quad around its center?
Thanks for your answer. my matrix is GL_MODELVIEW. I have noticed that once I have traslated and rotated the quad, also the aces x,y,z seem to be rotated of 45 degree. If it is right, it's normal that when i applied the second traslalte the quad goes in another position. is it normal? is there something wrong? On 18 Giu, 18:21, Leigh McRae leigh.mc...@lonedwarfgames.com wrote: OpenGL applies it's transforms in reverse so maybe swap the two translates. Sounds lame but this is the sort of thing you get right once and don't look at again for sometime. Also make sure your matrix mode is GL_MODELVIEW. Leigh On 6/18/2010 11:58 AM, Paolo wrote: Hi leigh! I've tried, but it doesn't work... the quad goes in a wrong position : ( My quad has these coordinates //vertex bottom left vertex[0] = 9.5f; vertex[1] = 10f; vertex[2] = 0.0f; //top left vertex[3] = 9.5f; vertex[4] = 11.0f; vertex[5] = 0.0f; //bottom right vertex[6] = 10.5f; vertex[7] = 10f; vertex[8] = 0.0f; //top right vertex[9] = 10.5; vertex[10] = 11f; vertex[11] = 0.0f; and this is my draw function... public void draw(GL10 gl){ gl.glPushMatrix(); gl.glTranslatef(-10, -10.5f, 0); //to the origin gl.glRotatef(45, 0, 0, -1); //rotate gl.glTranslatef(10, 10.5f, -2.0f); //back to previous position // Enabled the vertices buffer for writing and to be used during // rendering. gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); // Specifies the location and data format of an array of vertex // coordinates to use when rendering. gl.glVertexPointer(3, GL10.GL_FLOAT, 0, markerBuffer); gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, NUMERO_VERTICI); // Disable the vertices buffer. gl.glDisableClientState(GL10.GL_VERTEX_ARRAY); gl.glPopMatrix(); } On 18 Giu, 17:31, Leigh McRaeleigh.mc...@lonedwarfgames.com wrote: Translate the quad to the origin, rotate, translate back. Leigh On 6/18/2010 11:12 AM, Paolo wrote: Hi guys! I'm a newbie in OpenGL. :D I'm trying to rotate a quad around its center. This is my scenario: I've a quad, drawn with TRIANGLE_STRIP, at specified coordinates. Now I want to rotate of 45 degrees around its center, without move it from its position, not around the origin of the aces. I hope you are able to understand my english... :) How can I do that? Thanks Paolo -- Leigh McRaewww.lonedwarfgames.com -- Leigh McRaewww.lonedwarfgames.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: [openGL] how to rotate quad around its center?
I have to traslate into the z-axis a bit, otherwise I wouldn't see anything on the screen. Anyway, I'm doing this step by step as you said to me ;) At first i traslate the quad to the origin and in fact i see it there. Then I rotate of 45 degree around the z-axis and I see it rotated right. At last I traslate it again to the previous position, but the quad goes to a different position from that which I expected. Instead, if i do after the rotation: glTraslete(1.0f, 0f,0f); the quad moves of an unit along x-axis as if also this was rotated of 45 degrees, nord-east direction (in order to intend us) and not east- direction as I expect. I hope you undestrand me now :( Paolo p.s. if you prefer I can post my code On 18 Giu, 18:45, Leigh McRae leigh.mc...@lonedwarfgames.com wrote: I am not exactly sure what you're saying actually. At any rate, I noticed that you're translating along the z-axis. If you're rotating around the z-axis you don't need to translate along z. Also it could be that you're translating the quad offscreen since you haven't mirrored the z translation. Anyway, what are you seeing? Did you change the order? I would do it step by step. Start with getting the translation to the origin right. Once that looks right then add the rotation. Finally add the translation back. Leigh On 6/18/2010 12:35 PM, Paolo wrote: Thanks for your answer. my matrix is GL_MODELVIEW. I have noticed that once I have traslated and rotated the quad, also the aces x,y,z seem to be rotated of 45 degree. If it is right, it's normal that when i applied the second traslalte the quad goes in another position. is it normal? is there something wrong? On 18 Giu, 18:21, Leigh McRaeleigh.mc...@lonedwarfgames.com wrote: OpenGL applies it's transforms in reverse so maybe swap the two translates. Sounds lame but this is the sort of thing you get right once and don't look at again for sometime. Also make sure your matrix mode is GL_MODELVIEW. Leigh On 6/18/2010 11:58 AM, Paolo wrote: Hi leigh! I've tried, but it doesn't work... the quad goes in a wrong position : ( My quad has these coordinates //vertex bottom left vertex[0] = 9.5f; vertex[1] = 10f; vertex[2] = 0.0f; //top left vertex[3] = 9.5f; vertex[4] = 11.0f; vertex[5] = 0.0f; //bottom right vertex[6] = 10.5f; vertex[7] = 10f; vertex[8] = 0.0f; //top right vertex[9] = 10.5; vertex[10] = 11f; vertex[11] = 0.0f; and this is my draw function... public void draw(GL10 gl){ gl.glPushMatrix(); gl.glTranslatef(-10, -10.5f, 0); //to the origin gl.glRotatef(45, 0, 0, -1); //rotate gl.glTranslatef(10, 10.5f, -2.0f); //back to previous position // Enabled the vertices buffer for writing and to be used during // rendering. gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); // Specifies the location and data format of an array of vertex // coordinates to use when rendering. gl.glVertexPointer(3, GL10.GL_FLOAT, 0, markerBuffer); gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, NUMERO_VERTICI); // Disable the vertices buffer. gl.glDisableClientState(GL10.GL_VERTEX_ARRAY); gl.glPopMatrix(); } On 18 Giu, 17:31, Leigh McRaeleigh.mc...@lonedwarfgames.com wrote: Translate the quad to the origin, rotate, translate back. Leigh On 6/18/2010 11:12 AM, Paolo wrote: Hi guys! I'm a newbie in OpenGL. :D I'm trying to rotate a quad around its center. This is my scenario: I've a quad, drawn with TRIANGLE_STRIP, at specified coordinates. Now I want to rotate of 45 degrees around its center, without move it from its position, not around the origin of the aces. I hope you are able to understand my english... :) How can I do that? Thanks Paolo -- Leigh McRaewww.lonedwarfgames.com -- Leigh McRaewww.lonedwarfgames.com -- Leigh McRaewww.lonedwarfgames.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: how to rotate quad around its center?
Look at this image to understand what i'm saying http://www710.univ-lyon1.fr/~jciehl/Public/OpenGL_PG/figures/chap3-11.gif On 18 Giu, 19:42, Paolo brand...@gmail.com wrote: I have to traslate into the z-axis a bit, otherwise I wouldn't see anything on the screen. Anyway, I'm doing this step by step as you said to me ;) At first i traslate the quad to the origin and in fact i see it there. Then I rotate of 45 degree around the z-axis and I see it rotated right. At last I traslate it again to the previous position, but the quad goes to a different position from that which I expected. Instead, if i do after the rotation: glTraslete(1.0f, 0f,0f); the quad moves of an unit along x-axis as if also this was rotated of 45 degrees, nord-east direction (in order to intend us) and not east- direction as I expect. I hope you undestrand me now :( Paolo p.s. if you prefer I can post my code On 18 Giu, 18:45, Leigh McRae leigh.mc...@lonedwarfgames.com wrote: I am not exactly sure what you're saying actually. At any rate, I noticed that you're translating along the z-axis. If you're rotating around the z-axis you don't need to translate along z. Also it could be that you're translating the quad offscreen since you haven't mirrored the z translation. Anyway, what are you seeing? Did you change the order? I would do it step by step. Start with getting the translation to the origin right. Once that looks right then add the rotation. Finally add the translation back. Leigh On 6/18/2010 12:35 PM, Paolo wrote: Thanks for your answer. my matrix is GL_MODELVIEW. I have noticed that once I have traslated and rotated the quad, also the aces x,y,z seem to be rotated of 45 degree. If it is right, it's normal that when i applied the second traslalte the quad goes in another position. is it normal? is there something wrong? On 18 Giu, 18:21, Leigh McRaeleigh.mc...@lonedwarfgames.com wrote: OpenGL applies it's transforms in reverse so maybe swap the two translates. Sounds lame but this is the sort of thing you get right once and don't look at again for sometime. Also make sure your matrix mode is GL_MODELVIEW. Leigh On 6/18/2010 11:58 AM, Paolo wrote: Hi leigh! I've tried, but it doesn't work... the quad goes in a wrong position : ( My quad has these coordinates //vertex bottom left vertex[0] = 9.5f; vertex[1] = 10f; vertex[2] = 0.0f; //top left vertex[3] = 9.5f; vertex[4] = 11.0f; vertex[5] = 0.0f; //bottom right vertex[6] = 10.5f; vertex[7] = 10f; vertex[8] = 0.0f; //top right vertex[9] = 10.5; vertex[10] = 11f; vertex[11] = 0.0f; and this is my draw function... public void draw(GL10 gl){ gl.glPushMatrix(); gl.glTranslatef(-10, -10.5f, 0); //to the origin gl.glRotatef(45, 0, 0, -1); //rotate gl.glTranslatef(10, 10.5f, -2.0f); //back to previous position // Enabled the vertices buffer for writing and to be used during // rendering. gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); // Specifies the location and data format of an array of vertex // coordinates to use when rendering. gl.glVertexPointer(3, GL10.GL_FLOAT, 0, markerBuffer); gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, NUMERO_VERTICI); // Disable the vertices buffer. gl.glDisableClientState(GL10.GL_VERTEX_ARRAY); gl.glPopMatrix(); } On 18 Giu, 17:31, Leigh McRaeleigh.mc...@lonedwarfgames.com wrote: Translate the quad to the origin, rotate, translate back. Leigh On 6/18/2010 11:12 AM, Paolo wrote: Hi guys! I'm a newbie in OpenGL. :D I'm trying to rotate a quad around its center. This is my scenario: I've a quad, drawn with TRIANGLE_STRIP, at specified coordinates. Now I want to rotate of 45 degrees around its center, without move it from its position, not around the origin of the aces. I hope you are able to understand my english... :) How can I do that? Thanks Paolo -- Leigh McRaewww.lonedwarfgames.com -- Leigh McRaewww.lonedwarfgames.com -- Leigh McRaewww.lonedwarfgames.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: [openGL] how to rotate quad around its center?
yes, it seems to work in this way! this weekend I will do some tests in order to verify that it works fine. A question... why that behavior? :| On 18 Giu, 21:47, Leigh McRae leigh.mc...@lonedwarfgames.com wrote: I would suggest reading the chapter on viewing from the Red Book. Here is a version online. http://www.glprogramming.com/red/ The problem is that your translations are out of order. Try this order. gl.glTranslatef( 10.0f, 10.5f, -0.0f ); //back to previous position gl.glRotatef( 45.0f, 0.0f, 0.0f, -1.0f ); //rotate gl.glTranslatef( -10.0f, -10.5f, 0.0f ); //to the origin Really this is an OpenGL question and not an Android question. Leigh On 6/18/2010 1:42 PM, Paolo wrote: I have to traslate into the z-axis a bit, otherwise I wouldn't see anything on the screen. Anyway, I'm doing this step by step as you said to me ;) At first i traslate the quad to the origin and in fact i see it there. Then I rotate of 45 degree around the z-axis and I see it rotated right. At last I traslate it again to the previous position, but the quad goes to a different position from that which I expected. Instead, if i do after the rotation: glTraslete(1.0f, 0f,0f); the quad moves of an unit along x-axis as if also this was rotated of 45 degrees, nord-east direction (in order to intend us) and not east- direction as I expect. I hope you undestrand me now :( Paolo p.s. if you prefer I can post my code On 18 Giu, 18:45, Leigh McRaeleigh.mc...@lonedwarfgames.com wrote: I am not exactly sure what you're saying actually. At any rate, I noticed that you're translating along the z-axis. If you're rotating around the z-axis you don't need to translate along z. Also it could be that you're translating the quad offscreen since you haven't mirrored the z translation. Anyway, what are you seeing? Did you change the order? I would do it step by step. Start with getting the translation to the origin right. Once that looks right then add the rotation. Finally add the translation back. Leigh On 6/18/2010 12:35 PM, Paolo wrote: Thanks for your answer. my matrix is GL_MODELVIEW. I have noticed that once I have traslated and rotated the quad, also the aces x,y,z seem to be rotated of 45 degree. If it is right, it's normal that when i applied the second traslalte the quad goes in another position. is it normal? is there something wrong? On 18 Giu, 18:21, Leigh McRaeleigh.mc...@lonedwarfgames.com wrote: OpenGL applies it's transforms in reverse so maybe swap the two translates. Sounds lame but this is the sort of thing you get right once and don't look at again for sometime. Also make sure your matrix mode is GL_MODELVIEW. Leigh On 6/18/2010 11:58 AM, Paolo wrote: Hi leigh! I've tried, but it doesn't work... the quad goes in a wrong position : ( My quad has these coordinates //vertex bottom left vertex[0] = 9.5f; vertex[1] = 10f; vertex[2] = 0.0f; //top left vertex[3] = 9.5f; vertex[4] = 11.0f; vertex[5] = 0.0f; //bottom right vertex[6] = 10.5f; vertex[7] = 10f; vertex[8] = 0.0f; //top right vertex[9] = 10.5; vertex[10] = 11f; vertex[11] = 0.0f; and this is my draw function... public void draw(GL10 gl){ gl.glPushMatrix(); gl.glTranslatef(-10, -10.5f, 0); //to the origin gl.glRotatef(45, 0, 0, -1); //rotate gl.glTranslatef(10, 10.5f, -2.0f); //back to previous position // Enabled the vertices buffer for writing and to be used during // rendering. gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); // Specifies the location and data format of an array of vertex // coordinates to use when rendering. gl.glVertexPointer(3, GL10.GL_FLOAT, 0, markerBuffer); gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, NUMERO_VERTICI); // Disable the vertices buffer. gl.glDisableClientState(GL10.GL_VERTEX_ARRAY); gl.glPopMatrix(); } On 18 Giu, 17:31, Leigh McRaeleigh.mc...@lonedwarfgames.com wrote: Translate the quad to the origin, rotate, translate back. Leigh On 6/18/2010 11:12 AM, Paolo wrote: Hi guys! I'm a newbie in OpenGL. :D I'm trying to rotate a quad around its center. This is my scenario: I've a quad, drawn with TRIANGLE_STRIP, at specified coordinates. Now I want to rotate of 45 degrees around its center, without move it from its position, not around the origin of the aces. I hope you are able to understand my english... :) How can I do that? Thanks Paolo -- Leigh
[android-developers] Re: surfaceDestroyed not called! Why?
nobody can help me to undestand why? On 8 Giu, 13:41, Paolo brand...@gmail.com wrote: Hi there! I've a problem with the Camera, in particular with the surfaceDestroyed() callback. This is my scenario: The app starts with an activity that shows a splash screen, and after 3 seconds it send an Intent to the MyCameraActivity. I want to finish the splashscreen activity so in onStop() I call finish(). The CameraActivity starts but if I push the BACK button (my app terminate) I see from my log that the surfaceDestroyed() callbacks isn't called, where I release the camera source. The consequence is simple... when I start the app again, the camera source doesn't result free and I have a message error. Why does it happen this? Thanks to anyone wants to help me. *** The Splash Activity *** @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.splash); splashHandler = new Handler(){ @Override public void handleMessage(Message msg) { super.handleMessage(msg); switch (msg.what) { case STOPSPLASH: startActivity(new Intent(getApplicationContext(), CameraView.class)); break; } } }; Message msg = new Message(); msg.what = STOPSPLASH; splashHandler.sendMessageDelayed(msg, TIME_SPLASH); } @Override public void onPause(){ super.onPause(); Log.d(DEBUG, Splash onPause); finish(); } Here part of the code! *** MyCameraActivity *** �...@override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d(DEBUG, onCreate CameraView); getWindow().setFormat(PixelFormat.TRANSLUCENT); //aggiungo il traslucido requestWindowFeature(Window.FEATURE_NO_TITLE); //no barra titolo getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); //full screen getWindow().setFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON, WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); setContentView(R.layout.camera); mSurfaceView = (SurfaceView)findViewById(R.id.camera_surface); mSurfaceHolder = mSurfaceView.getHolder(); //recupero l'holder della surfaceview mSurfaceHolder.addCallback(this); //faccio la bind alla nostra activity mSurfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); } public void surfaceCreated(SurfaceHolder holder) { Log.d(DEBUG, surfaceCreated); mCamera = Camera.open(); Log.d(DEBUG, Camera open()); } public void surfaceDestroyed(SurfaceHolder holder) { Log.d(DEBUG, surfaceDestroyed); mCamera.stopPreview(); mPreviewRunning = false; mCamera.release(); mCamera = null; Log.d(DEBUG, Camera rilasciata); } public void surfaceChanged(SurfaceHolder arg0, int arg1, int arg2, int arg3) { Log.d(DEBUG, surfaceChanged); if (mPreviewRunning) { Log.d(DEBUG, la preview è running ora viene stoppata.); mCamera.stopPreview(); mPreviewRunning = false; } //setto le preferenze setPreferencesCamera(arg2, arg3); try { //lancio la preview Log.d(DEBUG, lancio la preview); mCamera.setPreviewDisplay(arg0); mCamera.startPreview(); mPreviewRunning = true; } catch (IOException e) { Log.e(ERROR, SurfaceChanged: errore Camera setPreviewDisplay); } } -- You received this message because you are subscribed to the Google 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