[android-developers] Re: App talking to native ARM binary via sockets
This might help you http://stackoverflow.com/questions/7516018/android-localserversocket -Mika On Jun 7, 4:45 am, galapogos gois...@gmail.com wrote: Thanks. Seems like 127.0.0.1 works. I also tried 0.0.0.0 and that worked too. I would also like to use unix domain sockets, since I really only want the 2 processes talking to each other rather than any external devices talking to my device. However, when I change AF_INET to AF_UNIX in the socket() call in my server and client, I get run time Invalid argument errors on bind() and connect() respectively. How do I make the switch to unix domain sockets? What am I missing? On Wednesday, June 6, 2012 11:13:07 PM UTC+8, Chris Stratton wrote: On Jun 6, 8:34 am, Tony Houghton h...@realh.co.uk wrote: 10.0.2.2 is a special address so that apps in an emulator can connect to services on the host running the emulator. AIUI your service is running on the same Android device as the client so I think you want 127.0.0.1. Yes. Not only is the special address the wrong computer, it's unique to emulators and not available on real devices. If using a network socket, loopback is the answer. However, unless you absolutely have to emulate IP networking, it may be preferable to use a unix-domain socket rather than a network one. This will remove the requirement that any apk using it carry internet permission, while keeping many of the semantics comparable. While unix domain sockets aren't the first choice for IPC within android (that would be Binder) they definitely are used within android itself, for example the connection between the adb daemon and a debuggable app process which makes java debugging possible is done via a unix socket. -- 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] Performance of different IPC methods
Hi all, In my app the process number 1 generates around 1KB of data every couple of seconds and passes this to process number 2. To my understanding there are three ways to pass data between processes: publishing IPC interface using Binder, using Messeger or using Broadcasts. I would like to get some feedback what would be the best way to pass the data between the processes? Any ideas how android handles these different scenarios? Also would it be more effective to cache the data in process 1 for a while and then send the data in longer intervals and bigger chunks to process 2? Any insight to this is really valuable. I know that this all could be done in one process also, but because of the use case and some external requirements unfortunately that is not really option in my case... -- 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: About sensors
On May 2, 11:36 pm, Alfis aldoze...@gmail.com wrote: Hello, I'm new to this forum and to Android developement. I got problems programming my device (Samsung Galaxy Gio S5660V) so I decided to post. Initially I downloaded a thermometer app, Thermo by Antonio Tonev, it works giving the ambient temperature. After that I tried to make my own thermometer app and I found that it didn't work, I'm totally unable to get results. Then downloading other applications related to sensors and reading my phone specs i found out that it doesn't have a temperature sensor. My question is: how can the application Thermo by Antonio Tonev report temperature if my phone doesn't have temperature sensor? Thanks a lot for any answer. Alfis Maybe it get's your location and then the temperature in that location through some web service. Like this for example http://developer.yahoo.com/weather/ -Mika -- 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: admin de memoria en android
Check this answers from this stackoverflow question. It might give you some insights http://stackoverflow.com/questions/2298208/how-to-discover-memory-usage-of-my-application-in-android -Mika On May 3, 9:20 am, milady nmor...@hotmail.com wrote: quisiera saber como funciona la administracion de la memoria en android mas especificamente todo lo relacionado con la memoria virtual y el paso de memoria virtual a real si me pudieran explicar o dar el link de una pagina donde ya este se los agradeceria mucho I would like to know how the administration of the android memory more specifically all about virtual memory and virtual memory over a real if I could explain or give link to a page where they are and would greatly appreciate 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] IPC peformace suggestions
Hi all, In my app the process number 1 generates around 1KB of data every couple of seconds and passes this to process number 2. To my understanding there are three ways to pass data between processes: publishing IPC interface using Binder, using Messeger or using Broadcasts. I would like to get some feedback what would the best way to pass the data between the processes? Any ideas how android handles these different scenarios? Also would it be more effective to cache the data in process 1 for a while and then send the data in longer intervals and bigger chunks to process 2? Any insight to this is really valuable. I know that this all could be done in one process also, but because of the use case and some external requirements unfortunately that is not really option in my case... -- 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: GUI problems! Very Crazy!
utilizamos dp e sp. varia de acordo com o componente On 13 dez, 07:27, Ali Chousein ali.chous...@gmail.com wrote: Maybe my question sounds very basic and simple, but did you define the size of your components in dip? - Ali Chousein Weather-Buddyhttp://weatherbuddy.blogspot.com|http://twitter.com/weather_buddy Geo-Filtered Assistanthttp://geo-filtered-assistant.blogspot.comhttps://marketplace.cisco.com/apphq/products/994 -- 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: GUI problems! Very Crazy!
use sd and sp. varies according to the component On 13 dez, 07:27, Ali Chousein ali.chous...@gmail.com wrote: Maybe my question sounds very basic and simple, but did you define the size of your components in dip? - Ali Chousein Weather-Buddyhttp://weatherbuddy.blogspot.com|http://twitter.com/weather_buddy Geo-Filtered Assistanthttp://geo-filtered-assistant.blogspot.comhttps://marketplace.cisco.com/apphq/products/994 -- 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] GUI problems! Very Crazy!
folks, I and my team are developing an application and we are finding the following problem: during testing the application on the smartphone, the visual components such as buttons, text boxes, dialog boxes, are rising to a higher resolution than the one defined for it, making it impossible to read the entire contents of the dialog box for example . Does anyone know why this is happening? -- 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: HttpsURLConnection's getResponseCode() returns -1
Hi, I sometimes had similar kind of problems, where one request received the correct responseCode but the second request to the same URL failed with request code -1. After setting http.keepAlive system property to false, everything started to function properly. So maybe you could try adding this line System.setProperty(http.keepAlive, false); to your code. Maybe it'll help. -Mika On May 11, 3:36 am, John Gaby jg...@gabysoft.com wrote: I am trying to use HttpsURLConnection to connect to a secure site, and it is failing and getResponseCode() is returning -1. The following is the code that I am using. Note that this very same code works in other cases. Can anyone give me a clue as to why I might get the -1, and how I can get more information about what is going wrong. Also note, that if I take the URL that I am trying to connect to in this call and paste it into a browser, I get the correct response, so I am pretty sure that the URL itself is correct. In this particular call, m_data is null, so it is performing a GET and no data is written. Thanks HttpsURLConnection connection = null; try { URL url = new URL(arg0[0]); connection = (HttpsURLConnection) url.openConnection(); // Allow Inputs Outputs if there is data to send connection.setDoInput(true); connection.setDoOutput(m_data != null); connection.setUseCaches(false); // Enable GET or POST depending on whether there is data to send connection.setRequestMethod((m_data == null) ? GET : POST); connection.setRequestProperty(Connection, Keep-Alive); connection.setRequestProperty(Content-Type, application/ octet-stream); if (m_data != null) { DataOutputStream outputStream = null; connection.setFixedLengthStreamingMode(m_data.length); outputStream = new DataOutputStream( connection.getOutputStream() ); outputStream.write(m_data); outputStream.flush(); outputStream.close(); } // Responses from the server (code and message) int serverResponseCode = connection.getResponseCode(); String serverResponseMessage = connection.getResponseMessage(); InputStream inputStream = connection.getInputStream(); int nBytes; m_curBytes = 0; m_totBytes = connection.getContentLength(); byte[] bytes = new byte[65536]; while ((nBytes = inputStream.read(bytes)) 0) { if (m_file != null) { m_file.write(bytes, 0, nBytes); } else if (m_result != null) { m_result.append(bytes, 0, nBytes); } m_curBytes += nBytes; m_handler.post(new Runnable() { public void run() { if (m_pInet != 0) { GDownloadProgress(m_pInet, m_curBytes, m_totBytes); } else { int i = 0; } } }); } if (m_file != null) { m_error = false; } else if (m_result != null) { m_error = (m_result.length() = 0); } else { m_error = true; } } catch (Exception ex) { GSystem.GLogWarning(GINet: error = + ex.getMessage()); } -- 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: Why can't I set the device Microphone mute
Maybe the other application just puts the microphone on again? -Mika On May 11, 10:47 am, Ian Kao@TW ian@gmail.com wrote: Now I am trying to build a apk which can control the device's hardware. When I try to mute microphone with the AudioManager.muteMicrophone and AudioSystem.muteMicrophone methods. As a result, I can only mute the Microphone in my own apk, when I jump to another apk such as some other recorder, the microphone seem to do nothing with my setting... But there seem to be only one way to the JNI, so I am very confuced, is there any other solution can help me with this?? To sum up, I want to make an apk whick can mute my device's microphone, anybody can give me a few hints about it? Or I can only make it by turn the driver down? -- 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: Can we run adb commands through android applications?
Process process = Runtime.getRuntime().exec(logcat); InputStream is = process.getInputStream(); On May 6, 8:50 am, manoj manojkumar.m...@gmail.com wrote: Hi All, can we write an android application which runs adb commands like adb logcat? I mean, in an activity, I want to execute the adb logcat. Is it possible? if so how? thanks, Manoj. -- 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] In-App and contents server
Hi everyone, I am examining In-App and the contents server. I want to know payment information on In-App from the contents server. How should I do? I think whether something can be done by using the order number. Thanks for reading and your possible help, Mika -- 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] In-App and contents server
Hi everyone, I am examining In-App and the contents server. I want to know payment information on In-App from the contents server. How should I do? I think whether something can be done by using the order number. Thanks for reading and your possible help, Mika -- 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: Two activities in one window
Thanks for all the suggestions. Might be that I'll try to do this with putting the values to a notification as TreKing suggested. David I'll check the app you mentioned. In the Android API APN settings are Secure Settings, which means that 3rd party apps are not allowed to write them. But if GiffGaffAPN can do it, maybe there's some hack that I'm not aware of. :) -Mika -- 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] Two activities in one window
Hi, I'm developing an application where the users can modify the internet access point settings, but because the apn settings are secure settings they can't be changed programmatically. So what I would like to do is to open the apn settings activity and in the same window show the values that the user should input to the settings. I have been trying to look the ActivityGroup API but couldn't figure out if this is possible to do with that. Anyone have any ideas how to show two activities (one with the setting values, and another one where to input the values) in the same window so the user doesn't have to switch between activities?? Or any other ideas how the user could modify the secure settings easily? -Mika -- 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: Two activities in one window
Hi Marcin, Thanks for the reply. :) Yes my idea is to redirect the user to the system settings. The problem is that if I want the user to change for example the internet access pointsettings, I don't think they can remember the acecsspoint name, server, port, username, password, etc. that they should input. So what I would like to do is to have one view open where the user can see the new values and in the same window have also the system settings activity where the user should input the values. -Mika On Mar 2, 1:53 pm, Marcin Orlowski webnet.andr...@gmail.com wrote: switch between activities?? Or any other ideas how the user could modify the secure settings easily? Not really what you expect as answer, but why not just tell user he will be redirected to system settings panel and when he's done BACK would let to return to your activity? While embedding is quite tempting (from your standpoint), launching system settings is common and standard way to that you want to accomplish. Other approaches will most likely be close to luring in hacks and while I am personally not against using hacks, I do that only if there's no better way to do the task (or no other way than hacks). Launching system prefs is the better and clean way and you save your time. -- Regards, Marcin -- 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 does PackageManager detect what architecture APK targets?
Ok so I managed to get it to install. What does CPU_ABI define when compiling the android source? Well I suppose the correct question is, what kind of implications does it have when the CPU_ABI used to say: CPU_ABI := armeabi and I changed it to: CPU_ABI := armv7-a And it started working smoothly. Am I killing backwards compatibility or what's going on? I tried googling around with CPU_ABI and my google- fu unfortunately was not strong enough to find a viable answer to WHAT exactly CPU_ABI defines on the android side. After I changed this the APK installed perfectly and the application purred like a kitten. Also thanks for the confirmations and help. - M -- 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 does PackageManager detect what architecture APK targets?
Hello everyone, I'm currently trying to specifically target ARMv7 custom hardware and I'm facing issues when trying to install the APK. When I try doing adb install app.apk Logcat informs me that : W/PackageManager( 1062): Native ABI mismatch from package file And does not install the APK. With searching I was able to trace down that the problem might have something to do with the architectures not matching on the APK and the platform. Is this it? How does the PackageManager find out the architecture from the APK file? I'm guessing it's not trying to execute the binary or anything, it just checks the files meta data? If so, is there a place in the APK where this information is located? Or am I completely hitting blank here and I should look somewhere else? I appreciate all comments and tips. Thanks in advance. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: How to access shared preference outside of Activity
getSharedPreferences is defined in Context. Service is a Context also. On Jul 9, 9:08 am, Jeruliu jeru@gmail.com wrote: Dear all, I need to access the shared preference in a background service instead of activity on phone boot up. But getSharedPreferences function is define in the activity, so how can i access the data without creating the activity? Thanks. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: about library projects
Second one might be a bit more involved, but hopefully there is an easy fix. I have my projects into a subversion repository, but the app project builder (Android pre-compiler) seems to copy all the source from the library project, including the .svn folders, to the app/bin project. As a result of this, I get loads of files checked into the commit dialog, and I have uncheck all and then hunt down the files I actually changed. Is there any way to configure it to ignore .svn files when copying source? I realise that it has to merge source from both projects to create the final apk, but .svn files are surely not needed. At least this type of thing worked for me. 1. Delete the bin directory 2. Commit the delete changes to svn When you build your project the bin directory is recreated and it should now have the blue question mark (as telling not is svn) above the folder icon. Now you should be able to add the bin directory to svn:ignore. -- 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] AlarmManager problems in Milestone
Hi All, I'm having some strange behavior of wakeup alarms scheduled by AlarmManager in Motorola Milestone (Droid in US). The thing is that they don't wake the device as they should. The same piece of code works fine in Samsung Galaxy and the alarms are fired as they should fire. In Milesstone when the device is in sleep no alarms are fired but all the alarms are fired at once when the device wakes up. I also found out that Milestone doesn't have the /proc/wakelocks file to check the wake lock info but I'm not sure if that has something to do with the problem. For this scenario there is no reason to acquire a wakelock because the AlarmManager acquires it automatically for lifetime of the OnAlarmReceive. I found some other threads about the same problem in Droid/Milestone, but does anybody have an idea what is the problem and is there anyway to solve it. This is the code that I'm using to test this. /** * Broadcast receiver for the device boot * */ public class OnBootReceive extends BroadcastReceiver{ @Override public void onReceive(Context context, Intent intent) { Intent i = new Intent(context, OnAlarmReceive.class); PendingIntent pi = PendingIntent.getBroadcast(context, 0, i, 0); AlarmManager m = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE); m.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() +1, 5*60*1000, pi); } } /** * The alarm receiver * **/ public class OnAlarmReceive extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Log.d(AlarmTester, Alarm fired + new Date()); File log=new File(Environment.getExternalStorageDirectory(), AlarmTesterLog.txt); try { BufferedWriter out=new BufferedWriter(new FileWriter(log.getAbsolutePath(), log.exists())); out.write(Alarm fired + new Date().toString()); out.write(\n); out.close(); } catch (IOException e) { Log.e(AppService, Exception appending to log file, e); } } } -Mika -- 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] HashMap, ArrayList and fastest way to iterate Collections on Android (+other ways to make it run like a wild horse)
Simple question, what is the fastest way to iterate through collections on Android? I generally use collection.iterator(); and the iterator.next() to iterate through the whole collection. Is it any faster to drop that and iterate with old (and I use the term old loosely...) : for( int i=0; icollection.size(); i++) ? I was thinking of getting the collection.size() into a separate variable so I wouldn't be asking the collection it's size all the time so basically the for loop would turn into something like this: int size = collection.size(); for( int i=0; isize; i++ ) collection.get(i); Any better? Speed wise, I mean. I'm in a point where I need to get every possible inch of speed for my application. Or maybe allocate everything into Lists in the start, and once I know the correct amount of data, I turn all that into arrays and drop the Lists so I can have array[index] (Log(1) access, right? OH wait.. how did this go again _ ) access instead of having the slow method calls in between like .get(); when accessing the data in the collection. And what about getters setters for Classes? Like let's have a Vector2D class that contains obvious integer x and integer y values. What is the fastest way to access them inside the class? Have them as public and just straight Vector2D.x = someValue; or through getters and setters? I've had much debate with my tutor about this (working on my final year project) but not to get too much into details of it... Also all links for further Android application optimisation are more than welcome and greatly appreciated (I read the googles docs on this already). Plus if you have found some really good tricks / quirks on Android to punish the device even more so it runs faster, do share, do share. Heh. Please be gentle on me, I'm such a beginner in all things Android that I feel absolutely dumb as a boot for asking these kind of things. I come from strong C++ / Java background but getting the extra inch of speed for everything on Android is so different than optimizing code for PC side and not that you even have to do it on PC side that often. Fire away gents and ladies! -- 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: HashMap, ArrayList and fastest way to iterate Collections on Android (+other ways to make it run like a wild horse)
Thanks for the answers. I'll have to give those two a try. :) -- 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] Trying to get rid of my last few Long calculations in my game and completely turn it into FP format. System.currentTimeMillis() giving me a headache.
Like the topic of the thread says. In my game I would like to turn all the calculations into FP format. I can eliminate pretty much everything else but I still need to do the the following calculation in long format. Code: long t = this.lastUpdateTime - System.currentTimeMillis(); The value I get from this is the time passed since last frame, which is like.. two digit millisecond value, which naturally is more than good for FP stuff. After that calculation I turn the resulting value into FP integer and use it with the rest of my calculations but I'd like to get rid of that long calculation too. Any ideas how to go around this to do it in FP format? I mean, I'm pretty sure I cannot just go and do a normal conversion to FP format in this style: Code: int fpT = t * (116); because there is always the change that it'll overflow and as the numbers that System.currentTimeMillis() give out are BIG. So any advice how to keep the same accuracy of the timer but get rid of the long calculation and have it replaced with nice and fast FP calculation. Any advices on how to trim down the System.currentTimeMillis() or what ever to get around this are greatly appreciated. Cheers guys. -- 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: Trying to get rid of my last few Long calculations in my game and completely turn it into FP format. System.currentTimeMillis() giving me a headache.
OH sorry guys, my bad, I wasn't specific enough. I'm TRYING To shift myself into fixed point(FP) world and trying to get rid of the long calculations :) So.. does the topic make more sense now? Sorry for being such a numnum and not realising that FP = fixed point AND floating point. D'oh. But yeah, any help how to get rid of the remaining long calculation? -- 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: Any examples of displaying an information box when clicked on a map marker ?
To my knowledge there are no built in components to do this, but of course you can always put any view you want on top of the map activity. The way I do this is that I have my MapActivity layout defined something like ?xml version=1.0 encoding=UTF-8? FrameLayout xmlns:android=http://schemas.android.com/apk/res/ android android:layout_width=fill_parent android:layout_height=fill_parent RelativeLayout android:layout_width=fill_parent android:layout_height=fill_parent com.google.android.maps.MapView android:id=@+id/map android:layout_width=wrap_content android:layout_height=wrap_content android:enabled=true android:clickable=true android:apiKey=apiKey / /RelativeLayout com.android.MyPackage.MyCustomView android:id=@+id/bubble android:layout_width=wrap_content android:layout_height=wrap_content android:focusable=true android:focusableInTouchMode=true android:visibility=gone / /FrameLayout Where MyCustomView is the view that I want to display when a marker is pressed. Now in may Overlay subclass in the onTap method I do something like public boolean onTap(GeoPoint point, MapView map) { Point pxPoint = map.getProjection().toPixels(point, null); mListener.onItemClick(pxPoint); } here mListener is an instance of my MapActivity subclass where in the onItemClick method I draw my custom view... public void onItemClicked(Point point) { MyCustomView view = (MyCustomView)findViewById(R.id.bubble); view.layout(point.x, point.y, view.getWidht(), view.getHeight()); view.setVisibility(View.VISIBLE); view.invalidate(); } That's the basic idea. You might have to force the layout before drawing or set some limits to the view width and height, because getWidth() and getHeight() return 0 before the first layout. But I think you should get the basic idea how to do this... -Mika On Nov 16, 6:38 am, Timmah timrys...@gmail.com wrote: I am looking for code examples of how to draw a description box when clicking on a map marker. Something similar to google map's implementation -http://code.google.com/apis/maps/documentation/examples/icon-custom.html (Click on the marker to see an example) Much appreciated ! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL ES works fine on Emulator but on HTC Hero 1.5 it does not render vertices
Ah sorry for long response time. Anyway, I went back to the problem and started using GLSurfaceView instead and it works with the current setup. With the GLSurfaceView, where am I supposed to implement onTouchListener? Since if I make the starting activity to implement the onTouchListener, it never gets called on touch evens. Any tips what/where it should be implemented? Cheerio for all the tips. On 9 marras, 17:51, Robert Green rbgrn@gmail.com wrote: Ah, I didn't realize how you were initializing GL. I'm bad at the EGL config stuff which is why I just use GLSurfaceView. I'm wondering if your problem is there? Consider trying GLSurfaceView and let me know the results. Otherwise, you may want to debug your init to make sure that it's correctly initializing a GL context and surface on the device. On Nov 9, 6:35 am, Mika mts...@googlemail.com wrote: Hi Robert, Will do. Here goes. First part is the sizeChange() when Android screen size changes and it gets called when the application launches. I'd thought I'd paste in the EGL stuff too, not all of it but some of it since it kind of relates to the initialisation. But yeah, the problem still is there. Itworksfineon emulators but not on the actual device. All the code from below in PasteBin again for easier reading (http://pastebin.com/m484eafe6). //OPENGLINITIALISATION _screenWidth = w; _screenHeight = h; gl.glViewport(0, 0, _screenWidth, _screenHeight); gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_FASTEST); gl.glClearColor(0, 0, 1, 1); gl.glClear(GL10.GL_COLOR_BUFFER_BIT); gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); gl.glMatrixMode(GL10.GL_PROJECTION); // setupOpenGLworld coordinates to match screen coordinates GLU.gluOrtho2D(gl, 0, (float)_screenWidth, (float)_screenHeight, 0); // trying to match world coordinates to screen coordinates (tried using (int) too.. no changes :/) // BEFORE RENDERING: gl.glClear(GL10.GL_COLOR_BUFFER_BIT); gl.glMatrixMode(GL10.GL_MODELVIEW); gl.glLoadIdentity(); // EGL HELPER CLASS THAT TAKES CARE OF GETTING THE CONTEXT FOROPENGL AND ALL THAT SHAZAM private EGL10 _EGL; private EGLDisplay _display; private EGLSurface _surface; private EGLConfig _configs; private EGLContext _context; // EGL INIT int[] configSpec = { EGL10.EGL_DEPTH_SIZE, 0, EGL10.EGL_NONE }; _EGL = (EGL10) EGLContext.getEGL(); _display = _EGL.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY); int[] version = new int[2]; _EGL.eglInitialize(_display, version); EGLConfig[] configs = new EGLConfig[1]; int[] num_config = new int[1]; _EGL.eglChooseConfig(_display, configSpec, configs, 1, num_config); _configs = configs[0]; _context = _EGL.eglCreateContext(_display, _configs, EGL10.EGL_NO_CONTEXT, null); _surface = null; But yeah, if anyone knows what's going on or knows what I'm doing wrong I'd be mighty grateful. I feel pretty lost with this one. Cheers again guys. On 9 marras, 00:14, Robert Green rbgrn@gmail.com wrote: I had a problem with Ortho on my phone vs on theemulatorat one point as well. Could you post more of your GL initialization code? My problem was something dumb like I was calling orthox using actual screen dimensions when I needed to either use fixed point there or use orthof. On Nov 8, 3:34 pm, Mika mts...@googlemail.com wrote: Hello everyone. Running into REALLY interesting problems withOpenGL ES. Basically when I start my program in 1.5 or 1.6emulator, itworks justfinebut on HTC Hero 1.5 it does not. The problem is that the vertices are not being rendered but the gl.glClear() command is working justfine. I followed in with the debugger and it does go into the rendering function and such but still not rendering the vertices... Here is the code in PasteBin (easier to read:http://pastebin.com/m706686e6 ) And here is the same thing pasted here: // VERTICE INIT int one = 65536; int half = one / 2; int vertices[] = { -half, -half, half, half, -half, half, -half, half, half, half, half, half } ByteBuffer vbb = ByteBuffer.allocateDirect(vertices.length * 4); vbb.order(ByteOrder.nativeOrder()); mVertexBuffer = vbb.asIntBuffer(); mVertexBuffer.put(vertices); mVertexBuffer.position(0); // AND IN RENDER gl.glVertexPointer(3, GL10.GL_FIXED, 0, mVertexBuffer); gl.glColor4f(1, 0, 0, 1); gl.glScalef(50, 50, 1); gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, 4); Also I got my projection set in 2D ortho projection to match screen coordinates so that's why scale to 50,50 to actually make a bit bigger. I've tried using
[android-developers] Re: OpenGL ES works fine on Emulator but on HTC Hero 1.5 it does not render vertices
Oh wow, I was so blind, I was just forcefully trying to implement onTouch() instead of onTouchEvent(), as soon as I swapped it, it started to work. Phew... How blind can you became to your own code? =) Thank you guys. On 15 marras, 18:20, String sterling.ud...@googlemail.com wrote: On Nov 15, 1:27 pm, Mika mts...@googlemail.com wrote: With the GLSurfaceView, where am I supposed to implement onTouchListener? In myOpenGLapp, I use an onTouchEvent listener on the containing activity instead. Works for me. 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: OpenGL ES works fine on Emulator but on HTC Hero 1.5 it does not render vertices
Hi Robert, Will do. Here goes. First part is the sizeChange() when Android screen size changes and it gets called when the application launches. I'd thought I'd paste in the EGL stuff too, not all of it but some of it since it kind of relates to the initialisation. But yeah, the problem still is there. It works fine on emulators but not on the actual device. All the code from below in PasteBin again for easier reading ( http://pastebin.com/m484eafe6 ). // OPENGL INITIALISATION _screenWidth = w; _screenHeight = h; gl.glViewport(0, 0, _screenWidth, _screenHeight); gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_FASTEST); gl.glClearColor(0, 0, 1, 1); gl.glClear(GL10.GL_COLOR_BUFFER_BIT); gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); gl.glMatrixMode(GL10.GL_PROJECTION);// setup OpenGL world coordinates to match screen coordinates GLU.gluOrtho2D(gl, 0, (float)_screenWidth, (float)_screenHeight, 0); // trying to match world coordinates to screen coordinates (tried using (int) too.. no changes :/) // BEFORE RENDERING: gl.glClear(GL10.GL_COLOR_BUFFER_BIT); gl.glMatrixMode(GL10.GL_MODELVIEW); gl.glLoadIdentity(); // EGL HELPER CLASS THAT TAKES CARE OF GETTING THE CONTEXT FOR OPENGL AND ALL THAT SHAZAM private EGL10 _EGL; private EGLDisplay _display; private EGLSurface _surface; private EGLConfig _configs; private EGLContext _context; // EGL INIT int[] configSpec = { EGL10.EGL_DEPTH_SIZE, 0, EGL10.EGL_NONE }; _EGL = (EGL10) EGLContext.getEGL(); _display = _EGL.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY); int[] version = new int[2]; _EGL.eglInitialize(_display, version); EGLConfig[] configs = new EGLConfig[1]; int[] num_config = new int[1]; _EGL.eglChooseConfig(_display, configSpec, configs, 1, num_config); _configs = configs[0]; _context = _EGL.eglCreateContext(_display, _configs, EGL10.EGL_NO_CONTEXT, null); _surface = null; But yeah, if anyone knows what's going on or knows what I'm doing wrong I'd be mighty grateful. I feel pretty lost with this one. Cheers again guys. On 9 marras, 00:14, Robert Green rbgrn@gmail.com wrote: I had a problem with Ortho on my phone vs on the emulator at one point as well. Could you post more of your GL initialization code? My problem was something dumb like I was calling orthox using actual screen dimensions when I needed to either use fixed point there or use orthof. On Nov 8, 3:34 pm, Mika mts...@googlemail.com wrote: Hello everyone. Running into REALLY interesting problems with OpenGL ES. Basically when I start my program in 1.5 or 1.6 emulator, it works just fine but on HTC Hero 1.5 it does not. The problem is that the vertices are not being rendered but the gl.glClear() command is working just fine. I followed in with the debugger and it does go into the rendering function and such but still not rendering the vertices... Here is the code in PasteBin (easier to read:http://pastebin.com/m706686e6 ) And here is the same thing pasted here: // VERTICE INIT int one = 65536; int half = one / 2; int vertices[] = { -half, -half, half, half, -half, half, -half, half, half, half, half, half } ByteBuffer vbb = ByteBuffer.allocateDirect(vertices.length * 4); vbb.order(ByteOrder.nativeOrder()); mVertexBuffer = vbb.asIntBuffer(); mVertexBuffer.put(vertices); mVertexBuffer.position(0); // AND IN RENDER gl.glVertexPointer(3, GL10.GL_FIXED, 0, mVertexBuffer); gl.glColor4f(1, 0, 0, 1); gl.glScalef(50, 50, 1); gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, 4); Also I got my projection set in 2D ortho projection to match screen coordinates so that's why scale to 50,50 to actually make a bit bigger. I've tried using glDrawElements and glDrawArrays and nothing on the actual phone but works perfectly fine on the actual emulator. Any ideas where I might be going wrong? Why is the actual phone not rendering the vertices like the emulator is? Am I missing something completely here? -- 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] OpenGL ES works fine on Emulator but on HTC Hero 1.5 it does not render vertices
Hello everyone. Running into REALLY interesting problems with OpenGL ES. Basically when I start my program in 1.5 or 1.6 emulator, it works just fine but on HTC Hero 1.5 it does not. The problem is that the vertices are not being rendered but the gl.glClear() command is working just fine. I followed in with the debugger and it does go into the rendering function and such but still not rendering the vertices... Here is the code in PasteBin (easier to read: http://pastebin.com/m706686e6 ) And here is the same thing pasted here: // VERTICE INIT int one = 65536; int half = one / 2; int vertices[] = { -half, -half, half, half, -half, half, -half, half, half, half, half, half } ByteBuffer vbb = ByteBuffer.allocateDirect(vertices.length * 4); vbb.order(ByteOrder.nativeOrder()); mVertexBuffer = vbb.asIntBuffer(); mVertexBuffer.put(vertices); mVertexBuffer.position(0); // AND IN RENDER gl.glVertexPointer(3, GL10.GL_FIXED, 0, mVertexBuffer); gl.glColor4f(1, 0, 0, 1); gl.glScalef(50, 50, 1); gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, 4); Also I got my projection set in 2D ortho projection to match screen coordinates so that's why scale to 50,50 to actually make a bit bigger. I've tried using glDrawElements and glDrawArrays and nothing on the actual phone but works perfectly fine on the actual emulator. Any ideas where I might be going wrong? Why is the actual phone not rendering the vertices like the emulator is? Am I missing something completely here? -- 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: The mysterious disappearing progress bar...
I had a similar problem and it was just because the default progressbar had changed in Donut and it was all white. So I had a white progressbar in a white background. Not sure if that's your problem though. -Mika On Nov 4, 5:02 pm, dadical keyes...@gmail.com wrote: Anyone have a clue? I'm guessing it has something to do with changes in Donut related to buffering or optimizing display of Z-Order of views in relative layout, but maybe it's something simpler... I'm stacking: LinearLayout RelativeLayout VideoView (WRAP_CONTENT, WRAP_CONTENT, CENTER_IN_PARENT) ProgressBar (WRAP_CONTENT, WRAP_CONTENT, CENTER_IN_PARENT) TextView (WRAP_CONTENT, WRAP_CONTENT, BELOW(my progress bar)) I was counting on relative layout displaying the progress bar and the text view on top of the video view because they were added to the layout after the video view. That worked in 1.5, but stopped since 1.6. On Nov 2, 11:36 pm, dadical keyes...@gmail.com wrote: The following code used to render an indeterminate progress bar with a message below, all on top of a video view. Once the video was ready, the message and the progress bar would be made invisible. Ever since cupcake, the progress bar doesn't show at all. Anyone have any clues? dk private void setupView() { LinearLayout lLinLayout = new LinearLayout(this); lLinLayout.setId(1); lLinLayout.setOrientation(LinearLayout.VERTICAL); lLinLayout.setGravity(Gravity.CENTER); lLinLayout.setBackgroundColor(Color.BLACK); LayoutParams lLinLayoutParms = new LayoutParams (ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT); lLinLayout.setLayoutParams(lLinLayoutParms); this.setContentView(lLinLayout); RelativeLayout lRelLayout = new RelativeLayout(this); lRelLayout.setId(2); lRelLayout.setGravity(Gravity.CENTER); lRelLayout.setBackgroundColor(Color.BLACK); android.widget.RelativeLayout.LayoutParams lRelLayoutParms = new android.widget.RelativeLayout.LayoutParams (ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT); lRelLayout.setLayoutParams(lRelLayoutParms); lLinLayout.addView(lRelLayout); mVideoView = new VideoView(this); mVideoView.setId(3); android.widget.RelativeLayout.LayoutParams lVidViewLayoutParams = new android.widget.RelativeLayout.LayoutParams (ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); lVidViewLayoutParams.addRule(RelativeLayout.CENTER_IN_PARENT); mVideoView.setLayoutParams(lVidViewLayoutParams); lRelLayout.addView(mVideoView); mProgressBar = new ProgressBar(this); mProgressBar.setId(4); android.widget.RelativeLayout.LayoutParams lProgressBarLayoutParms = new android.widget.RelativeLayout.LayoutParams (ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); lProgressBarLayoutParms.addRule(RelativeLayout.CENTER_IN_PARENT); mProgressBar.setLayoutParams(lProgressBarLayoutParms); lRelLayout.addView(mProgressBar); mProgressMessage = new TextView(this); mProgressMessage.setId(5); android.widget.RelativeLayout.LayoutParams lProgressMsgLayoutParms = new android.widget.RelativeLayout.LayoutParams (ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); lProgressMsgLayoutParms.addRule (RelativeLayout.CENTER_HORIZONTAL); lProgressMsgLayoutParms.addRule(RelativeLayout.BELOW, 4); mProgressMessage.setLayoutParams(lProgressMsgLayoutParms); mProgressMessage.setTextColor(Color.LTGRAY); mProgressMessage.setTextSize(TypedValue.COMPLEX_UNIT_PT, 8); mProgressMessage.setText(...); lRelLayout.addView(mProgressMessage); } -- 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: Memory leak or feature
Thanks for everybody for helping me with this. I checked the memory also with a memory profiler and I suspect that it is SearchManager that is keeping a reference to the Activity. And it seems that SearchManager is created for default for all the apps even though it is never directly invoked. Anyway, I think I will also file a bug report, because there is something strange happening whether it is in the dev tools or in the platform. But my sample app is so simple that I'm positive it is not leaking anything. As it doesn't in 1.1 OS. The size of your process doesn't make it more likely to be killed. Okey, this I didn't know. I though that when the OS decides to kill processes in order to reclaim memory it does it so that the larger processes are killed first. My mistake, should read the docs more carefully. (4) My meminfo results were slightly different than what Mika reported at the beginning of this thread. When the Activity is the foreground my process had 14 views, 4 AppContexts, 2 ViewRoots, and 2 Activities. After the Activity was destroyed it had 7 views, 3 AppContexts, 1 ViewRoots, and 1 Activities. So SOMETHING happened but I don't know how to interpret theses numbers - why would there be so many views, etc. for a simple 1 TextView application? I have these same results if I start the activity close it from back button and then start it again. Anyway, thanks for help everybody. Now it's time to go to fight MapActivity memory problems =) -Mika On Oct 22, 3:31 am, jotobjects jotobje...@gmail.com wrote: That may be. In this test the memory usage by Dalvik reported by meminfo never decreased even though the JVM Runtime memory usage did fall when the Activity was destroyed. The main point is that there is not a close correspondence between memory usage reported by Linux process stats and JVM free memory. So meminfo is not the best way to detect application memory leaks. On Oct 21, 4:27 pm, Mark Murphy mmur...@commonsware.com wrote: My understanding was that Dalvik VM returned memory to the OS, but I may be mistaken. --~--~-~--~~~---~--~~ 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: Memory leak or feature
Thanks for the replies. I checked that finish() is called for the activity when the user presses the back button. why do you expect the system to close the Activity and free the memory Well basically because if I want to do some background processing (playing music, tracking location etc.) while the user is doing other things I would want my process to use memory as little as possible so that the system wouldn't kill it. But if my UI i.e. Activities stay in the memory even when they are not used it makes the background process more likely to be killed. I also tried using some memory extensive apps (Maps, Browser, Camera) but the system still didn't free the activities of my app. if you are somehow measuring things incorrectly. That might be the case. So here is a brief explanation. 1. The sample app that I'm running can be found from: http://users.tkk.fi/~mristima/android/service_test.tar 2. I start the app 3. To check the memory consumption I run: adb shell dumpsys meminfo com.android.service_test. 4. I press the back button 5. From DDMS I force GC for system_process and my app process 6. Finally I run adb shell dumpsys meminfo com.android.service_test again. Is there something wrong or strange here?? Also what is interesting, is that using android 1.1 (AVD) as a target, all the activities are freed from memory but in 1.5 they are not. I'm really baffled about this, so it would be great to have some kind of explanation for this, or to understand what I'm doing wrong. -Mika On Oct 21, 1:10 am, Dianne Hackborn hack...@android.com wrote: I am pretty sure the standard music app doesn't leak, so I wonder if you are somehow measuring things incorrectly. On Fri, Oct 16, 2009 at 2:11 AM, Mika mika.ristim...@tkk.fi wrote: Hi Dianne, This is what I assumed also. Do you have any ideas where the leak could be in the sample app that I posted? I also checked the music player app with meminfo and it behaves similarly leaving activities in memory even after the ui is closed and system_process and com.android.music processes are GCed from DDMS. I also tested with 1.1 SDK and Emulator and there everything works as presumed and no activities stay in memory after they are closed. -Mika On Oct 15, 7:56 pm, Dianne Hackborn hack...@android.com wrote: If you press back and let the system finish the activity, all references to it will be gone, so though your process is there after it GCs the resources (views etc) associated with the activity should be gone. If you still see them after you know the process has GCed, then you have a leak in your app. On Thu, Oct 15, 2009 at 7:57 AM, String sterling.ud...@googlemail.com wrote: On Oct 15, 3:08 pm, Mika mika.ristim...@tkk.fi wrote: So the problem is quite simple. I start a Service from an Activity, the user presses back, the Activity goes away and the Service stays running in the background. However the activity (and it's views) still stay in memory. Feature. It's central to the Android architecture that activities aren't killed by the system until their resources are needed elsewhere. The idea, I think, is that if the user goes back into your activity before that happens, it's ready and waiting. Some good discussion of it in this thread: http://groups.google.com/group/android-developers/browse_thread/threa. .. String -- 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. -- 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: Memory leak or feature
So has anybody been able to test the sample app and found the leak. To me this seems a quite serious bug or I might have misunderstood some fundamental Android concept. But I doubt that it is desired behavior to leave Activities (or at least not its views) in memory when they are not used. -Mika On Oct 16, 12:11 pm, Mika mika.ristim...@tkk.fi wrote: Hi Dianne, This is what I assumed also. Do you have any ideas where the leak could be in the sample app that I posted? I also checked the music player app with meminfo and it behaves similarly leaving activities in memory even after the ui is closed and system_process and com.android.music processes are GCed from DDMS. I also tested with 1.1 SDK and Emulator and there everything works as presumed and no activities stay in memory after they are closed. -Mika On Oct 15, 7:56 pm, Dianne Hackborn hack...@android.com wrote: If you press back and let the system finish the activity, all references to it will be gone, so though your process is there after it GCs the resources (views etc) associated with the activity should be gone. If you still see them after you know the process has GCed, then you have a leak in your app. On Thu, Oct 15, 2009 at 7:57 AM, String sterling.ud...@googlemail.comwrote: On Oct 15, 3:08 pm, Mika mika.ristim...@tkk.fi wrote: So the problem is quite simple. I start a Service from an Activity, the user presses back, the Activity goes away and the Service stays running in the background. However the activity (and it's views) still stay in memory. Feature. It's central to the Android architecture that activities aren't killed by the system until their resources are needed elsewhere. The idea, I think, is that if the user goes back into your activity before that happens, it's ready and waiting. Some good discussion of it in this thread: http://groups.google.com/group/android-developers/browse_thread/threa... String -- 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] Basic game structuring with two threads?
Hello people. I've gone through several Android examples, tutorials and generally just played around with the system. Now I'm in a need of help concerning a making of a game for Android, more specifically structuring the design. I'm going to use OpenGL to render everything. Generally when I have programmed games on the PC side I've gone about it roughly in this manner: game_loop( running ) { updateInput(); updateGameLogic(); // enemies, objects, etc. stuff renderEverything(); } That's it in a nutshell, of course I've generally added interpolation of rendering. Basically having an if statement saying that if over X amount of time has passed do update and render as fast as possible with the interpolation. But how should I go about this on Android? Since doesn't OpenGL ES require a separate thread for itself and I really don't want to do my update stuff in onDraw() of the OpenGL thread. So any links, help or just generic tips where to look on how to build the structuring properly? Aiming to get it to look something like this: game_loop( running ) { readInput(); if( has 20ms passed ) { updateGameLogic(); // enemies, objects, etc. stuff } float t = calculate interpolation point based on time; renderEverything( t ); // this supposedly then ... calls the ... rendering thread? Which we cannot really call like a function.. ugh.. } Or is it done completely different on Android? How could I achieve the same effect/flow of events. But yeah kind of need a help to point me in the right direction on how to structure things on Android and from there I can take care of the rest. Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Memory leak or feature
Hi Dianne, This is what I assumed also. Do you have any ideas where the leak could be in the sample app that I posted? I also checked the music player app with meminfo and it behaves similarly leaving activities in memory even after the ui is closed and system_process and com.android.music processes are GCed from DDMS. I also tested with 1.1 SDK and Emulator and there everything works as presumed and no activities stay in memory after they are closed. -Mika On Oct 15, 7:56 pm, Dianne Hackborn hack...@android.com wrote: If you press back and let the system finish the activity, all references to it will be gone, so though your process is there after it GCs the resources (views etc) associated with the activity should be gone. If you still see them after you know the process has GCed, then you have a leak in your app. On Thu, Oct 15, 2009 at 7:57 AM, String sterling.ud...@googlemail.comwrote: On Oct 15, 3:08 pm, Mika mika.ristim...@tkk.fi wrote: So the problem is quite simple. I start a Service from an Activity, the user presses back, the Activity goes away and the Service stays running in the background. However the activity (and it's views) still stay in memory. Feature. It's central to the Android architecture that activities aren't killed by the system until their resources are needed elsewhere. The idea, I think, is that if the user goes back into your activity before that happens, it's ready and waiting. Some good discussion of it in this thread: http://groups.google.com/group/android-developers/browse_thread/threa... String -- 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] Memory leak or feature
Hi, So the problem is quite simple. I start a Service from an Activity, the user presses back, the Activity goes away and the Service stays running in the background. However the activity (and it's views) still stay in memory. Any ideas why is that?? I tested this with cupcake and G1. To reproduce I've made a simple program. The activity: package com.android.service_test; import android.app.Activity; import android.content.Intent; import android.os.Bundle; public class StartService extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); startService(new Intent(getApplication(), RunningService.class)); } } The service: package com.android.service_test; import android.app.Service; import android.content.Intent; import android.os.IBinder; public class RunningService extends Service { @Override public void onCreate() { super.onCreate(); } @Override public void onStart(Intent intent, int startId) { super.onStart(intent, startId); new Thread(new Runnable() { public void run() { while(true) { System.err.println(running); try { Thread.sleep(1000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } }).start(); } @Override public IBinder onBind(Intent intent) { // TODO Auto-generated method stub return null; } } Manifest: ?xml version=1.0 encoding=utf-8? manifest xmlns:android=http://schemas.android.com/apk/res/android; package=com.android.service_test android:versionCode=1 android:versionName=1.0 application android:icon=@drawable/icon android:label=@string/ app_name activity android:name=.StartService android:label=@string/app_name intent-filter action android:name=android.intent.action.MAIN / category android:name=android.intent.category.LAUNCHER / /intent-filter /activity service android:name=.RunningService / /application uses-sdk android:minSdkVersion=3 / /manifest With this sample the activity on foreground, meminfo gives ** MEMINFO in pid 633 [com.android.service_test] ** native dalvikothertotal size: 2368 2819 N/A 5187 allocated: 2364 2159 N/A 4523 free:3 660 N/A 663 (Pss): 562 786 928 2276 (shared dirty): 1132 3940 480 5552 (priv dirty): 488 556 864 1908 Objects Views:7ViewRoots:1 AppContexts:3 Activities:1 Assets:2AssetManagers:2 Local Binders:6Proxy Binders: 11 Death Recipients:0 OpenSSL Sockets:0 SQL heap:0 dbFiles:0 numPagers:0 inactivePageKB:0 activePageKB:0 And after the activity has been destroyed meminfo gives: ** MEMINFO in pid 633 [com.android.service_test] ** native dalvikothertotal size: 2380 2819 N/A 5199 allocated: 2353 2085 N/A 4438 free: 26 734 N/A 760 (Pss): 608 929 1065 2602 (shared dirty): 1088 3852 584 5524 (priv dirty): 544 712 768 2024 Objects Views:7ViewRoots:0 AppContexts:3 Activities:1 Assets:2AssetManagers:2 Local Binders:5Proxy Binders: 10 Death Recipients:0 OpenSSL Sockets:0 SQL heap:0 dbFiles:0 numPagers:0 inactivePageKB:0 activePageKB:0 And I remembered to force the garbage collector to system_process and to the app process. Any ideas what is happening here?? -Mika --~--~-~--~~~---~--~~ 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
[android-developers] Re: How to caculator the time?
Hi, but if I change the system time in //do something , how to caculator the spentTime? From the API docs: This method (System.currentTimeMillis()) shouldn't be used for measuring timeouts or other elapsed time measurements, as changing the system time can affect the results. Instead, see the SystemClock-class, SystemClock.uptimeMillis() in particular. -- Mika --~--~-~--~~~---~--~~ 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: outgoing sms
Yeah sure.. but I understood that the question was about notifications when the sms is not sent form within your own app. For example when the user uses the default messaging app to send an sms. -Mika On Oct 1, 9:13 am, kapnk...@gmail.com wrote: private void sendSMS(Stringhttp://www.google.com/search?hl=enq=allinurl%3AString+java.sun.comb...phoneNumber, Stringhttp://www.google.com/search?hl=enq=allinurl%3AString+java.sun.comb...message ) { Stringhttp://www.google.com/search?hl=enq=allinurl%3AString+java.sun.comb...SENT = SMS_SENT; Stringhttp://www.google.com/search?hl=enq=allinurl%3AString+java.sun.comb...DELIVERED = SMS_DELIVERED; PendingIntent sentPI = PendingIntent.getBroadcast(this, 0, new Intent(SENT), 0); PendingIntent deliveredPI = PendingIntent.getBroadcast(this, 0, new Intent(DELIVERED), 0); //---when the SMS has been sent--- registerReceiver(new BroadcastReceiver(){ @Override public void onReceive(Contexthttp://www.google.com/search?hl=enq=allinurl%3AContext+java.sun.com;...arg0, Intent arg1 ) { switch (getResultCode()) { case Activity.RESULT_OK: Toast.makeText(getBaseContext(), SMS sent, Toast.LENGTH_SHORT).show(); break; case SmsManager.RESULT_ERROR_GENERIC_FAILURE: Toast.makeText(getBaseContext(), Generic failure, Toast.LENGTH_SHORT).show(); break; case SmsManager.RESULT_ERROR_NO_SERVICE: Toast.makeText(getBaseContext(), No service, Toast.LENGTH_SHORT).show(); break; case SmsManager.RESULT_ERROR_NULL_PDU: Toast.makeText(getBaseContext(), Null PDU, Toast.LENGTH_SHORT).show(); break; case SmsManager.RESULT_ERROR_RADIO_OFF: Toast.makeText(getBaseContext(), Radio off, Toast.LENGTH_SHORT).show(); break; } } }, new IntentFilter(SENT)); //---when the SMS has been delivered--- registerReceiver(new BroadcastReceiver(){ @Override public void onReceive(Contexthttp://www.google.com/search?hl=enq=allinurl%3AContext+java.sun.com;...arg0, Intent arg1 ) { switch (getResultCode()) { case Activity.RESULT_OK: Toast.makeText(getBaseContext(), SMS delivered, Toast.LENGTH_SHORT).show(); break; case Activity.RESULT_CANCELED: Toast.makeText(getBaseContext(), SMS not delivered, Toast.LENGTH_SHORT).show(); break; } } }, new IntentFilter(DELIVERED)); SmsManager sms = SmsManager.getDefault(); sms.sendTextMessage(phoneNumber, null, message, sentPI, deliveredPI) ; ... ... . On Wed, Sep 30, 2009 at 3:45 PM, Mika mika.ristim...@tkk.fi wrote: Could you be a bit more specific?? I know you can register a broadcast receiver for incoming sms messages but to my knowledge there isn't a broadcast for outgoing sms messages. -Mika On Sep 30, 8:33 am, kapnk...@gmail.com wrote: yes you can add brodcast receiver to listen n show sms sent intent On Wed, Sep 30, 2009 at 10:33 AM, Nemat nemate...@gmail.com wrote: Hi, is it possibale to notify outgoing sms programmatically? Thanks Nemat --~--~-~--~~~---~--~~ 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: MapView Overlays
What you could try is to use just one instance of your Overlay subclass that includes all the 60 icons that you want to show on the map. -Mika On Oct 1, 4:08 pm, Ne0 liamjamesalf...@googlemail.com wrote: Not had any response, but my solution is to add a bit of intelligence to my activity to only add the overlays that would be displayed on the map currently visible by the map view. I have no idea about how the mapView goes about doing this, but it appears to be really slow at doing so. So i am going to let my activity take the strain and see if it makes it any better. Any thoughts on this issue are still greatly received. Liam On Sep 28, 2:51 pm, Ne0 liamjamesalf...@googlemail.com wrote: My problem is my MapView becoming very laggy and so non-responsive at times, that Android thinks its hit deadlock and tries to close it. I am adding 60 overlays to the map view and i originally thought that the icon size may be causing the problem by using up all the memory. When i decreased the overlay icon size, it did improve things, though it is still to slow to be usable. Has anyone experienced anything similar and have a workaround? There may be a better way of doing it other then extending the Hello MapView example. Any thoughts welcomed. Thanks, Liam --~--~-~--~~~---~--~~ 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: java.lang.OutOfMemoryError after orientation changed
From the stack trace it seems that your trying to allocate 160 MB of memory. And for one app the max heap size in Android is 16 Mb (if i remember correctly). That's why the outofmemoryerror. Don't know why are you allocating that much memory though?? -Mika On Oct 1, 3:43 pm, Stefan ebay-dah...@web.de wrote: Here my logcat: E/dalvikvm-heap( 961): Out of memory on a 167772196-byte allocation. I/dalvikvm( 961): main prio=5 tid=3 RUNNABLE I/dalvikvm( 961): | group=main sCount=0 dsCount=0 s=N obj=0x4001ab08 self=0xbc60 I/dalvikvm( 961): | sysTid=961 nice=0 sched=0/0 handle=-1343996920 I/dalvikvm( 961): at com.google.googlenav.map.Map.resize ((null):~-1) I/dalvikvm( 961): at com.google.android.maps.MapView.onMeasure (MapView.java:536) I/dalvikvm( 961): at android.view.View.measure(View.java:7703) I/dalvikvm( 961): at android.widget.RelativeLayout.measureChildHorizontal (RelativeLayout.java:569) I/dalvikvm( 961): at android.widget.RelativeLayout.onMeasure (RelativeLayout.java:361) I/dalvikvm( 961): at android.view.View.measure(View.java:7703) I/dalvikvm( 961): at android.widget.RelativeLayout.measureChild (RelativeLayout.java:554) I/dalvikvm( 961): at android.widget.RelativeLayout.onMeasure (RelativeLayout.java:377) I/dalvikvm( 961): at android.view.View.measure(View.java:7703) I/dalvikvm( 961): at android.view.ViewGroup.measureChildWithMargins (ViewGroup.java:2989) I/dalvikvm( 961): at android.widget.FrameLayout.onMeasure (FrameLayout.java:245) I/dalvikvm( 961): at android.view.View.measure(View.java:7703) I/dalvikvm( 961): at android.widget.LinearLayout.measureVertical (LinearLayout.java:464) I/dalvikvm( 961): at android.widget.LinearLayout.onMeasure (LinearLayout.java:278) I/dalvikvm( 961): at android.view.View.measure(View.java:7703) I/dalvikvm( 961): at android.view.ViewGroup.measureChildWithMargins (ViewGroup.java:2989) I/dalvikvm( 961): at android.widget.FrameLayout.onMeasure (FrameLayout.java:245) I/dalvikvm( 961): at android.view.View.measure(View.java:7703) I/dalvikvm( 961): at android.view.ViewRoot.performTraversals (ViewRoot.java:747) I/dalvikvm( 961): at android.view.ViewRoot.handleMessage (ViewRoot.java:1613) I/dalvikvm( 961): at android.os.Handler.dispatchMessage (Handler.java:99) I/dalvikvm( 961): at android.os.Looper.loop(Looper.java:123) I/dalvikvm( 961): at android.app.ActivityThread.main (ActivityThread.java:4203) I/dalvikvm( 961): at java.lang.reflect.Method.invokeNative(Native Method) I/dalvikvm( 961): at java.lang.reflect.Method.invoke(Method.java: 521) I/dalvikvm( 961): at com.android.internal.os.ZygoteInit $MethodAndArgsCaller.run(ZygoteInit.java:791) I/dalvikvm( 961): at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:549) I/dalvikvm( 961): at dalvik.system.NativeStart.main(Native Method) I/dalvikvm( 961): D/AndroidRuntime( 961): Shutting down VM W/dalvikvm( 961): threadid=3: thread exiting with uncaught exception (group=0x4001aa28) E/AndroidRuntime( 961): Uncaught handler: thread main exiting due to uncaught exception E/AndroidRuntime( 961): java.lang.OutOfMemoryError E/AndroidRuntime( 961): at com.google.googlenav.map.Map.resize (Unknown Source) E/AndroidRuntime( 961): at com.google.android.maps.MapView.onMeasure(MapView.java:536) E/AndroidRuntime( 961): at android.view.View.measure(View.java: 7703) E/AndroidRuntime( 961): at android.widget.RelativeLayout.measureChildHorizontal (RelativeLayout.java:569) E/AndroidRuntime( 961): at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:361) E/AndroidRuntime( 961): at android.view.View.measure(View.java: 7703) E/AndroidRuntime( 961): at android.widget.RelativeLayout.measureChild(RelativeLayout.java:554) E/AndroidRuntime( 961): at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:377) E/AndroidRuntime( 961): at android.view.View.measure(View.java: 7703) E/AndroidRuntime( 961): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:2989) E/AndroidRuntime( 961): at android.widget.FrameLayout.onMeasure (FrameLayout.java:245) E/AndroidRuntime( 961): at android.view.View.measure(View.java: 7703) E/AndroidRuntime( 961): at android.widget.LinearLayout.measureVertical(LinearLayout.java:464) E/AndroidRuntime( 961): at android.widget.LinearLayout.onMeasure(LinearLayout.java:278) E/AndroidRuntime( 961): at android.view.View.measure(View.java: 7703) E/AndroidRuntime( 961): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:2989) E/AndroidRuntime( 961): at android.widget.FrameLayout.onMeasure (FrameLayout.java:245) E/AndroidRuntime( 961): at android.view.View.measure(View.java: 7703) E/AndroidRuntime( 961): at android.view.ViewRoot.performTraversals
[android-developers] Re: outgoing sms
Could you be a bit more specific?? I know you can register a broadcast receiver for incoming sms messages but to my knowledge there isn't a broadcast for outgoing sms messages. -Mika On Sep 30, 8:33 am, kapnk...@gmail.com wrote: yes you can add brodcast receiver to listen n show sms sent intent On Wed, Sep 30, 2009 at 10:33 AM, Nemat nemate...@gmail.com wrote: Hi, is it possibale to notify outgoing sms programmatically? Thanks Nemat --~--~-~--~~~---~--~~ 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: System crash problems
Hi Dianne, thanks for the answer. Although the problem happens several times a day, I haven't still been able to find the reason for it nor the code to reproduce it. I'll file a bug report if I do find a way to constantly reproduce the bug. -Mika On Aug 26, 7:53 pm, Dianne Hackborn hack...@android.com wrote: A crash of the system process is by definition a bug on the platform. If you have code to reproduce this, please consider filing a bug report with the code so an engineer can look at it. On Wed, Aug 26, 2009 at 12:58 AM, Mika mika.ristim...@tkk.fi wrote: Hi, I have started to have strange problems that make the whole OS to restart. I have this stack trace: 08-21 14:43:15.128: WARN/dalvikvm(11513): threadid=15: thread exiting with uncaught exception (group=0x4000fe70) 08-21 14:43:15.128: ERROR/AndroidRuntime(11513): Uncaught handler: thread android.server.ServerThread exiting due to uncaught exception 08-21 14:43:15.128: ERROR/AndroidRuntime(11513): *** EXCEPTION IN SYSTEM PROCESS. System will crash. 08-21 14:43:15.228: ERROR/AndroidRuntime(11513): java.lang.IndexOutOfBoundsException: index=1 count=0 08-21 14:43:15.228: ERROR/AndroidRuntime(11513): at android.view.ViewGroup.addInArray(ViewGroup.java:1890) 08-21 14:43:15.228: ERROR/AndroidRuntime(11513): at android.view.ViewGroup.addViewInner(ViewGroup.java:1834) 08-21 14:43:15.228: ERROR/AndroidRuntime(11513): at android.view.ViewGroup.addView(ViewGroup.java:1711) 08-21 14:43:15.228: ERROR/AndroidRuntime(11513): at android.view.ViewGroup.addView(ViewGroup.java:1668) 08-21 14:43:15.228: ERROR/AndroidRuntime(11513): at com.android.server.status.StatusBarService.addNotificationView (StatusBarService.java:871) 08-21 14:43:15.228: ERROR/AndroidRuntime(11513): at com.android.server.status.StatusBarService.performAddUpdateIcon (StatusBarService.java:670) 08-21 14:43:15.228: ERROR/AndroidRuntime(11513): at com.android.server.status.StatusBarService$H.handleMessage (StatusBarService.java:615) 08-21 14:43:15.228: ERROR/AndroidRuntime(11513): at android.os.Handler.dispatchMessage(Handler.java:99) 08-21 14:43:15.228: ERROR/AndroidRuntime(11513): at android.os.Looper.loop(Looper.java:123) 08-21 14:43:15.228: ERROR/AndroidRuntime(11513): at com.android.server.ServerThread.run(SystemServer.java:357) 08-21 14:43:15.438: INFO/Process(11513): Sending signal. PID: 11513 SIG: 9 Any ideas is this a bug in the platform, or is it possible that the application I'm developing (or some other app in the device) is doing something that makes the whole system crash. I'm using 1.1 SDK but the device has 1.5. Could those compatibility issues be the reason for the crash?? -Mika -- 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] System crash problems
Hi, I have started to have strange problems that make the whole OS to restart. I have this stack trace: 08-21 14:43:15.128: WARN/dalvikvm(11513): threadid=15: thread exiting with uncaught exception (group=0x4000fe70) 08-21 14:43:15.128: ERROR/AndroidRuntime(11513): Uncaught handler: thread android.server.ServerThread exiting due to uncaught exception 08-21 14:43:15.128: ERROR/AndroidRuntime(11513): *** EXCEPTION IN SYSTEM PROCESS. System will crash. 08-21 14:43:15.228: ERROR/AndroidRuntime(11513): java.lang.IndexOutOfBoundsException: index=1 count=0 08-21 14:43:15.228: ERROR/AndroidRuntime(11513): at android.view.ViewGroup.addInArray(ViewGroup.java:1890) 08-21 14:43:15.228: ERROR/AndroidRuntime(11513): at android.view.ViewGroup.addViewInner(ViewGroup.java:1834) 08-21 14:43:15.228: ERROR/AndroidRuntime(11513): at android.view.ViewGroup.addView(ViewGroup.java:1711) 08-21 14:43:15.228: ERROR/AndroidRuntime(11513): at android.view.ViewGroup.addView(ViewGroup.java:1668) 08-21 14:43:15.228: ERROR/AndroidRuntime(11513): at com.android.server.status.StatusBarService.addNotificationView (StatusBarService.java:871) 08-21 14:43:15.228: ERROR/AndroidRuntime(11513): at com.android.server.status.StatusBarService.performAddUpdateIcon (StatusBarService.java:670) 08-21 14:43:15.228: ERROR/AndroidRuntime(11513): at com.android.server.status.StatusBarService$H.handleMessage (StatusBarService.java:615) 08-21 14:43:15.228: ERROR/AndroidRuntime(11513): at android.os.Handler.dispatchMessage(Handler.java:99) 08-21 14:43:15.228: ERROR/AndroidRuntime(11513): at android.os.Looper.loop(Looper.java:123) 08-21 14:43:15.228: ERROR/AndroidRuntime(11513): at com.android.server.ServerThread.run(SystemServer.java:357) 08-21 14:43:15.438: INFO/Process(11513): Sending signal. PID: 11513 SIG: 9 Any ideas is this a bug in the platform, or is it possible that the application I'm developing (or some other app in the device) is doing something that makes the whole system crash. I'm using 1.1 SDK but the device has 1.5. Could those compatibility issues be the reason for the crash?? -Mika --~--~-~--~~~---~--~~ 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] System crash problems
Hi, I have started to have strange problems that make the whole OS to restart. I have this stack trace: 08-21 14:43:15.128: WARN/dalvikvm(11513): threadid=15: thread exiting with uncaught exception (group=0x4000fe70) 08-21 14:43:15.128: ERROR/AndroidRuntime(11513): Uncaught handler: thread android.server.ServerThread exiting due to uncaught exception 08-21 14:43:15.128: ERROR/AndroidRuntime(11513): *** EXCEPTION IN SYSTEM PROCESS. System will crash. 08-21 14:43:15.228: ERROR/AndroidRuntime(11513): java.lang.IndexOutOfBoundsException: index=1 count=0 08-21 14:43:15.228: ERROR/AndroidRuntime(11513): at android.view.ViewGroup.addInArray(ViewGroup.java:1890) 08-21 14:43:15.228: ERROR/AndroidRuntime(11513): at android.view.ViewGroup.addViewInner(ViewGroup.java:1834) 08-21 14:43:15.228: ERROR/AndroidRuntime(11513): at android.view.ViewGroup.addView(ViewGroup.java:1711) 08-21 14:43:15.228: ERROR/AndroidRuntime(11513): at android.view.ViewGroup.addView(ViewGroup.java:1668) 08-21 14:43:15.228: ERROR/AndroidRuntime(11513): at com.android.server.status.StatusBarService.addNotificationView (StatusBarService.java:871) 08-21 14:43:15.228: ERROR/AndroidRuntime(11513): at com.android.server.status.StatusBarService.performAddUpdateIcon (StatusBarService.java:670) 08-21 14:43:15.228: ERROR/AndroidRuntime(11513): at com.android.server.status.StatusBarService$H.handleMessage (StatusBarService.java:615) 08-21 14:43:15.228: ERROR/AndroidRuntime(11513): at android.os.Handler.dispatchMessage(Handler.java:99) 08-21 14:43:15.228: ERROR/AndroidRuntime(11513): at android.os.Looper.loop(Looper.java:123) 08-21 14:43:15.228: ERROR/AndroidRuntime(11513): at com.android.server.ServerThread.run(SystemServer.java:357) 08-21 14:43:15.438: INFO/Process(11513): Sending signal. PID: 11513 SIG: 9 Any ideas is this a bug in the platform, or is it possible that the application I'm developing (or some other app in the device) is doing something that makes the whole system crash. I'm using 1.1 SDK but the device has 1.5. Could those compatibility issues be the reason for the crash?? -Mika --~--~-~--~~~---~--~~ 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: getView from CustomizedAdapter called several times
Hi, I'm having the same problem. Did you find any solutions?? -Mika On Jun 24, 7:39 pm, jabu jabu.j...@gmail.com wrote: Hi Everyone, I am implementing my ownadapterthat inherits from BaseAdapter (this is something very classic). Then when I start the activity that owns the listView binded to thisadapterI can see that the getView() method is called moretimesthan what the number of view actually available in the list. For instance, I do have 2 rows in my list and when I first set theadaptergetView is called 6times. Then If I make a call to notifyDataSetChanged(), getView is called 4times. I understand that when you scroll up and down getView must be called to generate or re use a view but I don't scroll up or down, I am really wondering why getView is called so many time. Thanks a lot in advance for your responses. Jabu My code just in case even though it is a pretty basic piece of code: public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder; if (convertView == null) { convertView = mInflater.inflate(R.layout.row_action, null); // Creates a view holder holder = new ViewHolder(); ... convertView.setTag(holder); } else { holder = (ViewHolder)convertView.getTag(); } holder.params.set return convertView; } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Is possible get notified when the user send an SMS or make a call
By browsing this mailing list and android source code. You can also use PackageManager to get the available content providers. If there's some other ways I'd like to know also. -Mika On Jun 10, 7:31 pm, Monkiki monk...@gmail.com wrote: Great, I will try it. Where can I find more info about these context:// uris? On Jun 10, 1:11 pm, Mika mika.ristim...@tkk.fi wrote: Hi, You can do this by using content providers. You can listen to changes in content://sms uri and for sent messages you go through content://sms/sent and find the new sent messages. You can do similar thing with call log or use PhoneStateListener and listen when the call is on hook, off hook and idle. -Mika On Jun 10, 1:42 pm, Monkiki monk...@gmail.com wrote: I've been searching the application permissions and I see no way to make an app to enable getting notified when the user send an SMS or make a phone call. How can I accomplish this task? Thanks in advance. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Is possible get notified when the user send an SMS or make a call
Hi, You can do this by using content providers. You can listen to changes in content://sms uri and for sent messages you go through content://sms/sent and find the new sent messages. You can do similar thing with call log or use PhoneStateListener and listen when the call is on hook, off hook and idle. -Mika On Jun 10, 1:42 pm, Monkiki monk...@gmail.com wrote: I've been searching the application permissions and I see no way to make an app to enable getting notified when the user send an SMS or make a phone call. How can I accomplish this task? Thanks in advance. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] GMail content provider
Hi, My question is quite simple, how to read the data from the GMail content provider. I can get the notify of changes in the GMail database by registering a ContentObserver for content://gmail-ls uri. Then I've been trying to read the following tables content://gmail-ls/messages and content://gmail-ls/unread/^i. But the Cursor that they return is always null. I also tried to register a broadcastReceiver with IntentFilter with Intent.ACTION_PROVIDER_CHANGED because the documentation says that GMail content provider broadcasts that intent, but the onReceive() method in the BroadcastReceiver is never called. Gmail.java can be found e.g. here http://www.google.co.in/codesearch/p?hl=en#uX1GffpyOZk/core/java/android/provider/Gmail.javaq=gmail.java I searched the mailing list and found several similar questions but no answers. So any other ideas?? -Mika --~--~-~--~~~---~--~~ 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 know when map has zoomed?
Hi all, I was wondering is there any way of knowing when the zoom animation in map view has ended?? After each zoom I need to calculate how far my overlays are from each other, but I haven't figured out yet how to know when the map has been zoomed. Is there any way to do that?? -Mika --~--~-~--~~~---~--~~ 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: HttpUrlConnection problem
I can't use DefaultHttpClient because I need to get the OutputStream for writing to the remote server. But anyway... I accidently got this working, by calling the method that starts the thread (where all HttpUrlConnection stuff is handled) from an Activity class. Before I had it in a class that implements the onClickListener interface. But I have no idea why it is working now correctly. -Mika On Apr 23, 9:39 pm, Streets Of Boston flyingdutc...@gmail.com wrote: I had a similar issue and i gave up. Instead i used the DefaultHttpClient class together with HttpPut/ HttpGet/HttpResponse classes. This works fine. On Apr 23, 5:50 am, Mika mika.ristim...@tkk.fi wrote: Hi all, I have a strange problem with HttpUrlConnection. I can send data (with POST), but the receiving succeeds only every second time or after a sufficiently long ( 5 min) pause between the sends. I basically start a new thread where the initialization of the HttpUrlConnection, writing/reading from output/input streams and closing the connection is done. If I don't close the input and the output streams the sending works correctly each time. Any suggestions where's the problem? The same problem was discussed in herehttp://groups.google.com/group/android-developers/browse_thread/threa... but no solution were found. -Mika --~--~-~--~~~---~--~~ 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] HttpUrlConnection problem
Hi all, I have a strange problem with HttpUrlConnection. I can send data (with POST), but the receiving succeeds only every second time or after a sufficiently long ( 5 min) pause between the sends. I basically start a new thread where the initialization of the HttpUrlConnection, writing/reading from output/input streams and closing the connection is done. If I don't close the input and the output streams the sending works correctly each time. Any suggestions where's the problem? The same problem was discussed in here http://groups.google.com/group/android-developers/browse_thread/thread/bc5454ffc71f77dc/837c09f4f1f750b2?lnk=gstq=getResponseCode#837c09f4f1f750b2 but no solution were found. -Mika --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---