[android-developers] Re: View binding issue
if can't solve, i think view binding is the end. stay on synthetic, please On Monday, February 14, 2022 at 10:29:11 AM UTC+7 Abah Adilah wrote: > > I have class A activity with layout A. and i need create a new class with > all logic/model same with class A, but with different layout. > > Normally without view binding i have > open class A: AppCompatActivity() { > open fun getLayout() = R.layout.a > . > > } > > class B: A() { > override fun getLayout() = R.layout.b > } > > Hot to solve that problem using view binding feature? As i know view > binding generate class for every layout > -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/android-developers/6690781e-e895-4cd3-94a2-ac427c2071ddn%40googlegroups.com.
[android-developers] Re: View binding issue
if can't solve, i thin view binding is the end. stay on synthetic, please On Monday, February 14, 2022 at 10:29:11 AM UTC+7 Abah Adilah wrote: > > I have class A activity with layout A. and i need create a new class with > all logic/model same with class A, but with different layout. > > Normally without view binding i have > open class A: AppCompatActivity() { > open fun getLayout() = R.layout.a > . > > } > > class B: A() { > override fun getLayout() = R.layout.b > } > > Hot to solve that problem using view binding feature? As i know view > binding generate class for every layout > -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/android-developers/ac3b9f45-e788-49a0-878d-398ec3c6b42an%40googlegroups.com.
[android-developers] Re: View animation cannot repeat
For more information: My imageview go from left to right and I want to come back from right to left. However, it just go back to the original position instantly. On Sunday, 6 April 2014 22:28:19 UTC+8, Booker wrote: I have tried to load an animation xml to animate an ImageVIew. I set the animation to repeatMode RESERVE and set the repeat count to INFINITIE. However, it just stops after the it completes. My animation is below, I just want the view to go from left to right and then come back to left repeatedly. set xmlns:android=http://schemas.android.com/apk/res/android; android:repeatCount=infinite android:repeatMode=reserve translate android:fromXDelta=0% android:toXDelta=110% android:duration=1/ /set And below is my code //Animation variable ImageView animation_drawable_00, animation_drawable_01; Animation animation_set_00; private void init_animation() { animation_drawable_00 = (ImageView) findViewById(R.id.schedule_cloud_animation); animation_drawable_01 = (ImageView) findViewById(R.id.schedule_apple_animation); animation_set_00 = AnimationUtils.loadAnimation(this, R.anim.schedule_cloud_animation); animation_drawable_00.startAnimation(animation_set_00); } Please help. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- 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/d/optout.
[android-developers] Re: View
Yes. Or you can view it in the file R.java in the gen folder. That is an auto-genned file by some Android component. On Thursday, February 14, 2013 6:28:20 PM UTC-6, Lew wrote: Arun Kumar K wrote: I have doubt about layout.. You have a lot of dots, too. RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android; android:id=@+id/layercontainer android:orientation=horizontal android:layout_width=fill_parent android:layout_height=wrap_content android:background=#ff TextView android:id=@+id/existingbillers_header android:layout_width=match_parent android:layout_height=wrap_content android:background=@drawable/background_with_out_logo android:gravity=center android:text=Select Existing Billers android:textAppearance=?android:attr/textAppearanceLarge android:textColor=#ff android:textSize=20sp android:textStyle=bold / RelativeLayout android:id=@+id/*existing_list* android:layout_width=wrap_content android:layout_height=wrap_content android:layout_below=@+id/existingbillers_header ListView android:id=@android:id/list android:layout_width=fill_parent android:layout_height=wrap_content android:layout_below=@+id/text1 / TextView android:id=@+id/text1 android:layout_width=wrap_content android:layout_height=wrap_content android:layout_alignParentLeft=true android:padding=10dp android:textSize=16sp android:textColor=#00 android:typeface=sans/ ImageView android:id=@+id/image1 android:layout_width=wrap_content android:layout_height=wrap_content android:layout_alignParentRight=true/ /RelativeLayout /RelativeLayout i [sic] want to get the *existing_list idhow can i *[sic]* get it pls *[sic]* help me* What do you mean get the id? If you mean refer to it in code, it's just R.id.existing_list. -- Lew -- -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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] Re: View
You should never actually use this number, only the constant... kris On Fri, Feb 15, 2013 at 1:01 PM, bob b...@coolfone.comze.com wrote: Yes. Or you can view it in the file R.java in the gen folder. That is an auto-genned file by some Android component. On Thursday, February 14, 2013 6:28:20 PM UTC-6, Lew wrote: Arun Kumar K wrote: I have doubt about layout.. You have a lot of dots, too. RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android; android:id=@+id/layercontainer android:orientation=horizontal android:layout_width=fill_parent android:layout_height=wrap_content android:background=#ff TextView android:id=@+id/existingbillers_header android:layout_width=match_parent android:layout_height=wrap_content android:background=@drawable/background_with_out_logo android:gravity=center android:text=Select Existing Billers android:textAppearance=?android:attr/textAppearanceLarge android:textColor=#ff android:textSize=20sp android:textStyle=bold / RelativeLayout android:id=@+id/existing_list android:layout_width=wrap_content android:layout_height=wrap_content android:layout_below=@+id/existingbillers_header ListView android:id=@android:id/list android:layout_width=fill_parent android:layout_height=wrap_content android:layout_below=@+id/text1 / TextView android:id=@+id/text1 android:layout_width=wrap_content android:layout_height=wrap_content android:layout_alignParentLeft=true android:padding=10dp android:textSize=16sp android:textColor=#00 android:typeface=sans/ ImageView android:id=@+id/image1 android:layout_width=wrap_content android:layout_height=wrap_content android:layout_alignParentRight=true/ /RelativeLayout /RelativeLayout i [sic] want to get the existing_list idhow can i [sic] get it pls [sic] help me What do you mean get the id? If you mean refer to it in code, it's just R.id.existing_list. -- Lew -- -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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. -- -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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.
[android-developers] Re: View
Arun Kumar K wrote: I have doubt about layout.. You have a lot of dots, too. RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android; android:id=@+id/layercontainer android:orientation=horizontal android:layout_width=fill_parent android:layout_height=wrap_content android:background=#ff TextView android:id=@+id/existingbillers_header android:layout_width=match_parent android:layout_height=wrap_content android:background=@drawable/background_with_out_logo android:gravity=center android:text=Select Existing Billers android:textAppearance=?android:attr/textAppearanceLarge android:textColor=#ff android:textSize=20sp android:textStyle=bold / RelativeLayout android:id=@+id/*existing_list* android:layout_width=wrap_content android:layout_height=wrap_content android:layout_below=@+id/existingbillers_header ListView android:id=@android:id/list android:layout_width=fill_parent android:layout_height=wrap_content android:layout_below=@+id/text1 / TextView android:id=@+id/text1 android:layout_width=wrap_content android:layout_height=wrap_content android:layout_alignParentLeft=true android:padding=10dp android:textSize=16sp android:textColor=#00 android:typeface=sans/ ImageView android:id=@+id/image1 android:layout_width=wrap_content android:layout_height=wrap_content android:layout_alignParentRight=true/ /RelativeLayout /RelativeLayout i [sic] want to get the *existing_list idhow can i *[sic]* get it pls *[sic]* help me* What do you mean get the id? If you mean refer to it in code, it's just R.id.existing_list. -- Lew -- -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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.
[android-developers] Re: View
Arun Kumar K wrote: Hi guys, i want to get the *existing_list idhow can i get it pls help me* how to get what? what is existing_ list id? pskink -- -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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] Re: View Group onclick event not firing
Hi All, Parent layout holds the ontouch event so it didnt allow click events to its child. Do we have any work around to make touch event for parent to drag the layout and click event to child items. Thanks On Wednesday, November 7, 2012 10:54:28 PM UTC+5:30, Mobile Developer wrote: Hi All, Click event in vewgroup child not firing if i use dispatchTouchEvent(MotionEvent e) for touch. if i use onInterceptTouchEvent(MotionEvent e) i can stop the touch event and click is working as we expect. but i need click for viewgroup child items also i need to touch to drag the viewgroup. Thanks in advance On Wednesday, November 7, 2012 1:25:01 PM UTC+5:30, Mobile Developer wrote: Hi Bob Thanks for your reply. I need to use both touch and click events. if i return false from dispatchTouchEvent then i cant able to use touch events. I dont know how to add click events for viewgroup childs. Thanks On Wed, Nov 7, 2012 at 1:03 AM, bob b...@coolfone.comze.com wrote: Why don't you return false in dispatchTouchEvent? On Tuesday, November 6, 2012 6:37:47 AM UTC-6, Mobile Developer wrote: Hi All, I have viewgroup that extends LinearLayout but i cant able to add onclick events to the child elements. Its only accessing ontouch event. I used dispatchTouchEvent(MotionEvent e) to touch event and i returned true. I tried onInterceptTouchEvent(**MotionEvent ev) to stop touch event. eventhough i cant able to add onclick event. How to add click event on ViewGroup child elements. can we able add onclick and ontouch event for viewgroup? Thanks in advance android-developers@googlegroups.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
Re: [android-developers] Re: View Group onclick event not firing
Hi All, Click event in vewgroup child not firing if i use dispatchTouchEvent(MotionEvent e) for touch. if i use onInterceptTouchEvent(MotionEvent e) i can stop the touch event and click is working as we expect. but i need click for viewgroup child items also i need to touch to drag the viewgroup. Thanks in advance On Wednesday, November 7, 2012 1:25:01 PM UTC+5:30, Mobile Developer wrote: Hi Bob Thanks for your reply. I need to use both touch and click events. if i return false from dispatchTouchEvent then i cant able to use touch events. I dont know how to add click events for viewgroup childs. Thanks On Wed, Nov 7, 2012 at 1:03 AM, bob b...@coolfone.comze.com wrote: Why don't you return false in dispatchTouchEvent? On Tuesday, November 6, 2012 6:37:47 AM UTC-6, Mobile Developer wrote: Hi All, I have viewgroup that extends LinearLayout but i cant able to add onclick events to the child elements. Its only accessing ontouch event. I used dispatchTouchEvent(MotionEvent e) to touch event and i returned true. I tried onInterceptTouchEvent(**MotionEvent ev) to stop touch event. eventhough i cant able to add onclick event. How to add click event on ViewGroup child elements. can we able add onclick and ontouch event for viewgroup? Thanks in advance android-developers@googlegroups.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: View Group onclick event not firing
Why don't you return false in dispatchTouchEvent? On Tuesday, November 6, 2012 6:37:47 AM UTC-6, Mobile Developer wrote: Hi All, I have viewgroup that extends LinearLayout but i cant able to add onclick events to the child elements. Its only accessing ontouch event. I used dispatchTouchEvent(MotionEvent e) to touch event and i returned true. I tried onInterceptTouchEvent(MotionEvent ev) to stop touch event. eventhough i cant able to add onclick event. How to add click event on ViewGroup child elements. can we able add onclick and ontouch event for viewgroup? 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
Re: [android-developers] Re: View Group onclick event not firing
Hi Bob Thanks for your reply. I need to use both touch and click events. if i return false from dispatchTouchEvent then i cant able to use touch events. I dont know how to add click events for viewgroup childs. Thanks On Wed, Nov 7, 2012 at 1:03 AM, bob b...@coolfone.comze.com wrote: Why don't you return false in dispatchTouchEvent? On Tuesday, November 6, 2012 6:37:47 AM UTC-6, Mobile Developer wrote: Hi All, I have viewgroup that extends LinearLayout but i cant able to add onclick events to the child elements. Its only accessing ontouch event. I used dispatchTouchEvent(MotionEvent e) to touch event and i returned true. I tried onInterceptTouchEvent(**MotionEvent ev) to stop touch event. eventhough i cant able to add onclick event. How to add click event on ViewGroup child elements. can we able add onclick and ontouch event for viewgroup? 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 -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: view elements unintenionally blinking
Found the reason for blinking views: the top RelativeLayout collided with the ActionBar, which is automatically added to the layout since Honeycomb and has effect even if it is not visible. Although I do not understand what's really going on, I found a way to get rid of the ActionBar, as not needed (by googeling of course). Here is the solution, that makes it disappear and also works for older versions of Android that do not support ActionBars. In the Activity hosting my SurfaceView I modified: @Override public void onStart(){ super.onStart(); if(Build.VERSION.SDK_INT = Build.VERSION_CODES.HONEYCOMB){ ActionBar actionbar; actionbar = getActionBar(); actionbar.hide(); } ... } Am Mittwoch, 8. August 2012 19:19:40 UTC+2 schrieb bbbill: Hi All, on my Android Tab (TF 101g with keyboard dock, Android 4.03) I observe some strange blinking I cannot explane. The whole screen is being controlled by a Relative Layout containing another Realive Layout with some view elements on top position, followed by a SurfaceView with a grafic canvas and below that some other views, one of them an EditView for number entry. When I run my application on that device being undocked, i.e. without the hard keyboard, and hold it in landscape orientation, first the soft keyboard appears and all view elements get shifted topwards. Then, after I closed down the keyboard, all view elements return to their original position, *while those within the RelativeLayout above the SurfaceView start blinking continuously*. Even Part of the application title and Icon get overwritten in black an reappear on a half second rate. When I replugg the device into the keyboard dock, blinking stopps immediately. Neither does this occur, when I hold the undocked device in portrait orientation. There seems to be a certain dependency on the EditView below the SurfaceView. At least the blinking rate goes down, when this is disabled. I have the same application running on a smart phone (Alcatel OT918D, Android 2.3.6) and there is no such issue at all. (On the smart phone the EditView is not visible in landscape orientation, because it does not fit within the display. Is this of any importance at all?) The containing views xml-file is attached. Any helpful hints gratefully apreciated -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: View contact based on contact id - not always shows the right contact
A new dev guide for the contacts provider is now available on developer.android.com http://developer.android.com/guide/topics/providers/contacts-provider.html. On Wednesday, June 6, 2012 2:34:42 AM UTC-7, Balint wrote: I query the phone's calllog into a ListView. So when the user long clicks an item, a dialog comes up with options, including View contact. To be able to view the contact the intent needs the contact id. From the calllog I get the contact id by the phone number. My problem is that I not always get to see the right contact. I click on Peter, and Peter's contact sheet comes up. I click on Sarah, and Jason's contact sheet comes up. I must have been using this code the wrong way. Please help. ContentResolver contentResolver = getContentResolver(); Uri uri = Uri.withAppendedPath(ContactsContract.PhoneLookup.CONTENT_FILTER_URI, Uri.encode(phone)); Cursor cursor = contentResolver.query(uri, new String[] {PhoneLookup.DISPLAY_NAME, PhoneLookup._ID}, null, null, null); if(cursor!=null) { while(cursor.moveToNext()) { String contactName = cursor.getString(cursor.getColumnIndexOrThrow(PhoneLookup.DISPLAY_NAME)); contactid2 = cursor.getString(cursor.getColumnIndexOrThrow(PhoneLookup._ID)); } cursor.close(); } Intent intent_contacts = new Intent(Intent.ACTION_VIEW, Uri.parse(content://contacts/people/ + contactid2)); startActivity(intent_contacts); Maybe what I need is not the PhoneLookup._ID, but some other ID. - on a HTC Desire HD (2.3.5) I get the proper contacts in 99% of the cases. - on a ZTE Blade (2.2) I get the proper contacts in 60% of the cases. - on a Samsung Galaxy Ace (2.3.3) I get the proper contacts in 5% of the cases. What the hell is going on??? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: View Pager performance hit when inflating views
Thanks for your reply. Actually there are some more items below List, per page. Now i have to create another ViewPager and sync scrolls between them I know that doesn't look very clean, but looks like no other option for me.. Br, Varun On Mon, May 7, 2012 at 6:31 PM, Jason Teagle teagle.ja...@gmail.com wrote: But as soon as i add a linear or relative layout as parent to list view ...i am able to see the lag while scrolling Although I can't really help you reach an answer that will help, I will just say that using layouts as the parent *will* decrease speed performance due to having to do the extra work to lay everything out according to the rules. Why were you trying to add a parent layout to the list view? Is the list view not the only item on the screen, per page? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@**googlegroups.comandroid-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+**unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/**group/android-developers?hl=enhttp://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: View Pager performance hit when inflating views
Okay so i tried some more Now layout xml has only listview as rootview and their is no performance difference as suchin total view pager has 80 listviews... But as soon as i add a linear or relative layout as parent to list view ...i am able to see the lag while scrolling I also lowered my view pager childs to 5 from 80, but no luck... Any expert advice ll be appreciated. Br, Varun On Mon, May 7, 2012 at 4:27 PM, Varun Tewari varuntewari2...@gmail.comwrote: Guys, In my recent application, i had 80 items each one is a list view, in my View Pager. I observed a performance hit, if i create then *dynamically with Java code * v/s i*nflating view* from xml. I see a terrible lag in swiping left right, when i use inflating view approach...That's because GC calls increases like hell in logcat I use below method for inflating each list view for each view pager. *mLayoutInflater.inflate(R.layout.list, null, false);* * * I thought we can use View pager like ListViews and GridViews... Is there something i m missing here??? Br, Varun -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: View Pager performance hit when inflating views
But as soon as i add a linear or relative layout as parent to list view ...i am able to see the lag while scrolling Although I can't really help you reach an answer that will help, I will just say that using layouts as the parent *will* decrease speed performance due to having to do the extra work to lay everything out according to the rules. Why were you trying to add a parent layout to the list view? Is the list view not the only item on the screen, per page? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: View height changes when image set as background by 1.25 times of the image height
hi Murali , use *android*:*scaleType*=*fitXY* Moktarul On Wednesday, 29 February 2012 16:58:35 UTC+5:30, Reddy wrote: Hi, I have a .png file. I set this as the background of a TextView and the height and width of the TextView are wrap context. The ideal behavior here is that the height and width of the textview should be of height and width of the .png file. But what i am getting is that size of text view is getting increased 1.25 times of the image size. If any has solved this issue, please help me. Thanks in advance. Regards, Murali -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: View height changes when image set as background by 1.25 times of the image height
Hi Moktarul, Still i am facing the same problem. Let me clarify my problem clearly. My .png height is 53px. When png set as BG of TextView, and the textview properties are wrap context, the height of the textview is becoming big. When i set the textview height to 53px then the height of the TextView is 53px. Please provide me solution if u have. Regards, Murali On Feb 29, 4:35 pm, moktarul anam mokta...@gmail.com wrote: hi Murali , use *android*:*scaleType*=*fitXY* Moktarul On Wednesday, 29 February 2012 16:58:35 UTC+5:30, Reddy wrote: Hi, I have a .png file. I set this as the background of a TextView and the height and width of the TextView are wrap context. The ideal behavior here is that the height and width of the textview should be of height and width of the .png file. But what i am getting is that size of text view is getting increased 1.25 times of the image size. If any has solved this issue, please help me. Thanks in advance. Regards, Murali -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: View height changes when image set as background by 1.25 times of the image height
It may be easier to do this programmatically. You can build your bitmap image first, figure out the dimensions of that and resize it if needed. Then, change the dimensions of the TextView, if necessary, to match the size of the image, probably using LayoutParams. Finally, you can set it as the background of the resized TextView as the resized image. -John On Wednesday, February 29, 2012 6:51:40 AM UTC-5, Reddy wrote: Hi Moktarul, Still i am facing the same problem. Let me clarify my problem clearly. My .png height is 53px. When png set as BG of TextView, and the textview properties are wrap context, the height of the textview is becoming big. When i set the textview height to 53px then the height of the TextView is 53px. Please provide me solution if u have. Regards, Murali On Feb 29, 4:35 pm, moktarul anam mokta...@gmail.com wrote: hi Murali , use *android*:*scaleType*=*fitXY* Moktarul On Wednesday, 29 February 2012 16:58:35 UTC+5:30, Reddy wrote: Hi, I have a .png file. I set this as the background of a TextView and the height and width of the TextView are wrap context. The ideal behavior here is that the height and width of the textview should be of height and width of the .png file. But what i am getting is that size of text view is getting increased 1.25 times of the image size. If any has solved this issue, please help me. Thanks in advance. Regards, Murali -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: View height changes when image set as background by 1.25 times of the image height
Reddy, hmm... do this way.. in textview setbackground .. one xml file .. that file will be in drawable file and there u set background. Basically u add set background drawable xml Moktarul On Wednesday, 29 February 2012 17:21:40 UTC+5:30, Reddy wrote: Hi Moktarul, Still i am facing the same problem. Let me clarify my problem clearly. My .png height is 53px. When png set as BG of TextView, and the textview properties are wrap context, the height of the textview is becoming big. When i set the textview height to 53px then the height of the TextView is 53px. Please provide me solution if u have. Regards, Murali On Feb 29, 4:35 pm, moktarul anam mokta...@gmail.com wrote: hi Murali , use *android*:*scaleType*=*fitXY* Moktarul On Wednesday, 29 February 2012 16:58:35 UTC+5:30, Reddy wrote: Hi, I have a .png file. I set this as the background of a TextView and the height and width of the TextView are wrap context. The ideal behavior here is that the height and width of the textview should be of height and width of the .png file. But what i am getting is that size of text view is getting increased 1.25 times of the image size. If any has solved this issue, please help me. Thanks in advance. Regards, Murali -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: View height changes when image set as background by 1.25 times of the image height
hi do this , first drag a txtview , then in properties go background and select icon from drawable. then remove txt from the text view On Thu, Mar 1, 2012 at 12:21 PM, moktarul anam mokta...@gmail.com wrote: Reddy, hmm... do this way.. in textview setbackground .. one xml file .. that file will be in drawable file and there u set background. Basically u add set background drawable xml Moktarul On Wednesday, 29 February 2012 17:21:40 UTC+5:30, Reddy wrote: Hi Moktarul, Still i am facing the same problem. Let me clarify my problem clearly. My .png height is 53px. When png set as BG of TextView, and the textview properties are wrap context, the height of the textview is becoming big. When i set the textview height to 53px then the height of the TextView is 53px. Please provide me solution if u have. Regards, Murali On Feb 29, 4:35 pm, moktarul anam mokta...@gmail.com wrote: hi Murali , use *android*:*scaleType*=*fitXY* Moktarul On Wednesday, 29 February 2012 16:58:35 UTC+5:30, Reddy wrote: Hi, I have a .png file. I set this as the background of a TextView and the height and width of the TextView are wrap context. The ideal behavior here is that the height and width of the textview should be of height and width of the .png file. But what i am getting is that size of text view is getting increased 1.25 times of the image size. If any has solved this issue, please help me. Thanks in advance. Regards, Murali -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: View/onDraw(Canvas) vs. SurfaceView
well I just got hammered for supposedly being hard to understand but this is not going to be fun first off ( short of going an looking ) SurfaceView should be on the constructor chain of View as the normal convention of Java suggest so by the class name thus I would if coding a short sample here subclass SurfaceView for you class as all the Veiw stuff would probably be available then, for what you are asking first go look at the blog post of post is by Dianne Hackborn, a Software Engineer who sits very near the exact center of everything Android Android Developers Blog: Multitasking the Android Way what happens is that the thread that is launching the application gets used to draw the screen which it has to or there will be an A.N.R. if it gets into a lot of calc's or hangs somewhere waiting on something to do the moving things around on the screen you all but have to have another thread doing the moving things around so how do you do that?... you have another thread doing the calcs what you have to figure out is how the two threads talk simple really but I'm not going to get hammered again so you'll have to figure it out yourself On Nov 23, 7:49 am, John Goche johngoch...@googlemail.com wrote: Hello, Let me rephrase my question. Given the information found athttp://developer.android.com/guide/topics/graphics/2d-graphics.html which states: The aim of SurfaceView is to offer this drawing surface to an application's secondary thread, so that the application isn't required to wait until the system's View hierarchy is ready to draw. if I have just a single View on my screen (say for a game) why would the View hierarchy take a longer time to draw than if the View's Canvas is updated from a separate thread? Thanks for your feedback, John Goche On Wed, Nov 23, 2011 at 1:30 PM, John Goche johngoch...@googlemail.comwrote: Hello, Could anyone kindly explain to me what the difference is between using a SurfaceView and subclassing a View class and overriding its onDraw() mehtod? Plus I've read a thread on this mailing list that SurfaceView has problems on newer phones (and perhaps GLSurfaceView is affected as well). Can someone please give me an update on this? Thanks, John Goche -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: View/onDraw(Canvas) vs. SurfaceView
Hello, Let me rephrase my question. Given the information found at http://developer.android.com/guide/topics/graphics/2d-graphics.html which states: The aim of SurfaceView is to offer this drawing surface to an application's secondary thread, so that the application isn't required to wait until the system's View hierarchy is ready to draw. if I have just a single View on my screen (say for a game) why would the View hierarchy take a longer time to draw than if the View's Canvas is updated from a separate thread? Thanks for your feedback, John Goche On Wed, Nov 23, 2011 at 1:30 PM, John Goche johngoch...@googlemail.comwrote: Hello, Could anyone kindly explain to me what the difference is between using a SurfaceView and subclassing a View class and overriding its onDraw() mehtod? Plus I've read a thread on this mailing list that SurfaceView has problems on newer phones (and perhaps GLSurfaceView is affected as well). Can someone please give me an update on this? Thanks, John Goche -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: View subclass
Great, thanks. You're right that it tripped me up because it wants this constructor: public StatsTable(Context context, AttributeSet attrs) { It works now that I put it in. On Sep 14, 7:24 pm, Mark Murphy mmur...@commonsware.com wrote: If StatsTable is in the com.coolgroups.bob package, you would use: com.coolgroups.bob.StatsTable android:id=@+id/hello ... / Note that you would need a different (additional) constructor, one that takes an AttributeSet as the second parameter. See my ColorMixer custom widget: https://github.com/commonsguy/cwac-colormixer On Wed, Sep 14, 2011 at 8:21 PM, bob b...@coolgroups.com wrote: So, I created my own View subclass like this: public class StatsTable extends View { public StatsTable(Context context) { super(context); // TODO Auto-generated constructor stub } @Override public void onDraw(Canvas canvas) { canvas.drawARGB(255, 1, 0, 0); } } Anyone know what I have to do to reference this in my layout XML? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy Android 3.1 Programming Books:http://commonsware.com/books -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: View subclass
Actually, this is returning null: StatsTable st = (StatsTable) findViewById(R.id.hello); Any idea why? On Sep 14, 7:24 pm, Mark Murphy mmur...@commonsware.com wrote: If StatsTable is in the com.coolgroups.bob package, you would use: com.coolgroups.bob.StatsTable android:id=@+id/hello ... / Note that you would need a different (additional) constructor, one that takes an AttributeSet as the second parameter. See my ColorMixer custom widget: https://github.com/commonsguy/cwac-colormixer On Wed, Sep 14, 2011 at 8:21 PM, bob b...@coolgroups.com wrote: So, I created my own View subclass like this: public class StatsTable extends View { public StatsTable(Context context) { super(context); // TODO Auto-generated constructor stub } @Override public void onDraw(Canvas canvas) { canvas.drawARGB(255, 1, 0, 0); } } Anyone know what I have to do to reference this in my layout XML? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy Android 3.1 Programming Books:http://commonsware.com/books -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: View subclass
The problem was in my widget, I had the correct constructor (Context context AttributeSet attr); HOWEVER - super(context) was being called - not super(context, attr). Once I fixed that, life was better. On Sep 15, 3:21 am, bob b...@coolgroups.com wrote: Actually, this is returning null: StatsTable st = (StatsTable) findViewById(R.id.hello); Any idea why? On Sep 14, 7:24 pm, Mark Murphy mmur...@commonsware.com wrote: If StatsTable is in the com.coolgroups.bob package, you would use: com.coolgroups.bob.StatsTable android:id=@+id/hello ... / Note that you would need a different (additional) constructor, one that takes an AttributeSet as the second parameter. See my ColorMixer custom widget: https://github.com/commonsguy/cwac-colormixer On Wed, Sep 14, 2011 at 8:21 PM, bob b...@coolgroups.com wrote: So, I created my own View subclass like this: public class StatsTable extends View { public StatsTable(Context context) { super(context); // TODO Auto-generated constructor stub } @Override public void onDraw(Canvas canvas) { canvas.drawARGB(255, 1, 0, 0); } } Anyone know what I have to do to reference this in my layout XML? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy Android 3.1 Programming Books:http://commonsware.com/books -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: View in Google+ Application
There is some info about this here: http://stackoverflow.com/questions/6802770/what-view-component-does-the-google-plus-app-stream-use -AndyD On Aug 18, 4:37 pm, charlie babitt charlie.bab...@gmail.com wrote: Hallo! Yesterday I installed the Google+ Application (for the Android 2 series) and found a really nice looking view. When you select stream in the dashboard at the top (below the actionbar kind of header) there is some kind of tab replacement (you can switch between nearby, All circles an incoming). Does anyone know what kind of view this is or how I can build something like this? Thanks CHarlie -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: View in Google+ Application
Also here: http://stackoverflow.com/questions/6806880/how-to-create-a-ui-like-the-new-market-or-google-plus/6807264 -AndyD -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: view in background receiving input
An app I'm currently developing shows strange behaviour: a view in background receives input. In a FrameLayout, I put a view on top of another (detail view open when an item of a list is selected). Visually, everything looks as expected. But when touching anything with the detail view in foreground, events of the list in background are triggered (which means that another detail view opens on top of the first one, and then another one etc.). Try setting android:clickable=true and/or android:focusable=true on the top view. Pent -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: View Open files downloaded from the server
I was about to send you a lmgtfy link... http://www.androidsnippets.com/open-file-with-default-application-using-intents -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: View Open files downloaded from the server
That's a bad snippet, but their site's login seems broken. I would avoid using wildcard MIME types for specific files like this. For example, there might be an audio player that only handles OGG, not MP3 -- the ACTION_VIEW shown here would still offer that OGG-only player as an option, which would then break. For selection Intents, like an ACTION_GET_CONTENT, wildcard MIME types are fine, AFAIK. But for cases like this, I would use the fully qualified MIME type, sans wildcard. On Sun, Apr 10, 2011 at 8:05 AM, lbendlin l...@bendlin.us wrote: I was about to send you a lmgtfy link... http://www.androidsnippets.com/open-file-with-default-application-using-intents -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android Training in Oslo: http://bit.ly/fjBo24 -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: View Open files downloaded from the server
Thnx for all the replies :) On Apr 10, 2:13 pm, Mark Murphy mmur...@commonsware.com wrote: That's a bad snippet, but their site's login seems broken. I would avoid using wildcard MIME types for specific files like this. For example, there might be an audio player that only handles OGG, not MP3 -- the ACTION_VIEW shown here would still offer that OGG-only player as an option, which would then break. For selection Intents, like an ACTION_GET_CONTENT, wildcard MIME types are fine, AFAIK. But for cases like this, I would use the fully qualified MIME type, sans wildcard. On Sun, Apr 10, 2011 at 8:05 AM, lbendlin l...@bendlin.us wrote: I was about to send you a lmgtfy link... http://www.androidsnippets.com/open-file-with-default-application-usi... -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy Android Training in Oslo:http://bit.ly/fjBo24 -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: View HTML in Android browser
I'm guessing you'd say myIntent.setDataAndType(myUri, text/plain); On Jan 10, 8:18 am, perumal316 perumal...@gmail.com wrote: Hi All, I want to open saved HTML pages in default Android browser. But currently when I open the HTML, it is only showing me the option to either open in HTML viewer not the browser. How do I make it to open in Android browser? Thanks and Regards, Perumal -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: View HTML in Android browser
Hi, I mean for example I am having a html attachment in my email. How do I view it in the web browser? Currently I can only view it using HTML viewer which is not loading fully the required portions from the internet. Regards, Perumal On Jan 11, 2:38 am, DanH danhi...@ieee.org wrote: I'm guessing you'd say myIntent.setDataAndType(myUri, text/plain); On Jan 10, 8:18 am, perumal316 perumal...@gmail.com wrote: Hi All, I want to open saved HTML pages in default Android browser. But currently when I open the HTML, it is only showing me the option to either open in HTML viewer not the browser. How do I make it to open in Android browser? Thanks and Regards, Perumal- Hide quoted text - - Show quoted text - -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: View width and calculated text width doesn't match
The mismatch is by a factor of 1.5. Which kinda looks like a mismatch between pixel and dp units of an hdpi (240 dpi) device. In what context is this code run? Is this a subclass of TextView? I'd recommend you take a look at the source, to see if these methods actually scale text size, you might discover something interesting. In particular, TextView getSize returns pixels, but setSize assumes the value is in SP units, and scales it. http://netmite.com/android/mydroid/1.0/frameworks/base/core/java/android/widget/TextView.java -- Kostya 15.12.2010 10:45, Schoel пишет: I can provide some additional information here: m_TestPaint = new Paint(); m_TestPaint.set(getPaint()); m_MaxTextSize = getTextSize(); m_TestPaint.setTextSize(m_MaxTextSize); Log.e(FintFit, Paint text size: + m_TestPaint.getTextSize()); Log.e(FintFit, Text text size: + getTextSize()); This outputs 42.0 and 63.0 respectively. That doesn't seem right, does it? Why isn't the Paint respecting the size I set to it? Zsolt: Thanks for the offer but I can't send you my .apk as this code is part of a closed source project. BR, Schoel -- 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: View width and calculated text width doesn't match
That might be an idea, thanks. I wish the API would be more clear about these things. Yes, it is a subclass of TextView. On 15 Dec, 09:12, Kostya Vasilyev kmans...@gmail.com wrote: The mismatch is by a factor of 1.5. Which kinda looks like a mismatch between pixel and dp units of an hdpi (240 dpi) device. In what context is this code run? Is this a subclass of TextView? I'd recommend you take a look at the source, to see if these methods actually scale text size, you might discover something interesting. In particular, TextView getSize returns pixels, but setSize assumes the value is in SP units, and scales it. http://netmite.com/android/mydroid/1.0/frameworks/base/core/java/andr... -- Kostya 15.12.2010 10:45, Schoel пишет: I can provide some additional information here: m_TestPaint = new Paint(); m_TestPaint.set(getPaint()); m_MaxTextSize = getTextSize(); m_TestPaint.setTextSize(m_MaxTextSize); Log.e(FintFit, Paint text size: + m_TestPaint.getTextSize()); Log.e(FintFit, Text text size: + getTextSize()); This outputs 42.0 and 63.0 respectively. That doesn't seem right, does it? Why isn't the Paint respecting the size I set to it? Zsolt: Thanks for the offer but I can't send you my .apk as this code is part of a closed source project. BR, Schoel -- 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: View width and calculated text width doesn't match
That indeed seems to be the issue, on the emulator, they both return the same size (whereas on my phone, they do not). Trying to browse the source for Paint, I found that getTextSize is a native function with a quite useless comment about it returning the text size. Any idea where I can find C source code? BR, Schoel On 15 Dec, 09:12, Kostya Vasilyev kmans...@gmail.com wrote: The mismatch is by a factor of 1.5. Which kinda looks like a mismatch between pixel and dp units of an hdpi (240 dpi) device. In what context is this code run? Is this a subclass of TextView? I'd recommend you take a look at the source, to see if these methods actually scale text size, you might discover something interesting. In particular, TextView getSize returns pixels, but setSize assumes the value is in SP units, and scales it. http://netmite.com/android/mydroid/1.0/frameworks/base/core/java/andr... -- Kostya 15.12.2010 10:45, Schoel пишет: I can provide some additional information here: m_TestPaint = new Paint(); m_TestPaint.set(getPaint()); m_MaxTextSize = getTextSize(); m_TestPaint.setTextSize(m_MaxTextSize); Log.e(FintFit, Paint text size: + m_TestPaint.getTextSize()); Log.e(FintFit, Text text size: + getTextSize()); This outputs 42.0 and 63.0 respectively. That doesn't seem right, does it? Why isn't the Paint respecting the size I set to it? Zsolt: Thanks for the offer but I can't send you my .apk as this code is part of a closed source project. BR, Schoel -- 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
Re: [android-developers] Re: View width and calculated text width doesn't match
15.12.2010 11:51, Schoel пишет: That indeed seems to be the issue, on the emulator, they both return the same size (whereas on my phone, they do not). This make sense if your emulator is HVGA mdpi, and the phone is hdpi. Trying to browse the source for Paint, I found that getTextSize is a native function with a quite useless comment about it returning the text size. Any idea where I can find C source code? It's in the source repository somewhere, no doubt, but I don't know off hand. I think you can sidestep this by adding more logging for sizes before / after each step of your code. BR, Schoel -- 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: View width and calculated text width doesn't match
Does it work on stock Android, like the Nexus One? If you want to send me your .apk, I'd be happy to try it for you. On Dec 15, 12:45 am, Schoel samuelsson.j...@gmail.com wrote: Hello, I am trying to create a view that fits a text into a given text view. I've done a new view that has a custom XML attribute called minTextSize that is a dimension. Whenever text is set on the text view, it tries with all sizes from the desired (specified in the xml) down to minTextSize until it finds one that fits. This works perfectly on an emulator, I get the desired behaviour but when I try it on my HTC Desire, the calculated text width and the calculated width of the text view doesn't seem to match. I've tried both Paint.measureText, Paint.getTextWidths and Paint.getTextBounds, all with the exact same result. Around 9 characters fit in the view but I have to write around 18 characters before it starts making the font size smaller. I use View.getWidth to measure the width of the view and it seems to be correct since it claims to take 392 pixels out of the 480 available (which looks about right). The only thing I can think of is that measureText and getWidth uses different units. Could that be the case? Do you have any other ideas for me? I've tried Stack Overflow and all answers I've seen uses one of the three methods in Paint mentioned above. I appriciate any help, Schoel -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: View width and calculated text width doesn't match
I can provide some additional information here: m_TestPaint = new Paint(); m_TestPaint.set(getPaint()); m_MaxTextSize = getTextSize(); m_TestPaint.setTextSize(m_MaxTextSize); Log.e(FintFit, Paint text size: + m_TestPaint.getTextSize()); Log.e(FintFit, Text text size: + getTextSize()); This outputs 42.0 and 63.0 respectively. That doesn't seem right, does it? Why isn't the Paint respecting the size I set to it? Zsolt: Thanks for the offer but I can't send you my .apk as this code is part of a closed source project. BR, Schoel -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: view and subview
hi please check out the sample code for creating views and viewGroups without a xml public class tut3 extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ScrollView sv = new ScrollView(this); LinearLayout ll = new LinearLayout(this); ll.setOrientation(LinearLayout.VERTICAL); sv.addView(ll); TextView tv = new TextView(this); tv.setText(Dynamic layouts ftw!); ll.addView(tv); EditText et = new EditText(this); et.setText(weee~!); ll.addView(et); Button b = new Button(this); b.setText(I don't do anything, but I was added dynamically. :)); ll.addView(b); for(int i = 0; i 20; i++) { CheckBox cb = new CheckBox(this); cb.setText(I'm dynamic!); ll.addView(cb); } this.setContentView(sv); } } On Jul 17, 5:46 pm, Jags jag...@gmail.com wrote: is there a way i can create a view and add some textviews into it ? programmatically ? any sample code ? regards -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: View is not loading
I am having the same problem as [Lean]. I had Hello Android running in the emulator a few times. Dunno what changed, but now I only get the Home screen. Also, I cannot find a Hello Android icon in the application bar. I know it is installed, because I can see it in the DDMS Eclipse Perspective File Explorer, and also in the Manage Applications menu on the emulator. What am I missing? On Apr 3, 10:15 am, Kumar Bibek coomar@gmail.com wrote: Perhaps, you need to press the menu key to unlock the phone. Thanks and Regards, Kumar Bibek On Apr 1, 6:33 pm, [Lean] mateama...@gmail.com wrote: I've done the HelloWorld tutorial which it worked fine the first time I tried it. Now every time I run it I get the emulator's main screen showing up instead of the HelloWorld text. With main screen I mean a background image with the current time and a battery charging icon. I'm ussing Log.i in the activity and it seems it's loading fine, because I can see the logs in the LogCat's view. Is there any known issue about it? Thanks.- Hide quoted text - - Show quoted text - -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: View is not loading
Perhaps, you need to press the menu key to unlock the phone. Thanks and Regards, Kumar Bibek On Apr 1, 6:33 pm, [Lean] mateama...@gmail.com wrote: I've done the Hello World tutorial which it worked fine the first time I tried it. Now every time I run it I get the emulator's main screen showing up instead of the Hello World text. With main screen I mean a background image with the current time and a battery charging icon. I'm ussing Log.i in the activity and it seems it's loading fine, because I can see the logs in the LogCat's view. Is there any known issue about it? Thanks. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
[android-developers] Re: view list of extra's for a intent
On Mar 24, 7:48 pm, arnoldl arn...@fortuin.nl wrote: in the eclipse debug window i can see it has extra's , but i can''t find a list of those extra's. I also can't find a function to get all extra's into a human readable format. I believe you need to do a bit more work than that. Intent.getExtras() will return the Bundle of all extras. Bundle.keySet() will return an array of all the keys for data in that bundle. From there, you can request each extra individually, using its key. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe from this group, send email to android-developers+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
[android-developers] Re: view list of extra's for a intent
Exactly what i was looking for!! THANKS! On 24 mrt, 22:00, String sterling.ud...@googlemail.com wrote: On Mar 24, 7:48 pm, arnoldl arn...@fortuin.nl wrote: in the eclipse debug window i can see it has extra's , but i can''t find a list of those extra's. I also can't find a function to get all extra's into a human readable format. I believe you need to do a bit more work than that. Intent.getExtras() will return the Bundle of all extras. Bundle.keySet() will return an array of all the keys for data in that bundle. From there, you can request each extra individually, using its key. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe from this group, send email to android-developers+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
[android-developers] Re: View objects lose onclick listeners when screen orientation changes
Hi Joey, Use saveInstanceState()and restoreInstanceState() to save and restore the View settings. When the screen orientation changes, Activity will call saveInsatnceState() and can restore the saved properties in restoreInstanceState(). Thanks On Nov 30, 7:30 am, Joey Carson deathdancefl...@gmail.com wrote: Hello all.. This is my first time using a forum for android and I am relatively new to it as well. I'll cut straight to the chase since this is a seemingly trivial issue that I just cannot find an answer to. I have created a table layout of view objects using Java code and have set the onclick listener. This works fine at first, but when the screen orientation is changed and I try to click one of the Views, I get a force close error. I change the orientation back again and still get the error. What can I do? Thanks to all who respond. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: View background color animation
Thanks, for the lead. I appreciate it, and it worked. I ended up extending the TransitionDrawable class so I could easily set and animate the color. The code is below for anybody who is interested. package com.digitalagua.view; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.graphics.drawable.TransitionDrawable; public class BGColorTransitionDrawable extends TransitionDrawable { private int interval; public BGColorTransitionDrawable(Drawable[] layers) { super(layers); interval = 500; initVars(); } public BGColorTransitionDrawable(Drawable[] layers, int interval) { super(layers); this.interval = interval; initVars(); } private void initVars(){ setCrossFadeEnabled(true); setId(0,0); setId(1,1); } public void changeColor(int color){ setDrawableByLayerId(0, getDrawable(1)); setDrawableByLayerId(1, new ColorDrawable(color)); startTransition(interval); } } I set and call it like so. ColorDrawable layers[] = new ColorDrawable[2]; layers[0] = new ColorDrawable(0xffff); layers[1] = new ColorDrawable(0x); backgroundColorAnimation = new BGColorTransitionDrawable(layers); vColorSwapper.setBackgroundDrawable(backgroundColorAnimation); backgroundColorAnimation.setColor(0xff00ff00); Thanks again, James On Nov 16, 1:46 pm, Romain Guy romain...@google.com wrote: You could just use a TransitionDrawable instead :) On Mon, Nov 16, 2009 at 10:43 PM,DigitalAguareltubse...@gmail.com wrote: I was wondering if someone has a good answer to this. I am looking for a better way to animate a background color transition from on color to the next. Currently, I have two views, vCurrentColor which lays on top of the vNextColor, in a FrameLayout. I then animate the alpha of the currentColorView to zero. At the end of the animation I swap the positions of the views and repeat the process. It is kludgey and slow and I am looking for an alternate method. private void setAnimation(){ color_fade0 = AnimationUtils.loadAnimation (this,R.anim.fade_color_slow); } private void changeColorTo(int newColor){ vNextColor.setBackgroundColor(newColor); useColorFade0 = false; color_fade0.setAnimationListener(color_fade_listener); vCurrentColor.startAnimation(color_fade0); } Animation.AnimationListener color_fade_listener = new Animation.AnimationListener() { public void onAnimationEnd(Animation animation) { vColorContainer.bringChildToFront(vNextColor); LinearLayout swappyMcGee = vCurrentColor; vCurrentColor = vNextColor; vNextColor = swappyMcGee; } public void onAnimationStart(Animation animation) {} public void onAnimationRepeat(Animation animation) {} }; Any help with this would be appreciated. Thanks, 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 -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. 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] Re: view visibility callbacks
We might add something like this in Flan. On Thu, Oct 8, 2009 at 12:13 PM, Jason Proctor jason.android.li...@gmail.com wrote: is there something that gets called off a View when its visibility changes? i'm not seeing an onVisibilityChanged() or equivalent in the docs or code. thanks -- jason.vp.engineering.particle -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. 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] Re: View with both text and progress bar
I need to pass a view with both TEXT and a PROGRESS icon. can this be done with a single view.??? LinearLayout. RelativeLayout. TableLayout. And so on. All subclass android.view.View, and all would allow you to wrap a TextView and a ProgressBar (or ImageView or whatever) into a single View. -- Mark Murphy (a Commons Guy) http://commonsware.com Android App Developer Books: http://commonsware.com/books.html --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: View Files on a remove server/PC
Thanks for your reply. I should have been more clear. Yes, i'm trying to view files from my android device. Hmm, i hadn't thought about SugarSync. I was thinking more along the lines of some sort of file system explorer for a remote location - an FTP server. Connect to the server and view the directory structure and it's files. Thanks, - Johnny On Jul 30, 9:36 am, Yusuf T. Mobile yusuf.s...@t-mobile.com wrote: Are you trying to viewremotefiles on a PC from another PC? In that case WinSCP is a good way. If you are using a non-Windows machine, then scp is the command-line version that ships with most unix distributions, include OSX. If by change you are trying to viewremotefiles with your Android phone, then SugarSync is one application you can use.Or are you trying to do this programmatically? Yusuf Saib Android ·T· · ·Mobile· stick together The views, opinions and statements in this email are those of the author solely in their individual capacity, and do not necessarily represent those of T-Mobile USA, Inc. On Jul 28, 12:14 pm, Gopal Biyani gopalbiy...@gmail.com wrote: Just google for WinSCP. On Tue, Jul 28, 2009 at 3:11 PM, johnny johnny.ra...@gmail.com wrote: Is anyone aware of a way to view the directory structure and files on aremoteserveror PC? Is there an existing app for this? 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: View Android Marketplace
Hi All, New Section added to the website Themes It will list you all themes for Android skins, font, icons customization You can also search by tag = Themes Note: Themes are still visible on initial categories --- Visit us at www.touch-market.com The website dedicated to YOU developers The sweet place for YOU Android users --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: View Android Marketplace
New Feature: Now rate your favorite Apps on www.touch-market.com --- Visit us at www.touch-market.com THE website dedicated to YOU developers THE sweet place for YOU Android users --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: View Android Marketplace
You also have www.touch-markt.com It has (compare to other directories) - Widgets category (as we think this category is missing on Android Market) - Devices category (that list all Official Android Devices with pics and full specs) - Screenshots (More added every day) And coming soon: Dedicated space/features for Android Developers -- The touch-maket team Visit us at www.touch-market.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: View Android Marketplace
You also have www.touch-market.com The + of www.touch-market.com: - List of widgets on their initial category as well as in a separate one - List of official devices with photos and full specs - 2D codebar for direct link to android market on your device - Screenshots (WYSIWYG = What You See Is What You Get) Coming Soon: - Developers will be able to manage and promote their apps pages themselves - Special Developers section with wiki/references/tutorials (for beginners and pro) Visit www.touch-market.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: View Android Marketplace
There are a few websites that supply this information http://www.cyrket.com/ is one of them. On Aug 3, 10:48 am, steiljes fbgkd...@gmail.com wrote: How to view the comprehensive list of apps in the marketplace? Do I need to buy a handset AND the service with it to see the marketplace? I don't want to start developing before I know what the market really looks like. The android.com website offers only a few apps. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: View Android Marketplace
hey thanks On Aug 3, 3:02 pm, Mattwho matt...@gmail.com wrote: There are a few websites that supply this informationhttp://www.cyrket.com/is one of them. On Aug 3, 10:48 am, steiljes fbgkd...@gmail.com wrote: How to view the comprehensive list of apps in the marketplace? Do I need to buy a handset AND the service with it to see the marketplace? I don't want to start developing before I know what the market really looks like. The android.com website offers only a few apps. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: View Files on a remove server/PC
Are you trying to view remote files on a PC from another PC? In that case WinSCP is a good way. If you are using a non-Windows machine, then scp is the command-line version that ships with most unix distributions, include OSX. If by change you are trying to view remote files with your Android phone, then SugarSync is one application you can use.Or are you trying to do this programmatically? Yusuf Saib Android ·T· · ·Mobile· stick together The views, opinions and statements in this email are those of the author solely in their individual capacity, and do not necessarily represent those of T-Mobile USA, Inc. On Jul 28, 12:14 pm, Gopal Biyani gopalbiy...@gmail.com wrote: Just google for WinSCP. On Tue, Jul 28, 2009 at 3:11 PM, johnny johnny.ra...@gmail.com wrote: Is anyone aware of a way to view the directory structure and files on a remote server or PC? Is there an existing app for this? 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: View Files on a remove server/PC
Just google for WinSCP. On Tue, Jul 28, 2009 at 3:11 PM, johnny johnny.ra...@gmail.com wrote: Is anyone aware of a way to view the directory structure and files on a remote server or PC? Is there an existing app for this? 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: View with rounded corners and transparent background
Try using solid android:color=#ee44/ On Jul 6, 5:52 pm, Ice13ill andrei.fifi...@gmail.com wrote: Hello, I wanted to create a custom view with rounded corners and a transparent background (lets say #dd00) I created a color and it worked ok For the rounded corners I found this method: Create a file res/drawable/my_border.xml and define a shape: shape xmlns:android=http://schemas.android.com/apk/res/android; stroke android:width=4dp android:color=#FF00FF00 / padding android:left=7dp android:top=7dp android:right=7dp android:bottom=7dp / corners android:radius=4dp / /shape But how/where do i specify the background color ? I tried background android:color=.../ ...it doesn't work :( Can anyone help ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: View size after orientation change
If you are correctly using layout managers, a relayout of the view hierarchy will happen and the view will be given whatever size the layout managers now decide it should have. On Wed, Jun 17, 2009 at 7:47 AM, Alex amagu...@gmail.com wrote: Hi, Is the view aware of the orientation change in order to return updated size after a change in orientation? I'm handling the orientation myself (android:configChanges=orientation|keyboardHidden). Does it means that I have to take into account the orientation state when querying for view.getHeight()? The view returns the same value as before the orientation change. It this the normal behavior or I should notify somehow the view to refresh its size. Thanks. -- 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] Re: View object clonning
Hi, It is not possible. You could do it manually by simply copying your custom attributes and initializing the base class in the exact same way. On Thu, May 14, 2009 at 4:55 AM, Raja Nagendra Kumar nagendra.r...@tejasoft.com wrote: Hi, Is it possible to clone a view. If no, how to support clone of a view in custom views. If yes.. which api should we use. clone method seems to be protected for view. Regards, Raja Nagendra Kumar, C.T.O www.tejasoft.com -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. 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] Re: View the data directory on the G1
Another way to view the data directory is to install the Astro file manager from Android Market. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: View the data directory on the G1
if its permission issue .. get su access .. search for getting root on G1 -Dan On Feb 11, 10:35 pm, ivan istas...@gmail.com wrote: How does one view the /data directory on the G1? I've tried multiple different ways. Using adb from the command prompt gives a permission denied message. Is there any way to get around this denial of access? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: View/layout designer/editor
Stoyan Damov wrote: Does anyone recall the name of that app? You might be thinking of DroidDraw: http://www.droiddraw.org/ However, I believe work was suspended on it back in mid-2008, so it would generate layouts for the older M5 SDK. That's not a show-stopper, but it would take some twiddling to clean up them up for Android 1.0r2. -- Mark Murphy (a Commons Guy) http://commonsware.com Android Training on the Ranch! -- Mar 16-20, 2009 http://www.bignerdranch.com/schedule.shtml --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: View/layout designer/editor
On Wed, Jan 7, 2009 at 11:02 PM, Mark Murphy mmur...@commonsware.com wrote: Stoyan Damov wrote: Does anyone recall the name of that app? You might be thinking of DroidDraw: http://www.droiddraw.org/ That's it! However, I believe work was suspended on it back in mid-2008, so it would generate layouts for the older M5 SDK. That's not a show-stopper, but it would take some twiddling to clean up them up for Android 1.0r2. :( Thanks a bunch! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: View after ListView does not show up
I have a problem to display the view (e.g. Button after the ListView which I will bind and populate from a CursorAdapter). snip The list displays perfectly, however, the button at bottom never shows up.. If I put the button on top of the list, it works fine. Have you tried putting a specific height on the ListView, or on the LinearLayout that contains it? Anyone know the reason? I'm just guessing here, based on what I've run into. ListView does not play well with wrap_content, either on itself or on parent containers (e.g., your LinearLayout), since the content is indeterminate at layout time. It'll tend to grab whatever space is available, and tell its parents to grab whatever space is available. And, since Android takes a single pass through the layout files, the ListView will tend to slurp up all the available space before later widgets, like your button, get their shot. So you wind up needing explicit height control, such as a specific pixel height on the ListView or one of its parents. I haven't played with android:layout_weight in this scenario, to see if it could be used to better manage the ListView's height. But that might work. Or, you can always calculate the height yourself in onCreate() and adjust it as needed, if your attempts to constrain it leave you with improper dimensions on some device resolutions. Or, just have your ListView be the last widget in the chain (e.g., put the button above it). Or, dump the other widgets and just have the ListView, using dialogs or secondary activities or ViewFlipper or tabs or something for the other user input. I'm actually not a big fan of mixing ListViews and much else on an activity, mostly because we're going to wind up with some mighty small screens (e.g., 240x320 on a flip-phone-sized display), and non-touch-screen devices to boot, and so the more complicated we make our UIs, the more difficult they will be for many users to use. They might be...ummm...dreamy in the immediate term, but they'll pose problems over time as Android gets used in many other form factors. A fine example of this philosophy is the preferences activity. Everything is either something trivial for a single row (e.g., checkbox) or goes into a dialog. -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 1.2 Published! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: View cant accept key event ?
A View can certainly receive key events, that is how most key processing (center pressing in buttons, navigating in lists, entering text in text views) works. To receive key events, a view does need to have focus. This will happen for you through the normal focus navigation, or you can explicitly request focus with View.requestFocus(). See the Focus Handling and other sections of the view doc for more info: http://code.google.com/android/reference/android/view/View.html On Aug 15, 1:03 am, Wlliam.Zhang [EMAIL PROTECTED] wrote: hi, I overrided the onKeyDown method of a class inherited form View, but it seems the key event cant posted to the view object at all, I have tried to focuse/selecte the view but all failed. Only the activity can get the key, is that to say we have to recieve key event in activity and forward it to view manually ? anyone has idea? thanks. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: View Activity Communicaton
On Apr 9, 8:43 pm, Rui Martins [EMAIL PROTECTED] wrote: Is there a way to avoid the Dark Grey background while the application is starting, like setting up a layout.xml or similar, so that we get either a predefined background or at the worst case a full Black background while the application is loading ? You should use android:theme in the manifest to set the overall theme of the activity, so they system can show a preview that matches what it actually looks like. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: View Activity Communicaton
Once again thank you for the feedback. I would then suggest for someone to review the examples, since I'm 99% sure that I got the Application suggestion, from an Android Documentation example, I just can't pin point it right now. Currently, it's working a lot better and faster, by using activity, and start subactivity, since it's not launching a new Task everytime. The make your view an inner class of activity suggestion, doesn't work when we want to reuse a view, but for the other more common cases it's fine, althought currently all my views are not inner classes (I'm passing the activity, so no problem their now). By the way, once we launch the application we get a Dark Grey Back ground, with a Title on top, stating our application name, has defined in the AndroidManifest.xml file and res/values/strings.xml, which is perfectly fine. However, all my Activities are setup so that I don't get a title or even a status bar at the top, by having startup code in onCreate like the following: /** Called when the activity is first created. */ @Override public void onCreate( Bundle icicle ) { super.onCreate( icicle ); // We do NOT need a title. requestWindowFeature( Window.FEATURE_NO_TITLE ); // remove status bar, to get FULLSCREEN getWindow().setFlags( WindowManager.LayoutParams.NO_STATUS_BAR_FLAG | WindowManager.LayoutParams.LAYOUT_IN_SCREEN_FLAG, WindowManager.LayoutParams.NO_STATUS_BAR_FLAG | WindowManager.LayoutParams.LAYOUT_IN_SCREEN_FLAG ); setContentView( new AppView( this ) ); ... } Is there a way to avoid the Dark Grey background while the application is starting, like setting up a layout.xml or similar, so that we get either a predefined background or at the worst case a full Black background while the application is loading ? I have tryed using a loading something similar to a splash screen, whcih loads faster, but I always get the dark grey background with title to pop up before actually loading the first activity. A hint for getting rid of this would be great ! Once again, thank you for the feedback. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: View Activity Communicaton
Possibly an important piece of information that I haven't mentioned before. I'm NOT using the available Android widjets, like buttons and similar, to avoid GUI problems between SDKs, specially since the application is a game, and is NOT common to use the phone OS GUI inside a game. Games usualy provide a GUI interface of their own, in order to be able to control all aspects of the Graphical Interface. So, I'm drawing all my View contents, using Drawables, and processing the onKeyDown and onMotionEvent/onTouchEvent inputs myself. And obviously I'm not setting these view components through androidManifest.xml. I only declare my Activities there and that's it. On 8 abr, 06:54, Rui Martins [EMAIL PROTECTED] wrote: Another Example: How do we call our activity finish method, from our activity view class ? Inside an Activity context, we can just call finish(); Inside a view, apparently we can't get a reference to the Activity that contains us (the view), and even if there is a way to get the reference, we can't probably call it directly, due to UI threading issues. So, do we send a message ? How ? How do we get the reference to the Handler defined inside our Activity, to be able to call myHandler.sendMessage(...) ? I think the UI handling code is complex and cumbersome to work with. I agree that probably should use messaging, since this helps to decouple the several application parts, but the current API, is not very helpful, in making the common message usage simple. Any help on this would be great too. Thanks On 8 abr, 06:22, Rui Martins [EMAIL PROTECTED] wrote: I have been programming for android since January, and I must say, that I still don't get how the communication between Views and Activities is accomplished successfully. The whole design on this communication is fuzzy at least for me. NOTE: using M3 currenlty. Examples: Activities can have menus, creating when onCreateOptionsMenu( Menu menu ) is called Later we can get the menu selection by implementing onOptionsItemSelected( Menu.Item item ). So, inside and Activity, we have access to user actions/input in the form of a menu, and hence we can react to it, for example, by launching another activity (typical usage). This works, because we are in the context of the activity. NOTE: This is what I'm using now, so that I could keep on developing until I find a solution to my problem (next). Now if, you look at the View object, it's the only one to have user input handlers, like: onMotionEvent( MotionEvent event ) ( or onTouchEvent for M5), and onKeyDown( int keyCode, KeyEvent event ) ! An Activity doesn't have those ! So, how can we handle user input, and react accordingly ? If we call intent.startActivity() from within a View , we get an Application Error, with the following description: An error has occurred in process XXX calling startActivity() from outside of an Activity context requires the NEW_TASK_LAUNCH flag. is this really what you want ? The explanation, stating that a flag is required is fine ! But how am I to know the answer to the question ? (is this really what you want ?) http://code.google.com/android/reference/android/content/Intent.html#... If I force the Flag, I will enter into further configuration problems or limitations, due to how we MUST setup the Activity launchMode (http://code.google.com/android/reference/android/ R.attr.html#launchMode) Which means, that I will have several simultaneous tasks for every menu option, which is not what was wanted. I can possibly set my lauchMode to singleTask, but is this really what I want ? I'm just trying to do a simple common thing, react to user input by launching a specific sub activity of the application, like in a menu kind of way. I know that there is the concept of subActivity in M5, that probably helps (not sure though), but this should be easy to do, even in M3 and apparently it's not ! Either I'm missing something, or I haven't still got it, how this is supposed to work. And having Documentation only for M5 stuff, doesn't help much either. Enlightnment on this subject and the View/Activity communcation/user input duality would be real nice. I needed this to work to finish my Contest entry! :( Or else I have to keep using the general Menu, instead of my game Menu, which doesn't quite cut it for a game application. NOTE: I'm trying NOT to break the rest of my app, by Porting the remaining stuff to M5. I have an early version that I had ported to M5, but I went back due to some stuff not working on M5, so not really an option. I also don't expect a new SDK Release now so close to the contest deadline, which could fix a lot of things, but could also bring a whole lot of new bugs too. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google
[android-developers] Re: View Activity Communicaton
Inside a view, apparently we can't get a reference to the Activity that contains us (the view), and even if there is a way to get the reference, we can't probably call it directly, due to UI threading issues. You do have access to the Activity. It's actually the Context that gets passed into the view constructor. You'll just have to cast it to Activity. How do we get the reference to the Handler defined inside our Activity, to be able to call myHandler.sendMessage(...) ? You mean within your view class, you want access to the handler? I don't see how you'd need it. I might be wrong, but you should already be in the UI thread so a handler shouldn't be needed. On Apr 7, 10:54 pm, Rui Martins [EMAIL PROTECTED] wrote: Another Example: How do we call our activity finish method, from our activity view class ? Inside an Activity context, we can just call finish(); Inside a view, apparently we can't get a reference to the Activity that contains us (the view), and even if there is a way to get the reference, we can't probably call it directly, due to UI threading issues. So, do we send a message ? How ? How do we get the reference to the Handler defined inside our Activity, to be able to call myHandler.sendMessage(...) ? I think the UI handling code is complex and cumbersome to work with. I agree that probably should use messaging, since this helps to decouple the several application parts, but the current API, is not very helpful, in making the common message usage simple. Any help on this would be great too. Thanks On 8 abr, 06:22, Rui Martins [EMAIL PROTECTED] wrote: I have been programming for android since January, and I must say, that I still don't get how the communication between Views and Activities is accomplished successfully. The whole design on this communication is fuzzy at least for me. NOTE: using M3 currenlty. Examples: Activities can have menus, creating when onCreateOptionsMenu( Menu menu ) is called Later we can get the menu selection by implementing onOptionsItemSelected( Menu.Item item ). So, inside and Activity, we have access to user actions/input in the form of a menu, and hence we can react to it, for example, by launching another activity (typical usage). This works, because we are in the context of the activity. NOTE: This is what I'm using now, so that I could keep on developing until I find a solution to my problem (next). Now if, you look at the View object, it's the only one to have user input handlers, like: onMotionEvent( MotionEvent event ) ( or onTouchEvent for M5), and onKeyDown( int keyCode, KeyEvent event ) ! An Activity doesn't have those ! So, how can we handle user input, and react accordingly ? If we call intent.startActivity() from within a View , we get an Application Error, with the following description: An error has occurred in process XXX calling startActivity() from outside of an Activity context requires the NEW_TASK_LAUNCH flag. is this really what you want ? The explanation, stating that a flag is required is fine ! But how am I to know the answer to the question ? (is this really what you want ?) http://code.google.com/android/reference/android/content/Intent.html#... If I force the Flag, I will enter into further configuration problems or limitations, due to how we MUST setup the Activity launchMode (http://code.google.com/android/reference/android/ R.attr.html#launchMode) Which means, that I will have several simultaneous tasks for every menu option, which is not what was wanted. I can possibly set my lauchMode to singleTask, but is this really what I want ? I'm just trying to do a simple common thing, react to user input by launching a specific sub activity of the application, like in a menu kind of way. I know that there is the concept of subActivity in M5, that probably helps (not sure though), but this should be easy to do, even in M3 and apparently it's not ! Either I'm missing something, or I haven't still got it, how this is supposed to work. And having Documentation only for M5 stuff, doesn't help much either. Enlightnment on this subject and the View/Activity communcation/user input duality would be real nice. I needed this to work to finish my Contest entry! :( Or else I have to keep using the general Menu, instead of my game Menu, which doesn't quite cut it for a game application. NOTE: I'm trying NOT to break the rest of my app, by Porting the remaining stuff to M5. I have an early version that I had ported to M5, but I went back due to some stuff not working on M5, so not really an option. I also don't expect a new SDK Release now so close to the contest deadline, which could fix a lot of things, but could also bring a whole lot of new bugs too. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the
[android-developers] Re: View Activity Communicaton
I'm not setting these view components through androidManifest.xml. I don't think I understand. How does a view have anything to do with the androidmanifest? On Apr 7, 11:08 pm, Rui Martins [EMAIL PROTECTED] wrote: Possibly an important piece of information that I haven't mentioned before. I'm NOT using the available Android widjets, like buttons and similar, to avoid GUI problems between SDKs, specially since the application is a game, and is NOT common to use the phone OS GUI inside a game. Games usualy provide a GUI interface of their own, in order to be able to control all aspects of the Graphical Interface. So, I'm drawing all my View contents, using Drawables, and processing the onKeyDown and onMotionEvent/onTouchEvent inputs myself. And obviously I'm not setting these view components through androidManifest.xml. I only declare my Activities there and that's it. On 8 abr, 06:54, Rui Martins [EMAIL PROTECTED] wrote: Another Example: How do we call our activity finish method, from our activity view class ? Inside an Activity context, we can just call finish(); Inside a view, apparently we can't get a reference to the Activity that contains us (the view), and even if there is a way to get the reference, we can't probably call it directly, due to UI threading issues. So, do we send a message ? How ? How do we get the reference to the Handler defined inside our Activity, to be able to call myHandler.sendMessage(...) ? I think the UI handling code is complex and cumbersome to work with. I agree that probably should use messaging, since this helps to decouple the several application parts, but the current API, is not very helpful, in making the common message usage simple. Any help on this would be great too. Thanks On 8 abr, 06:22, Rui Martins [EMAIL PROTECTED] wrote: I have been programming for android since January, and I must say, that I still don't get how the communication between Views and Activities is accomplished successfully. The whole design on this communication is fuzzy at least for me. NOTE: using M3 currenlty. Examples: Activities can have menus, creating when onCreateOptionsMenu( Menu menu ) is called Later we can get the menu selection by implementing onOptionsItemSelected( Menu.Item item ). So, inside and Activity, we have access to user actions/input in the form of a menu, and hence we can react to it, for example, by launching another activity (typical usage). This works, because we are in the context of the activity. NOTE: This is what I'm using now, so that I could keep on developing until I find a solution to my problem (next). Now if, you look at the View object, it's the only one to have user input handlers, like: onMotionEvent( MotionEvent event ) ( or onTouchEvent for M5), and onKeyDown( int keyCode, KeyEvent event ) ! An Activity doesn't have those ! So, how can we handle user input, and react accordingly ? If we call intent.startActivity() from within a View , we get an Application Error, with the following description: An error has occurred in process XXX calling startActivity() from outside of an Activity context requires the NEW_TASK_LAUNCH flag. is this really what you want ? The explanation, stating that a flag is required is fine ! But how am I to know the answer to the question ? (is this really what you want ?) http://code.google.com/android/reference/android/content/Intent.html#... If I force the Flag, I will enter into further configuration problems or limitations, due to how we MUST setup the Activity launchMode (http://code.google.com/android/reference/android/ R.attr.html#launchMode) Which means, that I will have several simultaneous tasks for every menu option, which is not what was wanted. I can possibly set my lauchMode to singleTask, but is this really what I want ? I'm just trying to do a simple common thing, react to user input by launching a specific sub activity of the application, like in a menu kind of way. I know that there is the concept of subActivity in M5, that probably helps (not sure though), but this should be easy to do, even in M3 and apparently it's not ! Either I'm missing something, or I haven't still got it, how this is supposed to work. And having Documentation only for M5 stuff, doesn't help much either. Enlightnment on this subject and the View/Activity communcation/user input duality would be real nice. I needed this to work to finish my Contest entry! :( Or else I have to keep using the general Menu, instead of my game Menu, which doesn't quite cut it for a game application. NOTE: I'm trying NOT to break the rest of my app, by Porting the remaining stuff to M5. I have an early version that I had ported to M5, but I went back due to some stuff not working on M5, so not
[android-developers] Re: View Activity Communicaton
On Apr 7, 10:54 pm, Rui Martins [EMAIL PROTECTED] wrote: Another Example: How do we call our activity finish method, from our activity view class ? You can either hand the activity to the view for it to make calls on to, or have a callback interface from the view that the activity implements and does what it wants (such as call finish()) when the callback executes. Inside a view, apparently we can't get a reference to the Activity that contains us (the view), and even if there is a way to get the reference, we can't probably call it directly, due to UI threading issues. There are no UI threading issues, unless you have created your own thread (with its own event loop and instantiated a view hierarchy and window there) then all of these objects are running on the same thread, the main thread of the process. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: View Activity Communicaton
True. To make it more generic, some class checking should be done. On Apr 8, 12:28 am, hackbod [EMAIL PROTECTED] wrote: On Apr 7, 11:52 pm, Dan U. [EMAIL PROTECTED] wrote: Inside a view, apparently we can't get a reference to the Activity that contains us (the view), and even if there is a way to get the reference, we can't probably call it directly, due to UI threading issues. You do have access to the Activity. It's actually the Context that gets passed into the view constructor. You'll just have to cast it to Activity. Though formally you shouldn't assume the Context you have in a view is an Activity (for example the Dialog class creates a wrapper of the context you give it that is set up to have the correct theme for a dialog)... for a particular application, if you know that the Context you used to create a view is actually an Activity (because after all that is the thing you passed to the view constructor or inflate function), then doing this should be fine. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: View Activity Communicaton
Thanks a lot dor the input. From all that was said, I believe that I may be feeding the View Constructor with something else than the activity, probably something like Application or similar, I know I copied one example from the SDK, if I'm not mistaken, I'll have to check when I get back home. But having to force a cast on the context given to a view, just to be able to call the methods from the activity on the same context, seems like a hack to me. Probably better than what I'm doing know (forcing the flag NEW_TASK_LAUNCH). But this probably hints that something must be changed in the interface between an Activity and a View. Since, the need to force casts to input of an API, is usually sign of a not so good solution. Food for tought, probably. Is this Activity - View communication model, by any chance already being review for future versions? If Yes, any info on it, that could be advanced before hand ? Thanks a LOT for the prompt feedback. On Apr 8, 9:04 am, Dan U. [EMAIL PROTECTED] wrote: True. To make it more generic, some class checking should be done. On Apr 8, 12:28 am, hackbod [EMAIL PROTECTED] wrote: On Apr 7, 11:52 pm, Dan U. [EMAIL PROTECTED] wrote: Inside aview, apparently we can't get a reference to theActivity that contains us (theview), and even if there is a way to get the reference, we can't probably call it directly, due to UI threading issues. You do have access to theActivity. It's actually the Context that gets passed into theviewconstructor. You'll just have to cast it to Activity. Though formally you shouldn't assume the Context you have in aviewis anActivity(for example the Dialog class creates a wrapper of the context you give it that is set up to have the correct theme for a dialog)... for a particular application, if you know that the Context you used to create aviewis actually anActivity(because after all that is the thing you passed to theviewconstructor or inflate function), then doing this should be fine. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: View Activity Communicaton
I had this exact question a while ago, when I was building some custom View components. What I wanted was a little more complicated though - it was basically this. Basic containing view, set in the Activity class itself Several classes stored inside the activity with views defined *inside those classes* I needed these external views to be able to launch subactivities and deal with the return codes themselves. At first this seemed kind of nasty, because the functionality I wanted for my non-activity view classes is *only* available in an activity! The solution, as it turns out, was pretty simple - define your own constructor for those classes, and pass in the activity. Then you can just call whatever you need to on it. It works like this: public class MyActivity extends View{ private final Activity mActivity; public MyActivity(Activity a){ super(a); //since Activity extends context, this works just fine mActivity = a; ... } @Override public void onClick(View v){ ... mActivity.startSubActivity(...); ... } } Dealing with the return codes was a little trickier, but it doesn't sound like that's what you need right now. If it is, just ask. :) - TM --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: View Activity Communicaton
On Apr 8, 7:22 am, Rui Martins [EMAIL PROTECTED] wrote: But having to force a cast on the context given to a view, just to be able to call the methods from the activity on the same context, seems like a hack to me. Probably better than what I'm doing know (forcing the flag NEW_TASK_LAUNCH). Well, you have a range of choices: - Using NEW_TASK_LAUNCH like this is fundamentally broken (unless that is the semantics you really want)/ - Performing a cast is a quick and dirty style that you can use when you know exactly how your View class will be used. - You can give an explicitly Activity object to the view, which allows the view to work in all situations though it may be awkward to hook things up. - Or you can have a formal callback interface from the view, like the various ones used in the platform frameworks, which is the cleanest approach. But this probably hints that something must be changed in the interface between an Activity and a View. Since, the need to force casts to input of an API, is usually sign of a not so good solution. No, this is intentional. A view may very well not be running inside of an activity. For example, it could be put in a dialog, in which case there is no activity to finish. Is this Activity - View communication model, by any chance already being review for future versions? If Yes, any info on it, that could be advanced before hand ? We don't expect any major changes to 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 [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: View Activity Communicaton
Another Example: How do we call our activity finish method, from our activity view class ? Inside an Activity context, we can just call finish(); Inside a view, apparently we can't get a reference to the Activity that contains us (the view), and even if there is a way to get the reference, we can't probably call it directly, due to UI threading issues. So, do we send a message ? How ? How do we get the reference to the Handler defined inside our Activity, to be able to call myHandler.sendMessage(...) ? I think the UI handling code is complex and cumbersome to work with. I agree that probably should use messaging, since this helps to decouple the several application parts, but the current API, is not very helpful, in making the common message usage simple. Any help on this would be great too. Thanks On 8 abr, 06:22, Rui Martins [EMAIL PROTECTED] wrote: I have been programming for android since January, and I must say, that I still don't get how the communication between Views and Activities is accomplished successfully. The whole design on this communication is fuzzy at least for me. NOTE: using M3 currenlty. Examples: Activities can have menus, creating when onCreateOptionsMenu( Menu menu ) is called Later we can get the menu selection by implementing onOptionsItemSelected( Menu.Item item ). So, inside and Activity, we have access to user actions/input in the form of a menu, and hence we can react to it, for example, by launching another activity (typical usage). This works, because we are in the context of the activity. NOTE: This is what I'm using now, so that I could keep on developing until I find a solution to my problem (next). Now if, you look at the View object, it's the only one to have user input handlers, like: onMotionEvent( MotionEvent event ) ( or onTouchEvent for M5), and onKeyDown( int keyCode, KeyEvent event ) ! An Activity doesn't have those ! So, how can we handle user input, and react accordingly ? If we call intent.startActivity() from within a View , we get an Application Error, with the following description: An error has occurred in process XXX calling startActivity() from outside of an Activity context requires the NEW_TASK_LAUNCH flag. is this really what you want ? The explanation, stating that a flag is required is fine ! But how am I to know the answer to the question ? (is this really what you want ?) http://code.google.com/android/reference/android/content/Intent.html#... If I force the Flag, I will enter into further configuration problems or limitations, due to how we MUST setup the Activity launchMode (http://code.google.com/android/reference/android/ R.attr.html#launchMode) Which means, that I will have several simultaneous tasks for every menu option, which is not what was wanted. I can possibly set my lauchMode to singleTask, but is this really what I want ? I'm just trying to do a simple common thing, react to user input by launching a specific sub activity of the application, like in a menu kind of way. I know that there is the concept of subActivity in M5, that probably helps (not sure though), but this should be easy to do, even in M3 and apparently it's not ! Either I'm missing something, or I haven't still got it, how this is supposed to work. And having Documentation only for M5 stuff, doesn't help much either. Enlightnment on this subject and the View/Activity communcation/user input duality would be real nice. I needed this to work to finish my Contest entry! :( Or else I have to keep using the general Menu, instead of my game Menu, which doesn't quite cut it for a game application. NOTE: I'm trying NOT to break the rest of my app, by Porting the remaining stuff to M5. I have an early version that I had ported to M5, but I went back due to some stuff not working on M5, so not really an option. I also don't expect a new SDK Release now so close to the contest deadline, which could fix a lot of things, but could also bring a whole lot of new bugs too. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: View Parents
thx megat Joshi i´m currently use m5rc15 ,but i solverd the problem. I was triying to assign a static view between 2 activities and when return to main activity show exception. thats occurs because second activity catch the static view an throws the exception when back to main activiy and tries to use that static view. thx again. regards On Apr 3, 8:00 pm, Megha Joshi [EMAIL PROTECTED] wrote: Hi, Please post the following information to debug your issue: 1) SDK version 2) Relevant code 3) logcat output Thanks, Megha On Thu, Apr 3, 2008 at 2:58 PM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: when i triying to change from a subactivity to main activity then push navigation keys and appear an exception what does mean? parameter must be a descendant of this view --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---