[android-beginners] Re: need help in getting screen coordinates of a view
Hi Romain Guy,, Thanks for the reply. I am very new to android.Could you please tell me an example of doing this??I am very new to android. Looking for your reponse. Thanks Kavitha On Mon, Mar 23, 2009 at 7:48 AM, Romain Guy romain...@google.com wrote: You can only do this after onCreate(), after all the views have been positioned. On Sun, Mar 22, 2009 at 10:03 AM, kavitha kavith...@gmail.com wrote: Hii All, I am developing a game in android and i want to capture screen coordinates of a view(ImageView) which is embedded in frame. Hierarchy is LinearLayout android android:layout_height=fill_parent android:layout_width=fill_parent RelativeLayout android:layout_height=fill_parent android:layout_width=fill_parent FrameLayout android:layout_height=wrap_content android:layout_width=wrap_content android:id=@+id/frame14/FrameLayout /RelativeLayout /LinearLayout At run time i am attaching two image views for frame layout.I wanted to capture screen coordinates of frame layout.But Couldnt do it.if i say (FrameLayout) f=(FrameLayout)findViewById(R.id.frame14); int[] loc = new int[2]; f.getLocationOnScreen(loc); System.out.println(loc[0]); System.out.println(loc[1]); I get Null Pointer Exception for getLocationOnScreen() method. If I try to get f.getLeft() and f.getRight() they return as 0 coordinates. Can anyone please tell me how to find location on screen of a view. It is very urgent.Please help. Thanks Kavitha -- 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 Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Please help in getting screen coordinates of a view
Hii All, I am developing a game in android and i want to capture screen coordinates of a view(ImageView) which is embedded in frame. Hierarchy is LinearLayout android android:layout_height=fill_parent android:layout_width=fill_parent RelativeLayout android:layout_height=fill_parent android:layout_width=fill_parent FrameLayout android:layout_height=wrap_content android:layout_width=wrap_content android:id=@+id/frame14/FrameLayout /RelativeLayout /LinearLayout At run time i am attaching two image views for frame layout.I wanted to capture screen coordinates of frame layout.But Couldnt do it.if i say (FrameLayout) f=(FrameLayout)findViewById(R.id.frame14); int[] loc = new int[2]; f.getLocationOnScreen(loc); System.out.println(loc[0]); System.out.println(loc[1]); I get Null Pointer Exception for getLocationOnScreen() method. If I try to get f.getLeft() and f.getRight() they return as 0 coordinates. Can anyone please tell me how to find location on screen of a view. I tried even in onStart() method,,,still i get Null Pointer Exception. Please tell me how to get screen coordinates of a view in android. It is very urgent.Please help. Thanks Kavitha --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Publishing Apps
Bump?! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: How do I set the value of an EditText
I get a NullPointer Exception when I use the Debug tool. So you're saying that I haven't successfully read the View probably? Ok...that's a great starting point. On Mar 21, 5:55 am, Tseng tseng.priv...@googlemail.com wrote: An error message would be helpful Otherwise it's hard to help you, other than guessing what could be the reasons for it. Maybe you haven't set the ID correctly, using a wrong ID (which doesn't even exist in the XML Layout file) or you're using setContentView/setView after you have using findViewById. This could throw up a NullPointer Exception when you try to access (because findViewById returns 0 if no layout has been set or the View with this ID was not found). On Mar 20, 9:00 pm, Lovedumplingx lovedumpli...@gmail.com wrote: That's what I thought too but I crash the task every time the activity that contains this code is started: EditTextuserText = (EditText) findViewById(R.id.userText); userText.setText(userParam); This is the basic way I thought to have the value set but it crashes every time. On Mar 19, 10:53 pm, Isaac Waller ad...@isaacwaller.com wrote: A String _is_ a CharSequence. There is no need for a cast. On Mar 19, 3:35 pm, Will sem...@gmail.com wrote: Cast the String to a CharSequence. String x = foo; EditTextET; ET.setText((CharSequence) x); On Mar 19, 10:43 am, Lovedumplingx lovedumpli...@gmail.com wrote: Ok...so I've scoured and scoured and played and fiddled but I can't figure it out. I want to allow the user to set preferences for an application and I want the preferences to be displayed in theEditTextarea if/when they come back to change them again. In my head I'm thinking I would be able to use setText() but no...that takes a CharSequence and I have a string and don't know how to make a CharSequence (which according to what I've read is supposed to be a read-only thing anyway). So...does anyone know how to put text into anEditTextfield without relying on the XML? I really want to do this via application preferences. Thanks.- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Publishing Apps
You can't. You can only publish a paid app from US or UK. Just to clarify, not FOR US and UK markets but only from US and UK developers. Ivan Soto Fernandez Web Developer http://ivansotof.com On Mon, Mar 23, 2009 at 5:11 AM, Scrubs nov...@gmail.com wrote: Bump?! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Publishing Apps
I live outside the USA, but my account is registered to an address and bank account in the USA. I'm hoping I can publish for both the US and UK markets. Otherwise, I'll have no choice but to have family stateside go through all the work of uploading apps. On Mon, Mar 23, 2009 at 11:09 PM, Ivan Soto ivanso...@gmail.com wrote: You can't. You can only publish a paid app from US or UK. Just to clarify, not FOR US and UK markets but only from US and UK developers. Ivan Soto Fernandez Web Developer http://ivansotof.com On Mon, Mar 23, 2009 at 5:11 AM, Scrubs nov...@gmail.com wrote: Bump?! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Does any one know how to put pkcs11.so into Android ?
Hi, Does any one know how to put pkcs11.so into Android ? Best regards. mli --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Bluetooth
Hi, I am interested in building an application with bluetooth support. I read that the new android SDK supports bluetooth, but I can't find the API. It is possible to work with the bluetooth with the latest SDK? Or I need to do something else, or it is just not possible? regards --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] HelloGallery tutorial: android.R.styleable cannot be resolved
Hello, I've been following the Views tutorials included in the android developer site: http://developer.android.com/guide/t...o-gallery.html When testing the Hello Gallery view, I get the compile-time error: android.R.styleable cannot be resolved I searched for this error on this group but is wasn't answered. Can anyone help? The problem reference occurs in the imageAdapter class that is appended after the onCreate() method in the HelloGallery class: public class ImageAdapter extends BaseAdapter { ... TypedArray a = obtainStyledAttributes(android.R.styleable.Theme); } Strangely enough, when I insert this line into the onCreate() method at the start of the package, there is no problem. It seems that the android.R class is not known to this class. Thanks, Paul --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] XML Dom parser throws error input source needs either stream or reader
Hello I am new to android development, right now i am doing a simple project that receive data from XML and display on screen. for retrieving data from XMl file I have used Dom parser but at run time it will throw an error. The SAX Exceptioninput source needs either stream or reader Document dom; DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); dom = db.parse(assets/myfile.xml); This code is working fine with out side android or other java project. I have tried for File f = new File (assets/myfile.xml); InputStream str = f.toURL().openStream(); dom = db.parse(str); and same for by using reader. but sill i got same kind of error, Please tell me what is correct way to use Stream or Reader. Thanks in advance :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Trouble with HelloWorld
I am having trouble with the hello world application. My emulator starts and ultimately gets to a screen with that says android and shows the android logo. I never get to the hello world or phone startup screens. The last message I see in Eclipse is: Waiting for HOME ('android.process.acore') to be launched... I have read the other posts that say that the problem is a mix of versions. I have two computers, one running Vista, the other running XP. I have: 0.8.0 Android 3.4.2 Eclipse 6.0.120.4 JRE One post said that I needed 1.0 of the Android ADT. If so, where is that? When I look at the google site, it looks like 0.8 is the most recent version. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Questions (Google IM, Latitude and other services)
Hi there, I have a couple of questions. First of all, will the Google IM API be opened? I mean, will it be possible to provide other clients (protocols) that would fit into the framework of the IM application? I know that the non-developer version of the phone ships with other protocols (that use SMS-messages). Is third party access to the API being blocked from a commercial point of view? Perhaps even because of pressure by T-Mobile? If it were the case, I'd understand, I'd just like to know what we can expect. Second, why isn't Latitude using the XMPP specification (draft)? See for instance http://xmpp.org/extensions/xep-0080.html. While Google started out nicely by using XMPP for Google Talk, making it possible for third party clients to easily integrate with the service, the lack of adhering to open (even proposed) standards is a bit worrying. And third, why is Latitude built into the Maps application? To me it seems to be an unlikely choice. It seems to make a lot more sense to integrate all of the Latitude features into the IM application. That way it could even be possible to use the information that Latitude provides with the other protocols (see the first question ;-)). Thanks. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: separating the decimal from the whole?
here's a slower but sometimes more precise way, e.g., if you're dealing with currency: double d = 124.50d; BigDecimal ii = new BigDecimal(+d); Log.d(whole and decimal,BigDecimal ii = +ii+ = new BigDecimal (\\+d); d = +d); Log.d(whole and decimal,whole = ii.intValue() = +ii.intValue ()); Log.d(whole and decimal,decimal = ii.remainder(BigDecimal.ONE) = +ii.remainder(BigDecimal.ONE)); extracts from the log: BigDecimal ii = 124.5 = new BigDecimal(+d); d = 124.5 whole = ii.intValue() = 124 decimal = ii.remainder(BigDecimal.ONE) = 0.5 sm1 On Mar 23, 3:28 pm, droozen droozenr...@gmail.com wrote: I'm a bit confused about your question. You ask a question and then pretty much answer it. :) There's other ways, as you say, but that's pretty much how you do it in java, too. x = 124.5 y = x - int(x) (so now y = 0.5 and x = 124.5) z = x - y (so z = 124.0 a = y * 3 ( a now = 1.5 ) b = z + a ( here's you're only error. 124 + 1.5 will give you b = 125.5, unless you are casting it to an int) Some other ways. String myX = Double.toString(x); (gives you x as a string) String s = myX.substring(myX.indexOf(.) + 1) (s = everything after the .) String r = myX.substring(0, myX.indexOf(.) (r = everything before the .) a = Double.parseDouble(s) * 3 (Turn everything after the . back into a double and multiply) b = Double.parseDouble(r) + a (And turn everything before the . back into a number and finish your calc Of course, using string manipulation like this you'll have to have a lot more checks for nulls and whatnot (what if there is no decimal part, converting it to a string might not yield a . in the string). Best way is as you posted, though. On Mar 20, 10:36 pm, Jintsubo jints...@gmail.com wrote: So I having a good crack at my first Android app, I've completed all the tutorials and suddenly realised I haven't a clue about how to do simple mathematics in Java. I have some (self taught) experience in PHP, Python etc, I'm no expert but I have managed to get the things done that I want to do. What I can do in Python but can't for the life of me figure out in javndroid; how to separate the decimal from the whole. for example, 124.50. I want to do some calcs using only the 0.50 and then when I'm finished, add it back onto the 124.0. x = 124.50 y = x - int(x) (there are other ways but for simplicity sake)... y = 0.50 z = x - y = 124.0 a = y * 3 = 1.5 b = z + a = 125.0 Any pointers greatly appreciated. JR --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---