[android-developers] Re: SDK and ADT r15
Hello, I'm getting the following error: Failed to rename directory D:\android-sdk-windows\tools to D:\android- sdk-windows\temp\ToolPackage.old02. when tring to update the Android SDK Tools, revision 15. I'm using Windows 7 with Eclipse Indigo. the Eclipse plug in update seems to be installed fine. does anyone know how to solve this problem? On Oct 28, 8:19 am, abangkis abang...@gmail.com wrote: I don't know if that confuses my eclipse installation or not, there's always a possibility, it just my wild guess :) Because i need the ADT environment badly. My work around is to extract a clean eclipse installation. Create new workspace. Download ADT r15. And point it to my previous SDKr15 installation. So far it works. Now I'm running on r15. Cheers. On Fri, Oct 28, 2011 at 11:55 AM, Zsolt Vasvari zvasv...@gmail.com wrote: There would be no android-15 folder. The 14 there refers to the API level, while the 14 in the ADT is just a release count, in essence. They are not related and, I assume, it was a coincidence that they were both 14 for the ICS release. On Oct 28, 11:51 am, abangkis abang...@gmail.com wrote: I'm using Windows 7 Ultimate and Eclipse Indigo. I upgraded both SDK platform and ADT from r14. Restarted eclipse and now I can't open the Debug and DDMS perspective. The SDK and AVD launcher is also missing from the toolbar. I check to the SDK installation folder/android-sdk/platform and I only see android-7, android-8, android-14. No android-15 folder. Does anyone else have the same problem as me ? On Fri, Oct 28, 2011 at 9:20 AM, Zsolt Vasvari zvasv...@gmail.com wrote: Weird issue: - Updated the Eclipse Plug-In (Windows Vista) - Exited Eclipse as I like to do the SDK component updates while they are not loaded - Started the SDK Manager - I see the Android SDK Tools item showing as Rev 14 and the for a second it says Update available: Rev 15 then it goes back to Rev 14 Installed won't let me update Now, if I go back to Eclipse and do the same thing, the Update available sticks. I still got some problems with the check boxes: - If I have Updates/New and Installed checked - I check Android SDK Tools to be installed - Uncheck Installed (only have Updates/New checked), I would expect the Android SDK Tools to be in the shorter list as it's an available update. But it's missing. On Oct 28, 6:42 am, Xavier Ducrohet x...@android.com wrote: Hey all, we've just release SDK Tools r15 and a matching ADT 15.0 This is a bug fix only release. See notes athttp:// developer.android.com/sdk/tools-notes.html andhttp://developer.android.com/sdk/eclipse-adt.html Make sure to get the new platform-tools as well. Xav -- Xavier Ducrohet Android SDK Tech Lead Google Inc.http://developer.android.com|http://tools.android.com Please do not send me questions directly. Thanks! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email toandroid-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 --http://www.mreunionlabs.net/http://www.mreunion-labs.net/ twitter : @mreunionlabs blog : mreunion.wordpress.com- 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 toandroid-develop...@googlegroups.com To unsubscribe from this group, send email toandroid-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --http://www.mreunionlabs.net/http://www.mreunion-labs.net/ twitter : @mreunionlabs blog : mreunion.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: SDK and ADT r15
I found a fix. I I open the SDK from the Eclipse it works. On Oct 30, 12:32 pm, ayanir ayanir...@gmail.com wrote: Hello, I'm getting the following error: Failed to rename directory D:\android-sdk-windows\toolsto D:\android-sdk-windows\temp\ToolPackage.old02. when tring to update the AndroidSDKTools,revision15. I'm using Windows 7 with Eclipse Indigo. the Eclipse plug in update seems to be installed fine. does anyone know how to solve this problem? On Oct 28, 8:19 am, abangkis abang...@gmail.com wrote: I don't know if that confuses my eclipse installation or not, there's always a possibility, it just my wild guess :) Because i need the ADT environment badly. My work around is to extract a clean eclipse installation. Create new workspace. Download ADT r15. And point it to my previous SDKr15 installation. So far it works. Now I'm running on r15. Cheers. On Fri, Oct 28, 2011 at 11:55 AM, Zsolt Vasvari zvasv...@gmail.com wrote: There would be no android-15folder. The 14 there refers to the API level, while the 14 in the ADT is just a release count, in essence. They are not related and, I assume, it was a coincidence that they were both 14 for the ICS release. On Oct 28, 11:51 am, abangkis abang...@gmail.com wrote: I'm using Windows 7 Ultimate and Eclipse Indigo. I upgraded bothSDK platform and ADT from r14. Restarted eclipse and now I can't open the Debug and DDMS perspective. The SDKand AVD launcher is also missing from the toolbar. I check to theSDKinstallation folder/android-sdk/platform and I only see android-7, android-8, android-14. No android-15folder. Does anyone else have the same problem as me ? On Fri, Oct 28, 2011 at 9:20 AM, Zsolt Vasvari zvasv...@gmail.com wrote: Weird issue: - Updated the Eclipse Plug-In (Windows Vista) - Exited Eclipse as I like to do theSDKcomponent updates while they are not loaded - Started theSDKManager - I see the AndroidSDKTools item showing as Rev 14 and the for a second it says Update available: Rev15 then it goes back to Rev 14 Installed won't let me update Now, if I go back to Eclipse and do the same thing, the Update available sticks. I still got some problems with the check boxes: - If I have Updates/New and Installed checked - I check AndroidSDKTools to be installed - Uncheck Installed (only have Updates/New checked), I would expect the AndroidSDKToolsto be in the shorter list as it's an available update. But it's missing. On Oct 28, 6:42 am, Xavier Ducrohet x...@android.com wrote: Hey all, we've just releaseSDKToolsr15 and a matching ADT 15.0 This is a bug fix only release. See notes athttp:// developer.android.com/sdk/tools-notes.html andhttp://developer.android.com/sdk/eclipse-adt.html Make sure to get the new platform-toolsas well. Xav -- Xavier Ducrohet AndroidSDKTech Lead Google Inc.http://developer.android.com|http://tools.android.com Please do not send me questions directly. Thanks! -- You received this message because you are subscribed to the Google Groups Android Developers group.To post to this group, send email toandroid-developers@googlegroups.comTo 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 --http://www.mreunionlabs.net/http://www.mreunion-labs.net/ twitter : @mreunionlabs blog : mreunion.wordpress.com- 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 emailtoandroid-develop...@googlegroups.com To unsubscribe from this group, send email toandroid-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --http://www.mreunionlabs.net/http://www.mreunion-labs.net/ twitter : @mreunionlabs blog : mreunion.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] EditText layer on SurfaceView gets invisible problem
Hello, I have the following problem: my layout includes SurfaceView (custom view with com.components.game.MyGameView) and a RelativeLayout which includes EditText view: ?xml version=1.0 encoding=utf-8? RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android; android:layout_width=fill_parent android:layout_height=fill_parent com.components.game.MyGameView android:id=@+id/game_id android:layout_width=fill_parent android:layout_height=fill_parent / RelativeLayout android:id=@+id/TextLayout android:layout_width=fill_parent android:layout_height=wrap_content android:visibility=invisible android:layout_alignParentBottom=true Button android:id=@+id/TextOkButton android:layout_width=wrap_content android:layout_height=wrap_content android:text=OK android:layout_alignParentRight=true /Button EditText android:id=@+id/TextEditText android:layout_width=wrap_content android:layout_height=wrap_content android:singleLine=true android:maxLength=80 android:layout_toLeftOf=@+id/TextOkButton android:focusable=true android:focusableInTouchMode=true /EditText /RelativeLayout /RelativeLayout I want to be able to turn TextLayout visibility ON from the screen onTouch. I do get an event and I use Handler to call: findViewById(R.id.TextLayout).setVisibility(VISIBLE) the problem is that the TextLayout is NOT being shown (stays INVISIBLE) but it does get an event when pressing on the area of the EditText - it functions like it VISIBLE while staying INVISIBLE. this problem only happens on SDK 2.3 and upper. anyone has an idea how to solve this? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: How to share data between applications with no dependency
Dianne, it will be great if I can use any other way as long it will: 1. be accessible for both apps no mater which of them installed first 2. will survive uninstall Adam, I can't use cloud because of security reasons: the first app being installed saves kind of a login details for both of the apps. The only way I can use cloud was if a device could have unique identification but you can't achieve that on Android :( Also, both apps can change that data and I want to keep a single instance of it without a copy. ayanir On Sep 20, 12:10 am, Adam Hammer adamhamm...@gmail.com wrote: You could use network/cloud storage for this instead of SD. Depending on how much data you are talking it's a feasible alternative. Adam On Sep 19, 5:12 am, ayanir ayanir...@gmail.com wrote: Hello, I want to share data between 2 applications. the idea is both applications can write and read the SAME data and there is no dependency which one of the apps is installed or first created the data. I have 2 version of the same app: regular and premium and I don't know which of them will be first installed and both of them can change it. I tried to use ContentProvider but the problem is that only the first app can create the Provider and when it is uninstalled it deletes that custom Provider. I want the Content to be kept for the second app. Also, I tried to use Settings.System which keeps the data regardless if the application is installed or not but I don't want to use the permission for that (it is very problematic from user perspective). BTW, it seems that I can change ANY of the Settings.System which is not secured from Android OS perspective - but this is a subject for other post. I see only one left choice using a File for that but, I wanted to know if I can use another way? Thanks, ayanir -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: How to share data between applications with no dependency
Dianne, it will be great if I can use any other way as long it will: 1. be accessible for both apps no mater which of them installed first 2. will survive uninstall Adam, I can't use cloud because of security reasons: the first app being installed saves kind of a login details for both of the apps. The only way I can use cloud was if a device could have unique identification but you can't achieve that on Android :( Also, both apps can change that data and I want to keep a single instance of it without a copy. ayanir On Sep 20, 12:10 am, Adam Hammer adamhamm...@gmail.com wrote: You could use network/cloud storage for this instead of SD. Depending on how much data you are talking it's a feasible alternative. Adam On Sep 19, 5:12 am, ayanir ayanir...@gmail.com wrote: Hello, I want to share data between 2 applications. the idea is both applications can write and read the SAME data and there is no dependency which one of the apps is installed or first created the data. I have 2 version of the same app: regular and premium and I don't know which of them will be first installed and both of them can change it. I tried to use ContentProvider but the problem is that only the first app can create the Provider and when it is uninstalled it deletes that custom Provider. I want the Content to be kept for the second app. Also, I tried to use Settings.System which keeps the data regardless if the application is installed or not but I don't want to use the permission for that (it is very problematic from user perspective). BTW, it seems that I can change ANY of the Settings.System which is not secured from Android OS perspective - but this is a subject for other post. I see only one left choice using a File for that but, I wanted to know if I can use another way? Thanks, ayanir -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: How to share data between applications with no dependency
Dianne, it will be great if I can use any other way as long it will: 1. be accessible for both apps no mater which of them installed first 2. will survive uninstall Adam, I can't use cloud because of security reasons: the first app being installed saves kind of a login details for both of the apps. The only way I can use cloud was if a device could have unique identification but you can't achieve that on Android :( Also, both apps can change that data and I want to keep a single instance of it without a copy. ayanir On Sep 20, 12:10 am, Adam Hammer adamhamm...@gmail.com wrote: You could use network/cloud storage for this instead of SD. Depending on how much data you are talking it's a feasible alternative. Adam On Sep 19, 5:12 am, ayanir ayanir...@gmail.com wrote: Hello, I want to share data between 2 applications. the idea is both applications can write and read the SAME data and there is no dependency which one of the apps is installed or first created the data. I have 2 version of the same app: regular and premium and I don't know which of them will be first installed and both of them can change it. I tried to use ContentProvider but the problem is that only the first app can create the Provider and when it is uninstalled it deletes that custom Provider. I want the Content to be kept for the second app. Also, I tried to use Settings.System which keeps the data regardless if the application is installed or not but I don't want to use the permission for that (it is very problematic from user perspective). BTW, it seems that I can change ANY of the Settings.System which is not secured from Android OS perspective - but this is a subject for other post. I see only one left choice using a File for that but, I wanted to know if I can use another way? Thanks, ayanir -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] How to share data between applications with no dependency
Hello, I want to share data between 2 applications. the idea is both applications can write and read the SAME data and there is no dependency which one of the apps is installed or first created the data. I have 2 version of the same app: regular and premium and I don't know which of them will be first installed and both of them can change it. I tried to use ContentProvider but the problem is that only the first app can create the Provider and when it is uninstalled it deletes that custom Provider. I want the Content to be kept for the second app. Also, I tried to use Settings.System which keeps the data regardless if the application is installed or not but I don't want to use the permission for that (it is very problematic from user perspective). BTW, it seems that I can change ANY of the Settings.System which is not secured from Android OS perspective - but this is a subject for other post. I see only one left choice using a File for that but, I wanted to know if I can use another way? Thanks, ayanir -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: How to share data between applications with no dependency
Thank you Mark. I'll go with the file on external storage. I think that there should be a general system ContentProvider for that exact purpose - I could only hope it will be one day... Prakash - you solution of installing a third app which contains the ContentProvider is not really an option for me but thanks. could you please refer me to an example how to create/read a file using the external storage? thanks' ayanir On Sep 19, 4:09 pm, DanH danhi...@ieee.org wrote: Can an application not place images or music in directories on the device, and have those files persist beyond the persistence of the app? On Sep 19, 7:23 am, Mark Murphy mmur...@commonsware.com wrote: On Sun, Sep 19, 2010 at 8:12 AM, ayanir ayanir...@gmail.com wrote: I want to share data between 2 applications. the idea is both applications can write and read the SAME data and there is no dependency which one of the apps is installed or first created the data. I have 2 version of the same app: regular and premium and I don't know which of them will be first installed and both of them can change it. That will be difficult. I tried to use ContentProvider but the problem is that only the first app can create the Provider and when it is uninstalled it deletes that custom Provider. Correct. I want the Content to be kept for the second app. That is only possible if you store it on external storage. Also, I tried to use Settings.System which keeps the data regardless if the application is installed or not but I don't want to use the permission for that (it is very problematic from user perspective). I have no idea what you are talking about. BTW, it seems that I can change ANY of the Settings.System which is not secured from Android OS perspective - but this is a subject for other post. Correct. The secure ones are in Settings.Secure. I see only one left choice using a File for that but, I wanted to know if I can use another way? A file on external storage is the only thing that survives an uninstall and is reachable by two applications. -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy Android Training in London:http://skillsmatter.com/go/os-mobile-server -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: How to share data between applications with no dependency
Thanks, it worked like a charm. On Sep 19, 4:39 pm, Mark Murphy mmur...@commonsware.com wrote: On Sun, Sep 19, 2010 at 10:32 AM, ayanir ayanir...@gmail.com wrote: I think that there should be a general system ContentProvider for that exact purpose - I could only hope it will be one day... I rather doubt that will happen, at least in terms of the core OS. Android is very determined to avoid applications leaving crap behind, even if, in your case, that crap is intentional. could you please refer me to an example how to create/read a file using the external storage? Add the WRITE_EXTERNAL_STORAGE permission to your app. Use Environment.getExternalStorageDirectory() to get the path to external storage. From there, it is standard Java I/O to read and write files. Use Environment.getExternalStorageState() and the ACTION_MEDIA_ broadcast Intents to monitor when external storage is available. Note that, since the user can mount external storage on a host computer, external storage is not available 100% of the time. -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy Android Training in London:http://skillsmatter.com/go/os-mobile-server -- 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] Like implementation with Facebook github SDK
Hello, I’m using the Facebook SDK from github. Does anyone know how to implement a “Like” button using the SDK? Is there a way to invoke “Like” method same as “me” using the Graph API? If it does, it should be very simple to use the SDK. There is an alternative implementation found in: http://github.com/facebook/facebook-android-sdk/issues#issue/17 but it doesn’t use the SDK. Thanks ayanir -- 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: Socket freezes using GSM connection
Kostya, I've changed the reading as you suggested and I haven't found any significant improvement although I do think that you proposal is a better programing to avoid problems like connection problem which cause missing packets. I didn't understand if your implementation with NIO give you better notification when there is a problem with the socket connection. my problem is that the socket thinks that it is connected and no exception being thrown even if it was disconnected due to poor network signal. how can I detect this on time and open a fresh one? I'm still trying to figure out how can I use Broadcast intents for the data connection state - maybe this will help. On Jun 1, 5:51 pm, Kostya Vasilyev kmans...@gmail.com wrote: Ayanir, NIO is non-blocking, so it's easier to serve multiple connections from one thread. Also, NIO is easier to interrupt / shutdown, which I think is important for an Android app. But other than that, I personally think it's a matter of taste, since there has to be a worker thread for both NIO and old style. In the code you posted, DataOutputStream should write the entire data structure, blocking until it does. So with the change on the reading side (looking for '\0' anywhere) it _should_ already work - have you tested it yet? -- Kostya 01.06.2010 17:53, ayanir пишет: is the NIO works better then the usual Socket? by works better I mean no freezing. I have no problem working with NIO if it will make the difference. ayanir On Jun 1, 10:55 am, Kostya Vasilyevkmans...@gmail.com wrote: Ah, so those are data streams. Sorry I missed that (using NIO socket channels here :) Then you should be ok with packet fragmentation - as long as your read method checks for '\0' anywhere within the buffer. -- Kostya 01.06.2010 11:43, ayanir пишет: Kostya, I did as you suggested and I'm now looking for the delimiter ('\0') on the of the last read buffer and not just the last byte. I didn't understand how can I check the return value in the write() method since it is declared as void. is there another way? -- Kostya Vasilev -- WiFi Manager + pretty widget --http://kmansoft.wordpress.com -- Kostya Vasilev -- 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: Socket freezes using GSM connection
Thanks for your replays. Kostya, I did as you suggested and I'm now looking for the delimiter ('\0') on the of the last read buffer and not just the last byte. I didn't understand how can I check the return value in the write() method since it is declared as void. is there another way? Mark, I'll check the broadcast Intents. can you refer me to an example? Thanks ayanir On May 29, 5:47 pm, Kostya Vasilyev kmans...@gmail.com wrote: Ayanir, Your code seems to make assumptions about network data exchange that don't necessarily hold true for GSM connection, such as: - write() always sending the entire data buffer, this may not be the case. It's necessary to check the return value to see how much was actually sent. - read() receiving data broken down by the same chunks as were sent. The check for '\0' needs to be changed to look for it anywhere in the buffer, breaking it down into application-specific packets. -- Kostya 29.05.2010 17:24, ayanir пишет: anyone? On May 27, 5:31 pm, ayanirayanir...@gmail.com wrote: Hello, I’m working on application that uses a socket connection. I’ve implemented 2 different Threads for the read() and the write() methods so they are not being blocked by the read. Everything is working well on the WiFi connection but when I switch to GSM connection the connection becomes unstable without any exception being thrown. It means that there are freezes – the write and read seems to work but no data is actually being piped. Here is what I’m doing: private Socket socketConn = null; private DataInputStream dis = null; private DataOutputStream dos = null; //Read buffer private byte[] buffer; ByteArrayOutputStream readBuffer; private String serverAddress; private int serverPort; public void openConnection(int timeout) throws Exception { if(socketConn != null){ return; } //if we need to resolve the host - if succeed we replace the default otherwise we use the default. //the check is done only once. if(checkHostResolved){ checkHostResolved = false; try{ InetAddress ia = InetAddress.getByName(serverHostAddress); serverAddress = ia.getHostAddress(); } catch(UnknownHostException e2){ MyLog.printException(this, e2, run()InetAddress.getByName); } } socketConn = new Socket(); InetSocketAddress isa = new InetSocketAddress(serverAddress, serverPort); socketConn.connect(isa, timeout); socketConn.setKeepAlive(true); socketConn.setTcpNoDelay(true); socketConn.setSoLinger(true, 1000); dis = new DataInputStream(socketConn.getInputStream()); dos = new DataOutputStream(socketConn.getOutputStream()); } public void closeConnection() { if(socketConn != null){ try{ if(dis != null){ socketConn.shutdownInput(); dis.close(); } if(dos != null){ socketConn.shutdownOutput(); dos.close(); } if(socketConn != null){ socketConn.close(); } if(readBuffer != null){ readBuffer.reset(); } } catch(IOException ioe){ MyLog.printException(this, ioe, Problem Closing connection); } finally{ dis = null; dos = null; socketConn = null; } } MyLog.printLog(this, closeConnection end); } private int trySend(String message) { try{ byte[] data = message.getBytes(); dos.write(data); dos.flush(); return 0; } catch(SocketException se){ MyLog.printException(this, se, Problem with trySend); } catch(Exception e){ MyLog.printException(this, e, trySend()); } MyLog.printLog(this, trySend() Problem with trySend); return ERROR_CODE_CONNECTION; } private boolean tryRead() { try{ int b = 0; while((b = dis.read(buffer)) 0){ readBuffer.write(buffer, 0, b); //if the last read byte is '\0' then we have complete reading at least 1
[android-developers] Re: Socket freezes using GSM connection
is the NIO works better then the usual Socket? by works better I mean no freezing. I have no problem working with NIO if it will make the difference. ayanir On Jun 1, 10:55 am, Kostya Vasilyev kmans...@gmail.com wrote: Ah, so those are data streams. Sorry I missed that (using NIO socket channels here :) Then you should be ok with packet fragmentation - as long as your read method checks for '\0' anywhere within the buffer. -- Kostya 01.06.2010 11:43, ayanir пишет: Kostya, I did as you suggested and I'm now looking for the delimiter ('\0') on the of the last read buffer and not just the last byte. I didn't understand how can I check the return value in the write() method since it is declared as void. is there another way? -- Kostya Vasilev -- 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: Socket freezes using GSM connection
anyone? On May 27, 5:31 pm, ayanir ayanir...@gmail.com wrote: Hello, I’m working on application that uses a socket connection. I’ve implemented 2 different Threads for the read() and the write() methods so they are not being blocked by the read. Everything is working well on the WiFi connection but when I switch to GSM connection the connection becomes unstable without any exception being thrown. It means that there are freezes – the write and read seems to work but no data is actually being piped. Here is what I’m doing: private Socket socketConn = null; private DataInputStream dis = null; private DataOutputStream dos = null; //Read buffer private byte[] buffer; ByteArrayOutputStream readBuffer; private String serverAddress; private int serverPort; public void openConnection(int timeout) throws Exception { if(socketConn != null){ return; } //if we need to resolve the host - if succeed we replace the default otherwise we use the default. //the check is done only once. if(checkHostResolved){ checkHostResolved = false; try{ InetAddress ia = InetAddress.getByName(serverHostAddress); serverAddress = ia.getHostAddress(); } catch(UnknownHostException e2){ MyLog.printException(this, e2, run()InetAddress.getByName); } } socketConn = new Socket(); InetSocketAddress isa = new InetSocketAddress(serverAddress, serverPort); socketConn.connect(isa, timeout); socketConn.setKeepAlive(true); socketConn.setTcpNoDelay(true); socketConn.setSoLinger(true, 1000); dis = new DataInputStream(socketConn.getInputStream()); dos = new DataOutputStream(socketConn.getOutputStream()); } public void closeConnection() { if(socketConn != null){ try{ if(dis != null){ socketConn.shutdownInput(); dis.close(); } if(dos != null){ socketConn.shutdownOutput(); dos.close(); } if(socketConn != null){ socketConn.close(); } if(readBuffer != null){ readBuffer.reset(); } } catch(IOException ioe){ MyLog.printException(this, ioe, Problem Closing connection); } finally{ dis = null; dos = null; socketConn = null; } } MyLog.printLog(this, closeConnection end); } private int trySend(String message) { try{ byte[] data = message.getBytes(); dos.write(data); dos.flush(); return 0; } catch(SocketException se){ MyLog.printException(this, se, Problem with trySend); } catch(Exception e){ MyLog.printException(this, e, trySend()); } MyLog.printLog(this, trySend() Problem with trySend); return ERROR_CODE_CONNECTION; } private boolean tryRead() { try{ int b = 0; while((b = dis.read(buffer)) 0){ readBuffer.write(buffer, 0, b); //if the last read byte is '\0' then we have complete reading at least 1 packet of data if(buffer[b - 1] == '\0'){ byte[] data = readBuffer.toByteArray(); MyLog.printLog(this, read data.length= + data.length); readBuffer.reset(); String text = new String(data, utf-8); return true; } MyLog.printLog(this, out while read b= + b); //if the b0 then EOF has reached if(b 0){ throw new Exception(EOF has reached); } } } catch(Exception e){ } return false; } Does anyone encounter connection stability problems? Do I need to open the connection differently? How about using SocketChannel is it more reliable? Does Socket connection is a good approach when talking about mobile network connection? Thanks ayanir -- You received this message because you are subscribed to the Google Groups Android Developers group. To post
[android-developers] how can I get the Google account or Gmail address from the phone
Hello, I was looking for this info all over and still haven't found an answer. Is there a way to get the Google account or the Gmail address (no password) which have been signed to the device. the closest thing I saw is using AccountManager and Acount but this is only for Android class 5 or higher and I'm developing for class 3. from my understanding this is for online services which I do not need - I'm only want the Gmail address. Thanks ayanir -- 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] Socket freezes using GSM connection
Hello, I’m working on application that uses a socket connection. I’ve implemented 2 different Threads for the read() and the write() methods so they are not being blocked by the read. Everything is working well on the WiFi connection but when I switch to GSM connection the connection becomes unstable without any exception being thrown. It means that there are freezes – the write and read seems to work but no data is actually being piped. Here is what I’m doing: private Socket socketConn = null; private DataInputStream dis = null; private DataOutputStream dos = null; //Read buffer private byte[] buffer; ByteArrayOutputStream readBuffer; private String serverAddress; private int serverPort; public void openConnection(int timeout) throws Exception { if(socketConn != null){ return; } //if we need to resolve the host - if succeed we replace the default otherwise we use the default. //the check is done only once. if(checkHostResolved){ checkHostResolved = false; try{ InetAddress ia = InetAddress.getByName(serverHostAddress); serverAddress = ia.getHostAddress(); } catch(UnknownHostException e2){ MyLog.printException(this, e2, run()InetAddress.getByName); } } socketConn = new Socket(); InetSocketAddress isa = new InetSocketAddress(serverAddress, serverPort); socketConn.connect(isa, timeout); socketConn.setKeepAlive(true); socketConn.setTcpNoDelay(true); socketConn.setSoLinger(true, 1000); dis = new DataInputStream(socketConn.getInputStream()); dos = new DataOutputStream(socketConn.getOutputStream()); } public void closeConnection() { if(socketConn != null){ try{ if(dis != null){ socketConn.shutdownInput(); dis.close(); } if(dos != null){ socketConn.shutdownOutput(); dos.close(); } if(socketConn != null){ socketConn.close(); } if(readBuffer != null){ readBuffer.reset(); } } catch(IOException ioe){ MyLog.printException(this, ioe, Problem Closing connection); } finally{ dis = null; dos = null; socketConn = null; } } MyLog.printLog(this, closeConnection end); } private int trySend(String message) { try{ byte[] data = message.getBytes(); dos.write(data); dos.flush(); return 0; } catch(SocketException se){ MyLog.printException(this, se, Problem with trySend); } catch(Exception e){ MyLog.printException(this, e, trySend()); } MyLog.printLog(this, trySend() Problem with trySend); return ERROR_CODE_CONNECTION; } private boolean tryRead() { try{ int b = 0; while((b = dis.read(buffer)) 0){ readBuffer.write(buffer, 0, b); //if the last read byte is '\0' then we have complete reading at least 1 packet of data if(buffer[b - 1] == '\0'){ byte[] data = readBuffer.toByteArray(); MyLog.printLog(this, read data.length= + data.length); readBuffer.reset(); String text = new String(data, utf-8); return true; } MyLog.printLog(this, out while read b= + b); //if the b0 then EOF has reached if(b 0){ throw new Exception(EOF has reached); } } } catch(Exception e){ } return false; } Does anyone encounter connection stability problems? Do I need to open the connection differently? How about using SocketChannel is it more reliable? Does Socket connection is a good approach when talking about mobile network connection? Thanks ayanir -- 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
[android-developers] Re: how can I get the Google account or Gmail address from the phone
I think I found it. the original post is from: http://groups.google.com/group/android-developers/browse_thread/thread/7a6bf77910ca31e0/7a7659d61a89fa41?lnk=gstq=how+can+I+get+the+Google+account+or+Gmail+address+from+the+phone#7a7659d61a89fa41 1. download the framework.jar from: http://github.com/android/platform_frameworks_opt_com.google.android/blob/7e12826d58454d3bade238e3b2c43fe402278f19/framework.jar and add it to you build path. this is some sort of an interface to the Google device functions. 2. call the method: com.google.android.googlelogin.GoogleLoginServiceHelper.getAccount(Activity activity, int requestCode, boolean requireGoogle); where: Activity: is your Activity which get the result in the onActivityResult() requestCode: your code requireGoogle: should be true EX. GoogleLoginServiceHelper.getAccount(mActivity, 123, true); 3. override the onActivityResult() like: protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if(requestCode == 123){ System.out.println(resultCode); String key = accounts; System.out.println(key + : + Arrays.toString(data.getExtras().getStringArray(key))); String accounts[] = data.getExtras().getStringArray(key); if(accounts != null){ int i = 0; for(String ac : accounts){ //each account is the full email address registered with this device System.out.println(ac + i + = + ac); i++; } } } 4. add in the AndroidManifest.xml the following permition: uses-permission android:name=com.google.android.googleapps.permission.GOOGLE_AUTH/ uses-permission 5. your done! enjoy On May 27, 10:52 am, Jose Luis Montes jlmont...@gmail.com wrote: I was looking for this issue too. The diference is that i need to get username (gmail address) and password, or google credentials. I need this to use google calendar api, but gdata lib version 1 is android not compatible and version 2 (which is android compatible) is api level 5 or higher and i am developing for api level 3 too. regards! On Thu, May 27, 2010 at 9:37 AM, ayanir ayanir...@gmail.com wrote: Hello, I was looking for this info all over and still haven't found an answer. Is there a way to get the Google account or the Gmail address (no password) which have been signed to the device. the closest thing I saw is using AccountManager and Acount but this is only for Android class 5 or higher and I'm developing for class 3. from my understanding this is for online services which I do not need - I'm only want the Gmail address. Thanks ayanir -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@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] Socket freezes via GSM connection
Hello, I’m working on application that uses a socket connection. I’ve implemented 2 different Threads for the read() and the write() methods so they are not being blocked by the read. Everything is working well on the WiFi connection but when I switch to GSM connection the connection becomes unstable without any exception being thrown. It means that there are freezes – the write and read seems to work but no data is actually being piped. Here is what I’m doing: private Socket socketConn = null; private DataInputStream dis = null; private DataOutputStream dos = null; //Read buffer private byte[] buffer; ByteArrayOutputStream readBuffer; private String serverAddress; private int serverPort; public void openConnection(int timeout) throws Exception { if(socketConn != null){ return; } //if we need to resolve the host - if succeed we replace the default otherwise we use the default. //the check is done only once. if(checkHostResolved){ checkHostResolved = false; try{ InetAddress ia = InetAddress.getByName(serverHostAddress); serverAddress = ia.getHostAddress(); } catch(UnknownHostException e2){ MyLog.printException(this, e2, run() InetAddress.getByName); } } socketConn = new Socket(); InetSocketAddress isa = new InetSocketAddress(serverAddress, serverPort); socketConn.connect(isa, timeout); socketConn.setKeepAlive(true); socketConn.setTcpNoDelay(true); socketConn.setSoLinger(true, 1000); dis = new DataInputStream(socketConn.getInputStream()); dos = new DataOutputStream(socketConn.getOutputStream()); } public void closeConnection() { if(socketConn != null){ try{ if(dis != null){ socketConn.shutdownInput(); dis.close(); } if(dos != null){ socketConn.shutdownOutput(); dos.close(); } if(socketConn != null){ socketConn.close(); } if(readBuffer != null){ readBuffer.reset(); } } catch(IOException ioe){ MyLog.printException(this, ioe, Problem Closing connection); } finally{ dis = null; dos = null; socketConn = null; } } MyLog.printLog(this, closeConnection end); } private int trySend(String message) { try{ byte[] data = message.getBytes(); dos.write(data); dos.flush(); return 0; } catch(SocketException se){ MyLog.printException(this, se, Problem with trySend); } catch(Exception e){ MyLog.printException(this, e, trySend()); } MyLog.printLog(this, trySend() Problem with trySend); return ERROR_CODE_CONNECTION; } private boolean tryRead() { try{ int b = 0; while((b = dis.read(buffer)) 0){ readBuffer.write(buffer, 0, b); //if the last read byte is '\0' then we have complete reading at least 1 packet of data if(buffer[b - 1] == '\0'){ byte[] data = readBuffer.toByteArray(); MyLog.printLog(this, read data.length= + data.length); readBuffer.reset(); String text = new String(data, utf-8); return true; } MyLog.printLog(this, out while read b= + b); //if the b0 then EOF has reached if(b 0){ throw new Exception(EOF has reached); } } catch(Exception e){ } return false; } Does anyone encounter connection stability problems? Do I need to open the connection differently? How about using SocketChannel is it more reliable? Does Socket connection is a good approach when talking about mobile network connection? Thanks ayanir -- 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] Socket freezes via GSM connection
Hello, I’m working on application that uses a socket connection. I’ve implemented 2 different Threads for the read() and the write() methods so they are not being blocked by the read. Everything is working well on the WiFi connection but when I switch to GSM connection the connection becomes unstable without any exception being thrown. It means that there are freezes – the write and read seems to work but no data is actually being piped. Here is what I’m doing: private Socket socketConn = null; private DataInputStream dis = null; private DataOutputStream dos = null; //Read buffer private byte[] buffer; ByteArrayOutputStream readBuffer; private String serverAddress; private int serverPort; public void openConnection(int timeout) throws Exception { if(socketConn != null){ return; } //if we need to resolve the host - if succeed we replace the default otherwise we use the default. //the check is done only once. if(checkHostResolved){ checkHostResolved = false; try{ InetAddress ia = InetAddress.getByName(serverHostAddress); serverAddress = ia.getHostAddress(); } catch(UnknownHostException e2){ MyLog.printException(this, e2, run() InetAddress.getByName); } } socketConn = new Socket(); InetSocketAddress isa = new InetSocketAddress(serverAddress, serverPort); socketConn.connect(isa, timeout); socketConn.setKeepAlive(true); socketConn.setTcpNoDelay(true); socketConn.setSoLinger(true, 1000); dis = new DataInputStream(socketConn.getInputStream()); dos = new DataOutputStream(socketConn.getOutputStream()); } public void closeConnection() { if(socketConn != null){ try{ if(dis != null){ socketConn.shutdownInput(); dis.close(); } if(dos != null){ socketConn.shutdownOutput(); dos.close(); } if(socketConn != null){ socketConn.close(); } if(readBuffer != null){ readBuffer.reset(); } } catch(IOException ioe){ MyLog.printException(this, ioe, Problem Closing connection); } finally{ dis = null; dos = null; socketConn = null; } } MyLog.printLog(this, closeConnection end); } private int trySend(String message) { try{ byte[] data = message.getBytes(); dos.write(data); dos.flush(); return 0; } catch(SocketException se){ MyLog.printException(this, se, Problem with trySend); } catch(Exception e){ MyLog.printException(this, e, trySend()); } MyLog.printLog(this, trySend() Problem with trySend); return ERROR_CODE_CONNECTION; } private boolean tryRead() { try{ int b = 0; while((b = dis.read(buffer)) 0){ readBuffer.write(buffer, 0, b); //if the last read byte is '\0' then we have complete reading at least 1 packet of data if(buffer[b - 1] == '\0'){ byte[] data = readBuffer.toByteArray(); MyLog.printLog(this, read data.length= + data.length); readBuffer.reset(); String text = new String(data, utf-8); return true; } MyLog.printLog(this, out while read b= + b); //if the b0 then EOF has reached if(b 0){ throw new Exception(EOF has reached); } } catch(Exception e){ } return false; } Does anyone encounter connection stability problems? Do I need to open the connection differently? How about using SocketChannel is it more reliable? Does Socket connection is a good approach when talking about mobile network connection? Thanks ayanir -- 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] Socket freezes via GSM connection
Hello, I’m working on application that uses a socket connection. I’ve implemented 2 different Threads for the read() and the write() methods so they are not being blocked by the read. Everything is working well on the WiFi connection but when I switch to GSM connection the connection becomes unstable without any exception being thrown. It means that there are freezes – the write and read seems to work but no data is actually being piped. Here is what I’m doing: private Socket socketConn = null; private DataInputStream dis = null; private DataOutputStream dos = null; //Read buffer private byte[] buffer; ByteArrayOutputStream readBuffer; private String serverAddress; private int serverPort; public void openConnection(int timeout) throws Exception { if(socketConn != null){ return; } //if we need to resolve the host - if succeed we replace the default otherwise we use the default. //the check is done only once. if(checkHostResolved){ checkHostResolved = false; try{ InetAddress ia = InetAddress.getByName(serverHostAddress); serverAddress = ia.getHostAddress(); } catch(UnknownHostException e2){ MyLog.printException(this, e2, run() InetAddress.getByName); } } socketConn = new Socket(); InetSocketAddress isa = new InetSocketAddress(serverAddress, serverPort); socketConn.connect(isa, timeout); socketConn.setKeepAlive(true); socketConn.setTcpNoDelay(true); socketConn.setSoLinger(true, 1000); dis = new DataInputStream(socketConn.getInputStream()); dos = new DataOutputStream(socketConn.getOutputStream()); } public void closeConnection() { if(socketConn != null){ try{ if(dis != null){ socketConn.shutdownInput(); dis.close(); } if(dos != null){ socketConn.shutdownOutput(); dos.close(); } if(socketConn != null){ socketConn.close(); } if(readBuffer != null){ readBuffer.reset(); } } catch(IOException ioe){ MyLog.printException(this, ioe, Problem Closing connection); } finally{ dis = null; dos = null; socketConn = null; } } MyLog.printLog(this, closeConnection end); } private int trySend(String message) { try{ byte[] data = message.getBytes(); dos.write(data); dos.flush(); return 0; } catch(SocketException se){ MyLog.printException(this, se, Problem with trySend); } catch(Exception e){ MyLog.printException(this, e, trySend()); } MyLog.printLog(this, trySend() Problem with trySend); return ERROR_CODE_CONNECTION; } private boolean tryRead() { try{ int b = 0; while((b = dis.read(buffer)) 0){ readBuffer.write(buffer, 0, b); //if the last read byte is '\0' then we have complete reading at least 1 packet of data if(buffer[b - 1] == '\0'){ byte[] data = readBuffer.toByteArray(); MyLog.printLog(this, read data.length= + data.length); readBuffer.reset(); String text = new String(data, utf-8); return true; } MyLog.printLog(this, out while read b= + b); //if the b0 then EOF has reached if(b 0){ throw new Exception(EOF has reached); } } catch(Exception e){ } return false; } Does anyone encounter connection stability problems? Do I need to open the connection differently? How about using SocketChannel is it more reliable? Does Socket connection is a good approach when talking about mobile network connection? Thanks ayanir -- 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
[android-developers] Re: Launching the correct activity on resume
thanks jotobjects, I wanted to add few comments: 1.when I used the singleTask in launchMode, when I opened the app icon from the Home screen, it stated Activity A and not the last Activity. so this is not the solution. 2.from: http://developer.android.com/intl/de/guide/topics/manifest/activity-element.html I understand that I actually need to use singleTop since: The standard and singleTop modes differ from each other in just one respect: Every time there's new intent for a standard activity, a new instance of the class is created to respond to that intent. Each instance handles a single intent. Similarly, a new instance of a singleTop activity may also be created to handle a new intent. However, if the target task already has an existing instance of the activity at the top of its stack, that instance will receive the new intent (in an onNewIntent() call); a new instance is not created. using singleTop did solve the open from Home screen icon behavior but it still didn't fixed the open from Market behavior. again, I'm trying getting the application to always open from the last Activity no mater how it is opened. does anyone has any other thought on how to solve this? ayanir On Jan 27, 9:34 pm, jotobjects jotobje...@gmail.com wrote: On Jan 27, 2:13 am, ayanir ayanir...@gmail.com wrote: Hello, I have a similar problem when I open the application from the Market. if I go from Activity A (LAUNCHER) to B, press Home key and re open the application from the Home screen icon it come back to Activity B (the last Activity) as it should. but, if I open the application from the Market application, it open Activity A. what is the difference between these two Not sure exactly about the difference, but the general point is that the Home Screen launcher is keeping track of the Task that was launched from the Home screen for that app and will resume that same task with the Activity that is on top of that task. This only applies to launching from the Home screen. and how can it always open from the last Activity no mater how I open the application? A possible answer is to set singleTask launchMode. -- 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: Launching the correct activity on resume
Hello, I have a similar problem when I open the application from the Market. if I go from Activity A (LAUNCHER) to B, press Home key and re open the application from the Home screen icon it come back to Activity B (the last Activity) as it should. but, if I open the application from the Market application, it open Activity A. what is the difference between these two and how can it always open from the last Activity no mater how I open the application? Thanks ayanir On Jan 26, 8:07 am, jotobjects jotobje...@gmail.com wrote: Yes it looks like we have got confused here about what happens when returning to the Home screen (perhaps your issue was the Eclipse feature mentioned in the thread?). In the interests of clearing up quite a bit of misinformation in this thread, this is the what actually happens: Re-launching the Activity from the Home screen returns to the same Task that initially started that Activity (the one where action=MAIN and category=LAUNCHER). But whatever Activity was on top of that old Task is again the foreground Activity (unless clearTaskOnLaunch is set). The Activity listed in the Manifest with category LAUNCHER is NOT the Activity that is active and setting singleTop is not necessary to get this standard behavior. Here is one place that this behavior is outlined - http://developer.android.com/intl/fr/guide/topics/manifest/activity-e... On Jan 25, 1:08 pm, Josh Hoffman keshis...@gmail.com wrote: Thank you all for your help. I've tried some of the suggestions posted here and it seems like the main thing that was stopping me was not doing a full .apk build prior to each test. I implemented the android:launchMode=singleTop manifest flag, but that didn't actually seem to get me my desired functionality. The only time I ever hit the onNewIntent() execution block was if I hit home from Activity1 and relaunched. Hitting home from Activity2 simply resulted in returning to Activity1 on relaunch. When I tested my app via adb install -l -r myApp.apk, the Android application stack seemed to finally behave itself. If I hit home from Activity2 and relaunch, I return to Activity2 exactly as I left it (thanks largely to Matthias Kaeppler's Droid-Fu and BetterAsyncTask, I might add). Just wanted to post and say that my issues seem to be resolved thanks to this new (if a bit cumbersome) development process of doing a full apk build. Thanks again for all the help! On Jan 24, 10:58 pm, String sterling.ud...@googlemail.com wrote: On Jan 25, 12:54 am, jotobjects jotobje...@gmail.com wrote: If Activity1 and Activity2 are part of the same task and Activity2 is foreground when pressing the Home key, then I thought that choosing that app on the Home screen would return you to Activity2. Something to remember is that choosing that app on the Home screen (or in the Launcher drawer) is really clicking on a shortcut, and that shortcut is specifically to the activity with this in your manifest: intent-filter action android:name=android.intent.action.MAIN / category android:name=android.intent.category.LAUNCHER / /intent-filter It's also true (as another poster said) that installing your app from Eclipse can change what its default activity is. If you want to accurately simulate the behavior that your users will see, you need to build an APK as you would for release, install it through the command line, and see what that does. String -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Launching the correct activity on resume
Hello, I have a similar problem when I open the application from the Market. if I go from Activity A (LAUNCHER) to B, press Home key and re open the application from the Home screen icon it come back to Activity B (the last Activity) as it should. but, if I open the application from the Market application, it open Activity A. what is the difference between these two and how can it always open from the last Activity no mater how I open the application? Thanks ayanir On Jan 26, 8:07 am, jotobjects jotobje...@gmail.com wrote: Yes it looks like we have got confused here about what happens when returning to the Home screen (perhaps your issue was the Eclipse feature mentioned in the thread?). In the interests of clearing up quite a bit of misinformation in this thread, this is the what actually happens: Re-launching the Activity from the Home screen returns to the same Task that initially started that Activity (the one where action=MAIN and category=LAUNCHER). But whatever Activity was on top of that old Task is again the foreground Activity (unless clearTaskOnLaunch is set). The Activity listed in the Manifest with category LAUNCHER is NOT the Activity that is active and setting singleTop is not necessary to get this standard behavior. Here is one place that this behavior is outlined - http://developer.android.com/intl/fr/guide/topics/manifest/activity-e... On Jan 25, 1:08 pm, Josh Hoffman keshis...@gmail.com wrote: Thank you all for your help. I've tried some of the suggestions posted here and it seems like the main thing that was stopping me was not doing a full .apk build prior to each test. I implemented the android:launchMode=singleTop manifest flag, but that didn't actually seem to get me my desired functionality. The only time I ever hit the onNewIntent() execution block was if I hit home from Activity1 and relaunched. Hitting home from Activity2 simply resulted in returning to Activity1 on relaunch. When I tested my app via adb install -l -r myApp.apk, the Android application stack seemed to finally behave itself. If I hit home from Activity2 and relaunch, I return to Activity2 exactly as I left it (thanks largely to Matthias Kaeppler's Droid-Fu and BetterAsyncTask, I might add). Just wanted to post and say that my issues seem to be resolved thanks to this new (if a bit cumbersome) development process of doing a full apk build. Thanks again for all the help! On Jan 24, 10:58 pm, String sterling.ud...@googlemail.com wrote: On Jan 25, 12:54 am, jotobjects jotobje...@gmail.com wrote: If Activity1 and Activity2 are part of the same task and Activity2 is foreground when pressing the Home key, then I thought that choosing that app on the Home screen would return you to Activity2. Something to remember is that choosing that app on the Home screen (or in the Launcher drawer) is really clicking on a shortcut, and that shortcut is specifically to the activity with this in your manifest: intent-filter action android:name=android.intent.action.MAIN / category android:name=android.intent.category.LAUNCHER / /intent-filter It's also true (as another poster said) that installing your app from Eclipse can change what its default activity is. If you want to accurately simulate the behavior that your users will see, you need to build an APK as you would for release, install it through the command line, and see what that does. String -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Run application from last Activity/state
Hello, I have an application with several Activities. My A Activity has the Manifest Intent filter parameters: action.MAIN and category.LAUNCHER. after its being loaded I call Activity B and finish() A since I don't use it anymore. After I run my application, go from Activity A to B and press the Home button, when I relaunch it from the applications menu or from the Market app for ex.(not by a long press on the Home button), it starts from the A Activity and do not save its last Activity B. I definitely know that this is possible to relaunch an application from its last Activity (some application from the Market do support it) and I think that this can be determined by the Manifest parameters but I don't know which one. does anyone know how to implement it so my application can relaunch from its last Activity B? Thanks ayanir -- 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: SoundPool problem
It is very annoying that this problem stared with the 2.0 version (hope that the framework developers see that remark) while in the 1.6 and 1.5 it worked fine. The workaround for this problem, besides of changing the files format is using MediaPlayer and handle the sound low level (which I really don't want to do). BTW, my all sounds are not even close to the 1 MB limit so the problem is not that. Nikolay, I didn't understand, did you have to encode the sound to mono for all of the souds or just for the long one(7 sec)? Thanks On Nov 11, 7:26 am, Nightwolf mikh...@gmail.com wrote: It seems that SoundPool can't allocate more than 1 MB. SoundPool stores uncompressed audio. Does anyone know is it possible to control uncompressed audio characteristics? That would allow storing relatively lengthy sounds. On 10 ноя, 22:18, Nikolay Ananiev devuni...@gmail.com wrote: I had the same problem. All my sounds were in .mp3 and they didn't play in 2.0. I had to reencode them in .ogg and everything started working again. But then I had a problem with one of the longer sounds (7 secs). Only 6 seconds were loaded, because there was some stack overflow at the end of the loading. I had to remove the stereo and encode it as a mono. It worked well. On Tue, Nov 10, 2009 at 6:17 PM, ayanir ayanir...@gmail.com wrote: Hello, I'm using a SoundPool for playing my game sound effects. It all worked fine until I checked it on the new SDK 2.0. the sounds are not played and I'm getting in my log: SoundPool Sample channel count (0) out of range right after the playerPool.load (see the code). does any one encountered with this problem? here is my code: package j2ab.android.rpcapp.utils; import android.content.Context; import android.media.AudioManager; import android.media.SoundPool; import j2ab.android.rpcapp.R; public class SoundManager { private static boolean isSoundEnabled = true; private static final int[] PLAYERS_RES_IDS = {R.raw.snd1, R.raw.snd2,R.raw.snd3}; /** * Player priority in case of ONE_PLAYER. the highest priority is 0. */ private static final int[] PLAYERS_PRIORITY = {1, 1, 1}; private int[] idToStream; private SoundPool playerPool; public SoundManager(Context context, int maxStreams) { playerPool = new SoundPool(maxStreams, AudioManager.STREAM_MUSIC, 0); idToStream = new int[PLAYERS_RES_IDS.length]; for (int i = 0; i idToStream.length; i++){ idToStream[i] = playerPool.load(context, PLAYERS_RES_IDS[i], PLAYERS_PRIORITY[i]); } } public int play(int playerId, boolean interrupt) { if(isSoundEnabled){ int status = playerPool.play(idToStream[playerId], 0.99f, 0.99f, 0, 0, 1); if(status == 0) MyLog.printLog(, cant play a sound + playerId); return status; } return 0; } public void stopPlayer(int playerId, boolean resetMediaTime) { if(resetMediaTime){ playerPool.stop(idToStream[playerId]); } else{ playerPool.pause(idToStream[playerId]); } } public void onDispose() { playerPool.release(); } } BTW the emulator managed to play sound using MediaPlayer, but I don't want to use a low level sound management. Tanks Yanir -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@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: SoundPool problem
thank you Nikolay, It worked after the the format change. On Nov 11, 7:49 pm, Nikolay Ananiev devuni...@gmail.com wrote: Just the long one. On Wed, Nov 11, 2009 at 10:05 AM, ayanir ayanir...@gmail.com wrote: It is very annoying that this problem stared with the 2.0 version (hope that the framework developers see that remark) while in the 1.6 and 1.5 it worked fine. The workaround for this problem, besides of changing the files format is using MediaPlayer and handle the sound low level (which I really don't want to do). BTW, my all sounds are not even close to the 1 MB limit so the problem is not that. Nikolay, I didn't understand, did you have to encode the sound to mono for all of the souds or just for the long one(7 sec)? Thanks On Nov 11, 7:26 am, Nightwolf mikh...@gmail.com wrote: It seems that SoundPool can't allocate more than 1 MB. SoundPool stores uncompressed audio. Does anyone know is it possible to control uncompressed audio characteristics? That would allow storing relatively lengthy sounds. On 10 ноя, 22:18, Nikolay Ananiev devuni...@gmail.com wrote: I had the same problem. All my sounds were in .mp3 and they didn't play in 2.0. I had to reencode them in .ogg and everything started working again. But then I had a problem with one of the longer sounds (7 secs). Only 6 seconds were loaded, because there was some stack overflow at the end of the loading. I had to remove the stereo and encode it as a mono. It worked well. On Tue, Nov 10, 2009 at 6:17 PM, ayanir ayanir...@gmail.com wrote: Hello, I'm using a SoundPool for playing my game sound effects. It all worked fine until I checked it on the new SDK 2.0. the sounds are not played and I'm getting in my log: SoundPool Sample channel count (0) out of range right after the playerPool.load (see the code). does any one encountered with this problem? here is my code: package j2ab.android.rpcapp.utils; import android.content.Context; import android.media.AudioManager; import android.media.SoundPool; import j2ab.android.rpcapp.R; public class SoundManager { private static boolean isSoundEnabled = true; private static final int[] PLAYERS_RES_IDS = {R.raw.snd1, R.raw.snd2,R.raw.snd3}; /** * Player priority in case of ONE_PLAYER. the highest priority is 0. */ private static final int[] PLAYERS_PRIORITY = {1, 1, 1}; private int[] idToStream; private SoundPool playerPool; public SoundManager(Context context, int maxStreams) { playerPool = new SoundPool(maxStreams, AudioManager.STREAM_MUSIC, 0); idToStream = new int[PLAYERS_RES_IDS.length]; for (int i = 0; i idToStream.length; i++){ idToStream[i] = playerPool.load(context, PLAYERS_RES_IDS[i], PLAYERS_PRIORITY[i]); } } public int play(int playerId, boolean interrupt) { if(isSoundEnabled){ int status = playerPool.play(idToStream[playerId], 0.99f, 0.99f, 0, 0, 1); if(status == 0) MyLog.printLog(, cant play a sound + playerId); return status; } return 0; } public void stopPlayer(int playerId, boolean resetMediaTime) { if(resetMediaTime){ playerPool.stop(idToStream[playerId]); } else{ playerPool.pause(idToStream[playerId]); } } public void onDispose() { playerPool.release(); } } BTW the emulator managed to play sound using MediaPlayer, but I don't want to use a low level sound management. Tanks Yanir -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com android-developers%2bunsubscr...@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.comandroid-developers%2bunsubscr
[android-developers] SoundPool problem
Hello, I'm using a SoundPool for playing my game sound effects. It all worked fine until I checked it on the new SDK 2.0. the sounds are not played and I'm getting in my log: SoundPool Sample channel count (0) out of range right after the playerPool.load (see the code). does any one encountered with this problem? here is my code: package j2ab.android.rpcapp.utils; import android.content.Context; import android.media.AudioManager; import android.media.SoundPool; import j2ab.android.rpcapp.R; public class SoundManager { private static boolean isSoundEnabled = true; private static final int[] PLAYERS_RES_IDS = {R.raw.snd1, R.raw.snd2,R.raw.snd3}; /** * Player priority in case of ONE_PLAYER. the highest priority is 0. */ private static final int[] PLAYERS_PRIORITY = {1, 1, 1}; private int[] idToStream; private SoundPool playerPool; public SoundManager(Context context, int maxStreams) { playerPool = new SoundPool(maxStreams, AudioManager.STREAM_MUSIC, 0); idToStream = new int[PLAYERS_RES_IDS.length]; for (int i = 0; i idToStream.length; i++){ idToStream[i] = playerPool.load(context, PLAYERS_RES_IDS[i], PLAYERS_PRIORITY[i]); } } public int play(int playerId, boolean interrupt) { if(isSoundEnabled){ int status = playerPool.play(idToStream[playerId], 0.99f, 0.99f, 0, 0, 1); if(status == 0) MyLog.printLog(, cant play a sound + playerId); return status; } return 0; } public void stopPlayer(int playerId, boolean resetMediaTime) { if(resetMediaTime){ playerPool.stop(idToStream[playerId]); } else{ playerPool.pause(idToStream[playerId]); } } public void onDispose() { playerPool.release(); } } BTW the emulator managed to play sound using MediaPlayer, but I don't want to use a low level sound management. Tanks Yanir -- 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] end application notification
Hello, I have an application with several Activities. I understand that the Android platform handle some sort of an Activity Stack so there is the option to go back to the previous Activities in the stack. I also know that there is no access to this Stack. I would like to know if there is a way to check if all my application Activities are finished (not in the Stack). in other words, if I'm in my first Activity and press the Back key or alternatively call Activity.finish(), I would like to get a notification that all my Application Activities are finished so I can control my application exit. Thanks in advance, ayanir --~--~-~--~~~---~--~~ 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: Relative Layout XML attributes have no obvious programmatic equivalent.
Hello again, I just wanted to add that the layout.xml: RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android; android:layout_width=wrap_content android:layout_height=wrap_content com.example.RPCPlayerInfoTitle android:id=@+id/player_info android:layout_width=wrap_content android:layout_height=wrap_content / /RelativeLayout when I changed the layout_width and layout_height to constants, the addRule works. another thing I've noticed is that when I don't override onMeasure in RPCPlayerInfoTitle, myImage is being aligned to the bottom of the screen. from some strange reason myImage doesn't recognized RPCPlayerInfoTitle (my custom View) as its parent or ignore its dimensions. thanks ayanir On Sep 15, 6:05 pm, ayanir ayanir...@gmail.com wrote: Hello, I've tried to use the addRull but it seems it doesn't work. in fact, when I used it the View disappeared from the screen. here is my code: package com.example; import android.content.Context; import android.content.res.Resources; import android.graphics.BitmapFactory; import android.util.AttributeSet; import android.widget.ImageView; import android.widget.RelativeLayout; public class RPCPlayerInfoTitle extends RelativeLayout { private static final int VIEW_ID_IMAGE = 0; private static final int VIEW_ID_NAME = 1; private static final int VIEW_ID_RANK = 2; ImageView bg; ImageView myImage; public RPCPlayerInfoTitle(Context context, AttributeSet attrs) { super(context, attrs); setLayoutParams(new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT)); bg = new ImageView(context); Resources res = getResources(); bg.setImageBitmap(BitmapFactory.decodeResource(res, R.drawable.bg2)); addView(bg); myImage = new ImageView(context); myImage.setImageBitmap(BitmapFactory.decodeResource(res, R.drawable.p_image)); myImage.setId(VIEW_ID_IMAGE); RelativeLayout.LayoutParams param1 = new RelativeLayout.LayoutParams (LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); //***when I add this line the playerImage disappears param1.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); addView(myImage, param1); } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); setMeasuredDimension(bg.getMeasuredWidth(), bg.getMeasuredHeight()); } } does anyone have a clue? Thanks, ayanir On Aug 4, 8:46 pm, bpellow bpello...@gmail.com wrote: I got this to work withaddruleandRelativeLayout.LayoutParams // center my_textbox RelativeLayout.LayoutParamsparams_center = newRelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); params_center.addRule(RelativeLayout.CENTER_IN_PARENT); // add my_textbox l.addView(my_textbox, params_center); You could do this similarly with all types of dynamic view additions (given appropriate rules) so far as I can tell. Thanks guys. On Jul 30, 3:08 pm, Mark Murphy mmur...@commonsware.com wrote: doubleslash wrote: Just like John and Pavel, I cannot figure out how to set some RelativeLayout XML attributes programmatically in Java. For example, I cannot find a programmatic way to define layout_centerVertical=true with only Java. http://developer.android.com/reference/android/widget/RelativeLayout -- Mark Murphy (a Commons Guy)http://commonsware.com|http://twitter.com/commonsguy Warescription: Three Android Books, Plus Updates, $35/Year --~--~-~--~~~---~--~~ 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: Relative Layout XML attributes have no obvious programmatic equivalent.
Hello, I've tried to use the addRull but it seems it doesn't work. in fact, when I used it the View disappeared from the screen. here is my code: package com.example; import android.content.Context; import android.content.res.Resources; import android.graphics.BitmapFactory; import android.util.AttributeSet; import android.widget.ImageView; import android.widget.RelativeLayout; public class RPCPlayerInfoTitle extends RelativeLayout { private static final int VIEW_ID_IMAGE = 0; private static final int VIEW_ID_NAME = 1; private static final int VIEW_ID_RANK = 2; ImageView bg; ImageView myImage; public RPCPlayerInfoTitle(Context context, AttributeSet attrs) { super(context, attrs); setLayoutParams(new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT)); bg = new ImageView(context); Resources res = getResources(); bg.setImageBitmap(BitmapFactory.decodeResource(res, R.drawable.bg2)); addView(bg); myImage = new ImageView(context); myImage.setImageBitmap(BitmapFactory.decodeResource(res, R.drawable.p_image)); myImage.setId(VIEW_ID_IMAGE); RelativeLayout.LayoutParams param1 = new RelativeLayout.LayoutParams (LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); //***when I add this line the playerImage disappears param1.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); addView(myImage, param1); } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); setMeasuredDimension(bg.getMeasuredWidth(), bg.getMeasuredHeight()); } } does anyone have a clue? Thanks, ayanir On Aug 4, 8:46 pm, bpellow bpello...@gmail.com wrote: I got this to work withaddruleandRelativeLayout.LayoutParams // center my_textbox RelativeLayout.LayoutParamsparams_center = newRelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); params_center.addRule(RelativeLayout.CENTER_IN_PARENT); // add my_textbox l.addView(my_textbox, params_center); You could do this similarly with all types of dynamic view additions (given appropriate rules) so far as I can tell. Thanks guys. On Jul 30, 3:08 pm, Mark Murphy mmur...@commonsware.com wrote: doubleslash wrote: Just like John and Pavel, I cannot figure out how to set some RelativeLayout XML attributes programmatically in Java. For example, I cannot find a programmatic way to define layout_centerVertical=true with only Java. http://developer.android.com/reference/android/widget/RelativeLayout -- Mark Murphy (a Commons Guy)http://commonsware.com|http://twitter.com/commonsguy Warescription: Three Android Books, Plus Updates, $35/Year --~--~-~--~~~---~--~~ 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: SurfaceViews handling, Thread, and general game design
Hello Dianne , Thank you for you response. according to your words, I do not need that each Box will be as a Surface view but only one game surface view and the only way I can mange the game objects(Boxes etc.) is by using a low level management of drawing and event handling. If I trying to answer my own question then option (4) is the way to do it. I thought I will design my game Flash style where each object draw itself and the main Activity will handle the events and drawing Threads but I presume we are not there yet. It helped me a lot to read Playing with graphics in Android Tutorial (http://www.droidnova.com/playing-with-graphics-in-android- part-i,147.html) which spread a light on hot to use surface view and animation. Regards to you all ayanir On Jul 14, 7:06 pm, Dianne Hackborn hack...@android.com wrote: I very strongly recommend that you don't use multiple surface views. A surface view is a very heavy-weight object, and intended for the primary area of the window -- for example, the video part of a video player, the playfield of a game, etc. It is basically an overlay, and actually its own separate full window that is simply being Z-ordered with your main window to make it look like they are related. I don't know what your complicated animation sequence is, but just having some animation is not enough reason to use a surface view. Worst case, you can just create an off-screen bitmap that you draw the animation in and update the screen by drawing that bitmap to the screen with the normal invalidate() mechanism. If you need the performance of a surface view, then you should design your game so that your entire playfield is on surface view, and you take care of drawing each of your boxes inside of that and manage them however you want (not as their own views). On Tue, Jul 14, 2009 at 4:27 AM, ayanir ayanir...@gmail.com wrote: Hello, I'm a new Android developer. I would like to make a simple game using the SurfaceView (Canvas drawing). the game has a a custom Object name Box. Box can draw itself and need to get an event when it is clicked. when it does, there is an animation sequence coming out of the box like a jumping clown. I have several Boxes on the screen when each of them can be activated. Several Boxes animation can also be presented simultaneously. Here it gets tricky: Since I have a complicated animation sequence, each Box extends SurfaceView. The problem is I haven't figured it out how can I handle several SurfaceView's drawing using only one Thread (in order to present an animation I need to use one) and also how can I get the onClick/ onThouch event from my Activity to each of my Boxes. The LunarLanding example in the SDK uses only one Thread but also uses only one SurfaceView which manage the animation of the game components (there are no several game components SurfaceViews). Also, there is no need to get onTouch event, so this example doesn't match to my case. I have several questions about what is the right approach do code this: 1. Should I use Box extends SurfaceView? 2. Can SurfaceView gets user events like onTouch/onClick? 3. Is there a way to add to the main SurfaceView another SurfaceView (Box)? 4. If none of the above questions is positive, should I use one SurfaceView (and one Thread) and try to map the other Boxes on the screen for user event handling. I mean Box only paints itself but the user event is being handled by me (not by the OS). 5. Should each Box (SurfaceView) should handle it's own Thread in case of animation (it is not good design but it is also an option)? 6. do you have any other proposal? I know that these are a lot of questions but I'll appreciate if you can answer some of them. Thanks in advance, ayanir -- 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: SurfaceViews handling, Thread, and general game design
Here is the correct link: http://www.droidnova.com/playing-with-graphics-in-android-part-i,147.html On Jul 15, 2:33 pm, ayanir ayanir...@gmail.com wrote: Hello Dianne , Thank you for you response. according to your words, I do not need that each Box will be as a Surface view but only one game surface view and the only way I can mange the game objects(Boxes etc.) is by using a low level management of drawing and event handling. If I trying to answer my own question then option (4) is the way to do it. I thought I will design my game Flash style where each object draw itself and the main Activity will handle the events and drawing Threads but I presume we are not there yet. It helped me a lot to read Playing with graphics in Android Tutorial (http://www.droidnova.com/playing-with-graphics-in-android- part-i,147.html) which spread a light on hot to use surface view and animation. Regards to you all ayanir On Jul 14, 7:06 pm, Dianne Hackborn hack...@android.com wrote: I very strongly recommend that you don't use multiple surface views. A surface view is a very heavy-weight object, and intended for the primary area of the window -- for example, the video part of a video player, the playfield of a game, etc. It is basically an overlay, and actually its own separate full window that is simply being Z-ordered with your main window to make it look like they are related. I don't know what your complicated animation sequence is, but just having some animation is not enough reason to use a surface view. Worst case, you can just create an off-screen bitmap that you draw the animation in and update the screen by drawing that bitmap to the screen with the normal invalidate() mechanism. If you need the performance of a surface view, then you should design your game so that your entire playfield is on surface view, and you take care of drawing each of your boxes inside of that and manage them however you want (not as their own views). On Tue, Jul 14, 2009 at 4:27 AM, ayanir ayanir...@gmail.com wrote: Hello, I'm a new Android developer. I would like to make a simple game using the SurfaceView (Canvas drawing). the game has a a custom Object name Box. Box can draw itself and need to get an event when it is clicked. when it does, there is an animation sequence coming out of the box like a jumping clown. I have several Boxes on the screen when each of them can be activated. Several Boxes animation can also be presented simultaneously. Here it gets tricky: Since I have a complicated animation sequence, each Box extends SurfaceView. The problem is I haven't figured it out how can I handle several SurfaceView's drawing using only one Thread (in order to present an animation I need to use one) and also how can I get the onClick/ onThouch event from my Activity to each of my Boxes. The LunarLanding example in the SDK uses only one Thread but also uses only one SurfaceView which manage the animation of the game components (there are no several game components SurfaceViews). Also, there is no need to get onTouch event, so this example doesn't match to my case. I have several questions about what is the right approach do code this: 1. Should I use Box extends SurfaceView? 2. Can SurfaceView gets user events like onTouch/onClick? 3. Is there a way to add to the main SurfaceView another SurfaceView (Box)? 4. If none of the above questions is positive, should I use one SurfaceView (and one Thread) and try to map the other Boxes on the screen for user event handling. I mean Box only paints itself but the user event is being handled by me (not by the OS). 5. Should each Box (SurfaceView) should handle it's own Thread in case of animation (it is not good design but it is also an option)? 6. do you have any other proposal? I know that these are a lot of questions but I'll appreciate if you can answer some of them. Thanks in advance, ayanir -- 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] SurfaceViews handling, Thread, and general game design
Hello, I'm a new Android developer. I would like to make a simple game using the SurfaceView (Canvas drawing). the game has a a custom Object name Box. Box can draw itself and need to get an event when it is clicked. when it does, there is an animation sequence coming out of the box like a jumping clown. I have several Boxes on the screen when each of them can be activated. Several Boxes animation can also be presented simultaneously. Here it gets tricky: Since I have a complicated animation sequence, each Box extends SurfaceView. The problem is I haven't figured it out how can I handle several SurfaceView's drawing using only one Thread (in order to present an animation I need to use one) and also how can I get the onClick/ onThouch event from my Activity to each of my Boxes. The LunarLanding example in the SDK uses only one Thread but also uses only one SurfaceView which manage the animation of the game components (there are no several game components SurfaceViews). Also, there is no need to get onTouch event, so this example doesn't match to my case. I have several questions about what is the right approach do code this: 1. Should I use Box extends SurfaceView? 2. Can SurfaceView gets user events like onTouch/onClick? 3. Is there a way to add to the main SurfaceView another SurfaceView (Box)? 4. If none of the above questions is positive, should I use one SurfaceView (and one Thread) and try to map the other Boxes on the screen for user event handling. I mean Box only paints itself but the user event is being handled by me (not by the OS). 5. Should each Box (SurfaceView) should handle it's own Thread in case of animation (it is not good design but it is also an option)? 6. do you have any other proposal? I know that these are a lot of questions but I'll appreciate if you can answer some of them. Thanks in advance, ayanir --~--~-~--~~~---~--~~ 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] ListView with different types of View's
Hello for all the Android's out there, I'm trying to make a ListView when every item in that list can be a different type of View. for example the list could be: 1. TextView 2. ImageView 3. MyCustomView I understands that in order to make a list I need to use an Adapter. the problem is that the Adapter uses a single layout for all of the list items, which will not support the different views. my goal is to make an abstract View list when I can dynamically add and removes items in that list (each item is a View or subclass of it). Thanks ayanir --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---