Re: [android-developers] Android devices and use of MM/INCH
You're right... This is the config of DisplayMetrics of One X: xdpi = 240 widthPixels = 480 We can deduce that the screen have a width of 2 inches... but in real - 2,25 inches So, is there a solution to determine this automatically? Or is it impossible to have real mesure on all devices? Le mardi 28 août 2012 16:06:06 UTC+2, Latimerius a écrit : On Tue, Aug 28, 2012 at 3:07 PM, Thesalan thes...@gmail.com javascript: wrote: For a project, I have to use real size, like millimeters and inches. But on some devices, these values are false! I have tested on some devices, and it appears that on HTC One X and HTC Wildfire, 10mm = 11/12mm... But on Nexus One, Nexus S, Galaxy S2 these sizes are right! To do this, I use this code : float pxCm = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_MM, 10, r.getDisplayMetrics()); Someone have already encounter this problem? If yes, how have you bypass this? One thing I noticed is that devices can lie about their DPI. For instance, LG P500 states it has a 160 dpi screen but if you measure the screen and do the maths, it's actually 180 dpi. Correspondingly, if you compute your pixel sizes based on the 160 dpi figure to get a specified physical size (in mm), it will come out smaller. I'd compute the actual DPI One X and Wildfire have and compare that to figures in DisplayMetrics. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: Tabs as IPhone
Look at this http://developer.android.com/training/implementing-navigation/index.html In particular Lateral Navigation for the tabs, and Ancestral Navigation for the other Le mercredi 29 août 2012 08:56:18 UTC+2, Nine a écrit : Dear all, I want to make a application which will use Tabs. These Tabs will have behaviour as IPhone that means : Tab 1: A - B Tab 2: C - D But when from A to B, we will still have Tabs at the bottom of screen. The B screen will replace the A screen but doesn't replace all screen. Please help me, how to do it. 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: ViewPager and setClipChildren(false)
Exactly! Thanks Dave! Le mercredi 29 août 2012 01:45:11 UTC+2, Dave Smith a écrit : Thesalan - Calling setLayerType() on just the View will work, but you have to do it on the correct view. In this case, the issue that doesn't work with hardware acceleration is the parent ViewGroup clipping its children, so the PagerContainer in the example is the view that you need to call it on, not the ViewPager itself. If you modify PagerContainer.java in the gist like so: private void init() { setClipChildren(false); setLayerType(View.LAYER_TYPE_SOFTWARE, null); } You should be able to enable hardware acceleration in your manifest and the pager code will still work as expected. I will update the gist example when I have a spare moment with some discussion, and I have starred the issue Mark created (you should do the same). Cheers, Dave Smith @devunwired On Monday, August 27, 2012 2:29:20 AM UTC-6, Thesalan wrote: Hi! I started Android development last week, and I have a problem with a code on some devices : I have to develop an application with a specific controller like a horizontal wheel. To do this, I want to use the ViewPager, with setClipChildren(false) to extend the view. I based on the following code : https://gist.github.com/8cbe094bb7a783e37ad1 The result looks like this : https://lh4.googleusercontent.com/-DjFOnG7O0wY/UDstWN3AE2I/AfE/yWpndOBTWIA/s1600/emulator.png The ViewPager here is just on Item4, and with setClipChildren(false) we can see the other item. This works greats on emulator (tested on API 7 to 16) and some devices! But I encounter some problems on more recent devices, like HTC One X (Android 4.0.4) and a Nexus S (CM10 - Android 4.1.1) : the ViewPager doesn't really extended! Just the current item is shown, and when you are sliding, the next item is shown : https://lh3.googleusercontent.com/-clS7voj3rLk/UDsvfP1HnhI/AfM/K8uMV_9PLFA/s1600/onex_current.png When sliding : https://lh5.googleusercontent.com/-3tYaKu_Oz7w/UDsvnljXJ0I/AfU/JEaCZolThJ4/s1600/onex_sliding.png Anybody else already encounter this problem? I think is an optimization on these devices, but how can I bypass 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: New to developing
Look at this : http://developer.android.com/training/basics/firstapp/building-ui.html Section Add String Resources Le mercredi 29 août 2012 00:22:14 UTC+2, Lee a écrit : As such I took your advice and started with the Hello World tutorial, and surprise! Errors errors and an error. ?xml version=1.0 encoding=utf-8? LinearLayout xmlns:android=http://schemas.android.com/apk/res/android; xmlns:tools=http://schemas.android.com/tools; android:layout_width=match_parent android:layout_height=match_parent android:orientation=horizontal EditText android:id=@+id/edit_message android:layout_weight=1 android:layout_width=0dp android:layout_height=wrap_content android:hint=@string/edit_message/ //error: Error: No resource found that matches the given name (at 'hint' with value '@string/ edit_message'). Button android:layout_width=wrap_content android:layout_height=wrap_content android:text=@string/button_Send/ //error: Error: No resource found that matches the given name (at 'text' with value '@string/ button_Send'). /LinearLayout -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] ViewPager and setClipChildren(false)
Hi! I started Android development last week, and I have a problem with a code on some devices : I have to develop an application with a specific controller like a horizontal wheel. To do this, I want to use the ViewPager, with setClipChildren(false) to extend the view. I based on the following code : https://gist.github.com/8cbe094bb7a783e37ad1 The result looks like this : https://lh4.googleusercontent.com/-DjFOnG7O0wY/UDstWN3AE2I/AfE/yWpndOBTWIA/s1600/emulator.png The ViewPager here is just on Item4, and with setClipChildren(false) we can see the other item. This works greats on emulator (tested on API 7 to 16) and some devices! But I encounter some problems on more recent devices, like HTC One X (Android 4.0.4) and a Nexus S (CM10 - Android 4.1.1) : the ViewPager doesn't really extended! Just the current item is shown, and when you are sliding, the next item is shown : https://lh3.googleusercontent.com/-clS7voj3rLk/UDsvfP1HnhI/AfM/K8uMV_9PLFA/s1600/onex_current.png When sliding : https://lh5.googleusercontent.com/-3tYaKu_Oz7w/UDsvnljXJ0I/AfU/JEaCZolThJ4/s1600/onex_sliding.png Anybody else already encounter this problem? I think is an optimization on these devices, but how can I bypass 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: Multiple Icons appear on device when my project run!
I'm a beginner, so maybe I'm wrong, but in your manifest, all your activities are set with the following intent? intent-filter action android:name=android.intent.action.MAIN / category android:name=android.intent.category.LAUNCHER / /intent-filter Just the main activity have to contain this intent Le samedi 25 août 2012 21:37:08 UTC+2, KinnMirr a écrit : How do I stop the multiple icons? See attached PNG for details. P.S. A few minutes ago I posted this question to another group. I think that other group was wrong. Sorry -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: Dear Developers
Why do you want to use JSON? Android use XML, not JSON.. Le mardi 28 août 2012 11:42:07 UTC+2, parthi a écrit : how can i create dynamically widgets in android using json parser is it possible to create -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: Dear Developers
I just a beginner in Android development, so I don't know if it's possible... But, I don't think that you are on the good way... Send interface and code by web it's not advisable. If you really want to do this (to not integrate UI in your app), maybe you have to look for an HTML interface or webview... If you really want to do this, you have to manually parse the json and create the java elements... ( if ( json == textview) if ( json.child == id). ) Le mardi 28 août 2012 11:42:07 UTC+2, parthi a écrit : how can i create dynamically widgets in android using json parser is it possible to create -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: Dear Developers
I just a beginner in Android development, so I don't know if it's possible... But, I don't think that you are on the good way... Send interface and code by web it's not advisable. If you really want to do this (to not integrate UI in your app), maybe you have to look for an HTML interface or webview... If you really want to do this, you have to manually parse the json and create the java elements... ( if ( json == textview) if ( json.child == id). ) Le mardi 28 août 2012 12:00:14 UTC+2, parthi a écrit : Dear Thesalan , thanks to answer Thesalan right now i am working web services layout and widgets want to generate dynamically .so i tried android support JSON String json = {\EditText\ :{\id\:\edit\, \data\: \Click Here\, \size\: 200, \style\: \bold\, \name\: \text1\, \vOffset\: 100,\hOffset\: 250,\alignment\: \center\ })}; json object created this json object converted to string JSONObject jsonObj = null; { try { jsonObj = new JSONObject(json); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { JSONObject menu = jsonObj.getJSONObject(EditText); String id=menu.getString(id); String data =menu.getString(data); String size =menu.getString(size); String style =menu.getString(style); String vOffset =menu.getString(vOffset); String hOffset =menu.getString(hOffset); String alignment =menu.getString(alignment); String jsonresult = id: + id +data:+data+size:+size +style:+style+voffset:+vOffset+hoffset:+alignment:+alignment ; //MyView(jsonresult); } catch(Exception e){ e.printStackTrace(); } using this string want to pass one surfaceview i dont know how can i pass surfaceview strings surface view only draw method it will support only canvas so how can i pass string here ..pl reply On Tue, Aug 28, 2012 at 3:18 PM, Thesalan thes...@gmail.com javascript: wrote: Why do you want to use JSON? Android use XML, not JSON.. Le mardi 28 août 2012 11:42:07 UTC+2, parthi a écrit : how can i create dynamically widgets in android using json parser is it possible to create -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-d...@googlegroups.comjavascript: To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com javascript: 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: Listening multiple button
Yes of course! In the layout, you have just to specify the name of the function that you want to trigger in the attribute onClick of each buttons Le mardi 28 août 2012 14:27:34 UTC+2, Haris a écrit : Hai all.. For my application I am using several buttons... Is it possible to listen multiple button at the same time.. Thanks... -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Android devices and use of MM/INCH
For a project, I have to use real size, like millimeters and inches. But on some devices, these values are false! I have tested on some devices, and it appears that on HTC One X and HTC Wildfire, 10mm = 11/12mm... But on Nexus One, Nexus S, Galaxy S2 these sizes are right! To do this, I use this code : float pxCm = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_MM, 10, r.getDisplayMetrics()); Someone have already encounter this problem? If yes, how have you bypass 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
Re: [android-developers] ViewPager and setClipChildren(false)
Mark, a huge thank you!! I never thought the problem would come from hardware acceleration (I'm a beginner after all ^_^). Indeed, my current rom force hardware acceleration for all applications. I tried to force software mode just on the ViewPager with setLayerType(View.LAYER_TYPE_SOFTWARE, null) (see here : http://developer.android.com/guide/topics/graphics/hardware-accel.html) but it doesn't work : content stay inside the viewpager. But by specifying it in the manifest as you say it works very well! And given the application, it does not pose any problems to do without hardware acceleration. Again, thank you very much Mark! Le mardi 28 août 2012 23:09:38 UTC+2, Mark Murphy (a Commons Guy) a écrit : On Tue, Aug 28, 2012 at 8:54 AM, Thesalan thes...@gmail.com javascript: wrote: The project is attached to this post, at this lighter version (like we can found here https://gist.github.com/8cbe094bb7a783e37ad1) I repeat : this works greats on emulator and older devices, but not on my HTC One X with last OTA (Android 4.0.4) and Nexus S with CyanogenMod 10 (Android 4.1.1) I can reproduce your problem. It appears to be tied to hardware acceleration, insofar as if I add android:hardwareAccelerated=false to the activity, things work on hardware where it failed before (and also fails if I set the value explicity to true). Since the issues of clipping and hardware acceleration are beyond my area of expertise, I can't explain why this is the case. Rather than disable hardware acceleration for the whole activity, you could experiment with disabling it just for the ViewPager itself. And, of course, if we're lucky, somebody who understands more about this area will chime in and explain where things are going wrong. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 4.1 Available! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] ViewPager and setClipChildren(false)
Ok, thank you for the precision! Le mercredi 29 août 2012 00:05:24 UTC+2, Kostya Vasilyev a écrit : 2012/8/29 Thesalan thes...@gmail.com javascript: Mark, a huge thank you!! I never thought the problem would come from hardware acceleration (I'm a beginner after all ^_^). Indeed, my current rom force hardware acceleration for all applications. I tried to force software mode just on the ViewPager with setLayerType(View.LAYER_TYPE_SOFTWARE, null) (see here : http://developer.android.com/guide/topics/graphics/hardware-accel.html) but it doesn't work : content stay inside the viewpager. You can't force hardware accel off with setLayertType if it's already been set to enabled elsewhere (in the manifest, or I suppose in your ROM). Going the other way (software - GPU) is possible. -- K -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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] ViewPager and setClipChildren(false)
Ok thanks! But when I do it on the ViewPager, the clipping stay... I will try again tomorrow, it's late for me here ;) Thanks again! Le mercredi 29 août 2012 00:23:03 UTC+2, Romain Guy (Google) a écrit : Thesalan, it's incorrect. setLayeType(View.LAYER_TYPE_SOFTWARE, null) always works, no matter how or if hardware acceleration is enabled. On Tuesday, August 28, 2012 3:18:18 PM UTC-7, Thesalan wrote: Ok, thank you for the precision! Le mercredi 29 août 2012 00:05:24 UTC+2, Kostya Vasilyev a écrit : 2012/8/29 Thesalan thes...@gmail.com Mark, a huge thank you!! I never thought the problem would come from hardware acceleration (I'm a beginner after all ^_^). Indeed, my current rom force hardware acceleration for all applications. I tried to force software mode just on the ViewPager with setLayerType(View.LAYER_TYPE_SOFTWARE, null) (see here : http://developer.android.com/guide/topics/graphics/hardware-accel.html) but it doesn't work : content stay inside the viewpager. You can't force hardware accel off with setLayertType if it's already been set to enabled elsewhere (in the manifest, or I suppose in your ROM). Going the other way (software - GPU) is possible. -- K -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en