Re: [android-developers] Re: Urgent-Help
Hello Kumar Bibek, Google Maps on your phone showing the current location i thing there is no problem in my phone. The GPS hasn been turned on in the first place. i think my code has some problem. here i am sending my code also, if u don't mind please check my code whether it's correct or not. this app using soap web services. thanks On Fri, Apr 9, 2010 at 11:22 AM, Kumar Bibek coomar@gmail.com wrote: Can you please elaborate your problem? Does your Google Maps on your phone able to find your location? If not, then you phone has a problem. It might be that the GPS hasn't been turned on in the first place. Thanks and Regards, Kumar Bibek On Apr 9, 10:48 am, subrat kumar panda evergreen.sub...@gmail.com wrote: Hello everybody, This is subrat.my app is showing latitude,longitude on emulator but not in Sony Xperia_x10. would you please anybody help me regarding this matter. it's very urgent , if anybody knows the solution please help me. Best Regards, Subrat Kumar Panda. Microaid dreamworks, kolkata, India. 09038025238. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject. -- 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 ThisGps.java Description: Binary data
[android-developers] how to read database of one application in another application using contentproviders
Hi, I implemented sqlitedatabase using content provider in one application. And created some tables and some data in that. By using another application how to read those database. I am doing in second application as a sql query by using Content uri what i used in application one. But it is throwing exception that read permissin is required. How to give those permissions is it in application1 or 2. Can anybody help me -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
[android-developers] Re: Multiple Listviews in single Activity?
I'm not wrong. But it seems you aren't wrong either! I was consulting the source. It's definitely a CheckedTextView. I just confirmed it with the Hierarchy Viewer; there's no discrepancy. But I definitely see the radio button icon. Here's what's going on: The layout: CheckedTextView xmlns:android=http://schemas.android.com/apk/res/ android android:id=@android:id/text1 android:layout_width=fill_parent android:layout_height=?android:attr/listPreferredItemHeight android:textAppearance=?android:attr/textAppearanceLarge android:gravity=center_vertical android:checkMark=?android:attr/listChoiceIndicatorSingle android:paddingLeft=6dip android:paddingRight=6dip / The applicable theme element: item name=listChoiceIndicatorSingle@android:drawable/btn_radio/ item And the drawable (a selector, as expected): selector xmlns:android=http://schemas.android.com/apk/res/android; item android:state_checked=true android:state_window_focused=false android:drawable=@drawable/btn_radio_on / item android:state_checked=false android:state_window_focused=false android:drawable=@drawable/btn_radio_off / item android:state_checked=true android:state_pressed=true android:drawable=@drawable/btn_radio_on_pressed / item android:state_checked=false android:state_pressed=true android:drawable=@drawable/btn_radio_off_pressed / item android:state_checked=true android:state_focused=true android:drawable=@drawable/btn_radio_on_selected / item android:state_checked=false android:state_focused=true android:drawable=@drawable/btn_radio_off_selected / item android:state_checked=false android:drawable=@drawable/ btn_radio_off / item android:state_checked=true android:drawable=@drawable/ btn_radio_on / /selector I didn't have the API demo on my device or in my Eclipse at the time, so I checked the source, especially since you cited the layout rather than the visual effect. So it can be a checkmark if you override the theme... It's completely unclear to me why both CheckedTextView and RadioButton exist. RadioButton seems to implement all the functionality of CheckedTextView, plus a bit more protocol due to CompoundButton. Does anyone have any idea why? On Apr 8, 7:01 pm, DonFrench dcfre...@gmail.com wrote: You are also wrong about simple_list_item_single_choice, the row template I cited in my post. If you don't believe me, run the ApiDemos example and choose View in the first list that appears, List in the one that follows, then 10. Single Choice List in the one that follows that. As I am sure you know, those round do-hickeys on the right side of every item in the list are Google's version of radio buttons. Notice that in the code for this activity, which follows, the row template ID is simple_list_item_single_choice, as I indicated. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
[android-developers] Re: multi-touch not working !!
How do you know you lifted them in the same order you put them down? Give your description, I'd expect to see both orders. There are known limitations of the multitouch implementation on all the Android phones out there now. But this doesn't seem to me to be one. Try carefully putting one finger down, then the other, drag, and then lift the FIRST finger, then the second. That should give you the ID[0] Up ID[1] Up sequence you're expecting here. Lifting the fingers in the other order should give you this sequence instead. Trying to do both at once, and you're not going to know which to expect. On Apr 8, 7:20 pm, ani anish198519851...@gmail.com wrote: I am getting this multi-touch events in my application for which the logs are shown below.Multitouch is not working in my application.Does it mean that there is some problem with framework or my application. Sequence:Just two fingers pressed to the screen,dragged and then lifted both. Inputdevice: ID[0] Down Inputdevice: ID[0] Down Inputdevice: ID[1] Up Inputdevice: ID[0] Up I think for the last event it should have been ID[1] instead of 0?? Am i right?Is it a framework problem or some problem with my application? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
[android-developers] Thread execution hiccups on Motorola Droid
Occasionally I see thread execution hiccups on my Motorola Droid (currently running 2.1 but I saw it with 2.0.1, too). Normally my dummy thread (full tilt, foreground, not doing *anything* else) runs in about 5-6mS. However, I see a second hump around 13-14mS and stragglers anywhere out to 80mS (typically around 35mS, though). What is going on? Why is this scheduling so non-deterministically? What is the solution? I could deal with a couple mS slower if it would get rid of those stragglers that exist the whole way out to 50-80mS. Thanks. If I run a single thread full tilt, I see execution times like the following (milliseconds:number of times seen): 04-09 00:40:06.450: VERBOSE/*(7177): Run ended ... dumping... 04-09 00:40:06.450: VERBOSE/CalcDelta:(7177): 5: 3915 04-09 00:40:06.457: VERBOSE/CalcDelta:(7177): 6: 6221 04-09 00:40:06.457: VERBOSE/CalcDelta:(7177): 7: 63 04-09 00:40:06.465: VERBOSE/CalcDelta:(7177): 8: 47 04-09 00:40:06.465: VERBOSE/CalcDelta:(7177): 9: 4 04-09 00:40:06.473: VERBOSE/CalcDelta:(7177): 10: 9 04-09 00:40:06.473: VERBOSE/CalcDelta:(7177): 11: 7 04-09 00:40:06.481: VERBOSE/CalcDelta:(7177): 12: 7 04-09 00:40:06.489: VERBOSE/CalcDelta:(7177): 13: 22 04-09 00:40:06.489: VERBOSE/CalcDelta:(7177): 14: 26 04-09 00:40:06.496: VERBOSE/CalcDelta:(7177): 15: 8 04-09 00:40:06.496: VERBOSE/CalcDelta:(7177): 16: 7 04-09 00:40:06.504: VERBOSE/CalcDelta:(7177): 17: 4 04-09 00:40:06.504: VERBOSE/CalcDelta:(7177): 18: 3 04-09 00:40:06.512: VERBOSE/CalcDelta:(7177): 19: 5 04-09 00:40:06.512: VERBOSE/CalcDelta:(7177): 21: 11 04-09 00:40:06.520: VERBOSE/CalcDelta:(7177): 22: 1 04-09 00:40:06.520: VERBOSE/CalcDelta:(7177): 23: 2 04-09 00:40:06.528: VERBOSE/CalcDelta:(7177): 25: 1 04-09 00:40:06.528: VERBOSE/CalcDelta:(7177): 26: 1 04-09 00:40:06.536: VERBOSE/CalcDelta:(7177): 27: 1 04-09 00:40:06.536: VERBOSE/CalcDelta:(7177): 29: 4 04-09 00:40:06.543: VERBOSE/CalcDelta:(7177): 30: 1 04-09 00:40:06.543: VERBOSE/CalcDelta:(7177): 36: 1 04-09 00:40:06.551: VERBOSE/CalcDelta:(7177): 37: 1 04-09 00:40:06.551: VERBOSE/CalcDelta:(7177): 40: 1 04-09 00:40:06.559: VERBOSE/CalcDelta:(7177): 45: 2 04-09 00:40:06.559: VERBOSE/CalcDelta:(7177): 47: 1 04-09 00:40:06.567: VERBOSE/CalcDelta:(7177): 53: 1 code import java.util.Random; import android.app.Activity; import android.os.Bundle; import android.os.SystemClock; import android.util.Log; public class Run extends Activity { private long entryMillis = SystemClock.uptimeMillis(); private long exitMillis = SystemClock.uptimeMillis(); private long startMillis = SystemClock.uptimeMillis(); long calcDeltaMillis[] = new long[1000]; long funcDeltaMillis[] = new long[1000]; long randomTime = 0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override protected void onResume() { super.onResume(); Thread t = new Thread() { public void run() { doTimingThread(); } }; t.start(); } void doTimingThread() { Random rg = new Random(); Log.v(*, Entering timing thread...); startMillis = SystemClock.uptimeMillis(); while(true) { entryMillis = SystemClock.uptimeMillis(); for(int ii=0; ii4000; ++ii) { randomTime += rg.nextInt(); } exitMillis = SystemClock.uptimeMillis(); calcDeltaMillis[(int)(exitMillis-entryMillis)] += 1; if (SystemClock.uptimeMillis() = startMillis + 6) { dumpAndEraseTables(); startMillis = SystemClock.uptimeMillis(); } } } public void dumpAndEraseTables() { Log.v(*, Run ended ... dumping...); for(int ii=0; ii1000; ++ii) { if (calcDeltaMillis[ii] != 0) { Log.v(CalcDelta:, String.format(%3d: %d, ii, calcDeltaMillis[ii])); calcDeltaMillis[ii] = 0; } } } @Override protected void onPause() { super.onPause(); } } /code -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
[android-developers] Re: Android OpenGL Game - App Architecture and Threading Logic
Hi, I had a lot of difficulties getting the threading and app lifecycle issues done, too. For my part, this was much more confusing than getting the actual game done. ;) The good thing is: you do not have to do too much for the render- and logic-thread separation because most of the rendering time is getting spent outside of your renderer's onDraw method. This is how I got this done: The Game itself is owned by the glSurfaceView renderer instance. the when the game starts (at onResume), I start an updatethread that is very simple an does something like while(bKeeprunning) { synchronized(Game.sInstance) { Game.sInstance.update(); } Thread.sleep(50); } I have to add that my game logic is doing only this: logic. The world gets simulated. This is done less than 10 times per second - this is why I can have it sleep for 50 ms. sleeping is important here to give the render thread time to do this (I don't remember the full method signature, but I think you know what I mean): onDrawGlFrame() { synchronized(Game.sInstance) { Game.sInstance.render(); } Thread.sleep(5); } I defined the updatethread as class inside of the Renderer because it is so small. This gave me a huge performance boost. Handling the app lifecycle is less easy (at least for me). On Apr 9, 3:09 am, Eddie Ringle ed...@eringle.net wrote: Surprisingly, I don't seem to have issues with the OpenGL side of things (which is very unusual), but my problems stem from getting a clear idea for app architecture and a few other problems. Right now, most tutorials on the net just describe the render portion. I know that when I create a GLSurfaceView and hook a Renderer into it, it uses it's own thread for rendering. I want to do logic operations and other gameplay stuff (like moving characters and whatnot) in it's own thread as well. Can anyone explain a good approach to this? I'm guessing the two threads will have to be synchronized (do logic, render, repeat), and limited based on time so that it performs smoothly across different devices. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
Re: [android-developers] Re: Call blocking application
We can't block incoming call using coding as we are not able to get Phone object. Phone object must to block incoming call. Using SDK we can register for incoming call events but we can't block it as we do not have Phone object which used to block incoming call. if you find any clue please let me know as i am also looking for some good solution. All the best. Thanks, Jitendra Kumar On Fri, Apr 9, 2010 at 7:22 AM, NoImJosh josh.n.willi...@gmail.com wrote: You will not be able to terminate the android phone process. Have you thought of implementing some other way to Block a call by, say, placing the phone on silent so it just doesn't ring when someone calls? Just a thought, but probably not what you're looking for. On Apr 6, 2:41 am, Abdul Qavi Paracha aqav...@gmail.com wrote: Hi I am developing a call blocking application for android. What i've achieved so far is that my application gets informed whenever there is some incoming call. Now i want my application to handle the incoming call instead of default android application. So for this, i am trying to kill the android phone process. Please tell me can i do so. If not, then how can i reject the incoming call.. Best regards, Abdul Qavi -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject. -- 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 achieve scale centerCrop with Activity windowBackground drawable
Hey all- I apologize in advance if the list receives two copies of this... I was having some issues with my Google account for the past few hours and it doesn't appear as if this post made it through. I am trying to display my splash screen image [I use the splash when fetching data from a Web API] as a windowBackground so it will come up instantly when the user starts the Activity rather than seeing the default theme background before an ImageView is loaded in. My problem is my image is 854x854 square [so it will look perfect and fill the screen on all production Android devices] and I need to use something like scaleType=centerCrop [this worked great on my ImageView but won't work when I try to apply it to the bitmap drawable I am using as my background. Here is the declaration of my drawable [/res/drawable/splash_bg.xml] (not including the XML doctype line) bitmap xmlns:android=http://schemas.android.com/apk/res/android; android:src=@drawable/grub_truck_splash / The image IS showing as the background, however it will not scale properly whether I use android:scaleType=centerCrop or android:gravity=clip_horizontal or android:gravity=clip_vertical [I can't tell how the latter two attributes are in any way useful.. they definitely do something but it's not quite visually pleasing... an explanation of these would be nice, just out of curiosity.] Any help would be great! Thanks, Nick -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
[android-developers] To close the virtual keyboard
Hi all, I am new in android, i need to close the virtual keyboard when user enter the Enter button in virtual keyboard. How to close it. Please help me. Thanks C.Rajesh -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
[android-developers] Re: To close the virtual keyboard
Read the Android blog posts on IMEs: http://android-developers.blogspot.com/search/label/Input%20methods On Apr 9, 9:51 am, rajesh chandrasekaran crajeshdanger...@gmail.com wrote: Hi all, I am new in android, i need to close the virtual keyboard when user enter the Enter button in virtual keyboard. How to close it. Please help me. Thanks C.Rajesh -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
[android-developers] Re: List View Item Strange Behavior
Ok thanks. I'll give that a try and see if it works On Apr 8, 6:57 pm, ~ TreKing treking...@gmail.com wrote: On Thu, Apr 8, 2010 at 4:42 AM, Binesy ross.bi...@gmail.com wrote: Why is this happening and how can I fix it? The ListView will re-use views it uses, as you see by the convertView. These are not guaranteed to be in the same order as you scroll the list and items are cycled, AFAIK. My guess is your items are being re-arranged and you're seeing the behavior you're seeing since you're not updating the tag on the button where you store in the index. I would recommend you completely update the view you're getting even if there is an existing convertView. In this case just do c.button.setTag(position) after the if / else clause instead of inside the if clause. --- -- TreKing - Chicago transit tracking app for Android-powered deviceshttp://sites.google.com/site/rezmobileapps/treking -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
[android-developers] help about new ContactsContract API
Hi, I try to use following code to insert a new contact into the ContactsProvider. But I cannot see it in the native Contacts application. Is there something wrong with my code? ContentValues values = new ContentValues(); values.put(RawContacts.ACCOUNT_TYPE, ); values.put(RawContacts.ACCOUNT_NAME, ); Uri rawContactUri = getContentResolver().insert(RawContacts.CONTENT_URI, values); long rawContactId = ContentUris.parseId(rawContactUri); values.clear(); values.put(Data.RAW_CONTACT_ID, rawContactId); values.put(Data.MIMETYPE, StructuredName.CONTENT_ITEM_TYPE); values.put(StructuredName.DISPLAY_NAME, test); getContentResolver().insert(Data.CONTENT_URI, values); BR Gibson -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
[android-developers] Re: Problem with Vertical Scroll Bar *thumb* in WebView !!!
Any clue guys - AJ On Apr 8, 9:40 am, AJ ajeet.invinci...@gmail.com wrote: My code is like that :- LinearLayout WebView TableLayout TableRow Button / Button / /TableRow /TableLayout /LinearLayout I don't know why the scroll thumb is not being calculated properly for first time. On Apr 8, 2:24 am, AJ ajeet.invinci...@gmail.com wrote: Hi Group, I have Linear Layout in which I show web-view at top and 2 buttons at the bottom. I load local HTML file from my asset folder and it loads properly. But it looks there is a some problem with the Vertical Scroll Bar *THUMB*, which appears quite big as the HTML page loads. But the thumb gets re-sized to its proper size when I press the down arrows key or touch the screen to scroll down the page. Does anybody encounter this problem before? What the wrong I am doing? here? Thanks, Ajeet Singh -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
[android-developers] Re: Best practise for storing app. Configuration
Excellent, I looked at that and was not sure if that fas able to share the settings between Servises and Activities.. I will look again Thanks Kim -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
[android-developers] Re: applying themes to views
Just to clarify/avoid a possible misunderstanding If you are using a WebView to do your album, rather than building it out of Android's widgets (as Nick suggests), then you CAN, of course, use CSS. The Android UI toolkit supports styles and themes, which act somewhat like CSS, but with a different set off capabilities, and are specified rather differently. It's not like Flex, where you can use CSS to style pretty much any element of your UI; you have to set it up and coordinate on both sides. I'm guessing you're probably not going want to dig into this. Flash should be coming to Android sometime late this year. Adobe seems to have prioritized getting it onto iPhone first (which wouldn't be at all surprising, were it not for the fact it took them so long to accomplish that in the first place). On Apr 8, 10:54 pm, patbenatar patbena...@gmail.com wrote: Flash: No. CSS: No. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
Re: [android-developers] Re: Accelerometer - direction of shake?
How much faster? On Apr 8, 2010 7:32 PM, BobG bobgard...@aol.com wrote: If you move the phone left and right when looking at the screen, thats moving in the x axis, so if you take sanples faster than you are shaking it, as ordained by Mr Nyquist, you will see the accel increasing, then slowing down, stopping, and accelerating back the other way. The info you asked for is in there... which way it goes first... +x direction or -x direction. -- You received this message because you are subscribed to the Google Groups Android Developers group... -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
[android-developers] Contacting Market Customers
I have an app which relies on a 3rd party service. I usually have about a 75% retention rate and good ratings all around. The other day the service my app uses had some technical difficulties. This caused my app to FC for many users and unfortunatley those are usually the customers that rank an App. I would like to contact the customers that purchased that day to explain what the problem was. Is this allowable by Google Checkout Terms? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
[android-developers] Re: [android-porting] 3GP audio support in Eclair
Followed by your comments , plz find my inline replies : On Fri, Apr 9, 2010 at 2:42 PM, Deva R r.deva...@gmail.com wrote: Hi, - have ever seen a file inside gallery or music app? after booting eclair for first time, i always have to wait like 5 minutes for mediascanner to finish loading files.. manually you can trigger like menu - Dev Tools - Mediascanner, and wait for /sdcard scan to complete.. Tried this MediaScanner to scan sdcard . .3gp not scanned though . - rename .3gp as like .mp4 and see if it gets played under gallery app.. i've tried this on a broken setup, where Music app will crash on opening.. renamed .3gp to .mp4 . test_n_3gp.mp4 also not detected in Music and Gallery app . - regarding command line testing, alsa_aplay can test raw and selected formats.. alsa_aplay sdcard/test_n_3gp.3gp gives Playing raw data 'sdcard/test_n_3gp.3gp' : Unsigned 8 bit, Rate 8000 Hz, Mono for 2 minutes and then exited . no sound yet . u can use mediaframework tests to test audio/video record/playback via command line (adb/shell) source location: ./frameworks/base/media/tests/MediaFrameworkTest build command: ./make mediaframeworktest sample test command to play amr ./adb shell am instrument -e class com.android.mediaframeworktest.functional.MediaPlayerApiTest#testAMRGetDuration -w com.android.mediaframeworktest/.MediaFrameworkTestRunner Tried this on minicom for device . output comes as : com.android.mediaframeworktest.functional.MediaPlayerApiTest: Failure in testAMRGetDuration: junit.framework.AssertionFailedError: AMR getDuration at com.android.mediaframeworktest.functional.MediaPlayerApiTest.testAMRGetDuration(MediaPlayerApiTest.java:101) at java.lang.reflect.Method.invokeNative(Native Method) at android.test.InstrumentationTestCase.runMethod(InstrumentationTestCase.java:205) at android.test.InstrumentationTestCase.runTest(InstrumentationTestCase.java:195) at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169) at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154) at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:449) at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1447) Test results for MediaFrameworkTestRunner=.F Time: 0.74 FAILURES!!! Tests run: 1, Failures: 1, Errors: 0 Thanks : Uander -Deva On Fri, Apr 9, 2010 at 10:31 AM, Uander uandro...@gmail.com wrote: I want to check if I m able to play those files in command line in Android . what is the command to play a .3gp audio file . ? Thanks : Uander On Thu, Apr 8, 2010 at 10:51 PM, Uander uandro...@gmail.com wrote: Thanks Deva . I am also using Eclair Android 2.0 . but donno what bad happened with my luck . Does anyone faced this problem if Yes please put some points here How to look around with this oor what all I should cross check on my file system / opencore / codecs etc ?. Thanks : Uander On Thu, Apr 8, 2010 at 8:13 AM, Deva R r.deva...@gmail.com wrote: Hi Uander, both the files were listed under Music app.., and plays fine for me. i use android eclair latest.., nothing much, but attached log from the exercise below.. -deva # cd /sdcard # ls te* test_n_3gp.3gp test_n_amr.amr # # # W/IInputConnectionWrapper( 1357): showStatusIcon on inactive InputConnection I/ActivityManager( 837): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x1020 cmp=com.android.music/.MusicBrowserActivity } I/ActivityManager( 837): Starting activity: Intent { act=android.intent.action.PICK dat= typ=vnd.android.cursor.dir/artistalbum flg=0x400 cmp=com.android.music/.ArtistAlbumBrowserActivity (has extras) } D/dalvikvm( 837): GC freed 18389 objects / 958944 bytes in 88ms I/ActivityManager( 837): Displayed activity com.android.music/.ArtistAlbumBrowserActivity: 413 ms (total 429 ms) E/MusicUtils( 1357): Trying to unbind for unknown Context E/gralloc ( 837): [unregister] handle 0x4ada60 still locked (state=4001) I/ActivityManager( 837): Starting activity: Intent { act=android.intent.action.PICK dat= typ=vnd.android.cursor.dir/track cmp=com.android.music/.TrackBrowserActivity (has extras) } I/ActivityManager( 837): Displayed activity com.android.music/.TrackBrowserActivity: 274 ms (total 274 ms) W/MediaPlayer( 1357): info/warning (1, 44) D/AudioMIO( 1307): Before: ADJ_CLK old clock -462 original correction 462 correction 462 new clock 0 D/AudioMIO( 1307): After: ADJ_CLK old clock -462 correction 462 new clock 0 D/AudioMIO( 1307): Before: ADJ_CLK old clock -461 original correction 461 correction 461 new clock 0 D/AudioMIO( 1307): After: ADJ_CLK old clock -461 correction 461 new clock 0 I/ActivityManager( 837): Starting activity: Intent { flg=0x400
Re: [android-developers] Service vs Singleton
ailinykh wrote: Hello, everybody! Android has such concept as a Service. It makes sense for interprocess communication. But if I need this service from Activities running in the same process regular singleton seems to be more convenient. No need to register, to bind. Are there any benefits to use service in the same process? Using a service gives you: 1. Less chance of garbage collection problems from failing to null out the singleton. 2. Automatic shutdown (versus no automatic shutdown with a singleton) 3. A Context (Service extends Context), whereas an arbitrary singleton will not be, and you need a Context a lot of the time I'm sure I could think of other reasons, but that's what the first 30 seconds of pondering turned up. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android Training in NYC: 4-6 June 2010: http://guruloft.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
[android-developers] How to let soft keyboard overlap the footer of window
Hi, My customer want soft keyboard can overlap the footer(menu bar) of window when showing up. We noticed soft keyboard squeeze the foreground window to smaller size when showing up. So we overrided onSizeChanged and set footer which is in linearlayout and below one webview to be GONE. But we got a black square where footer is and webview above was kept the same size as before. We guess onSizeChanged is not right place to do it and wonder if anybody has the resolution. Best Regards. James -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
Re: [android-developers] Re: how to get device's movement speed?
Well, if your just spinning the device on end, I would consider it's movement speed to be Zero. Your interested in angular velocity, which is not linear velocity. So the fact that 'velocity = distance/time' doesn't matter for this scenario. Instead of a linear measurement like miles per hour (mph), you'll want to determine revolutions per minute (rpm). So the real challenge is how do you take the information provided by the device, and determine rpm. I haven't played around with it but I would suspect you get accelerations on more than one axis due to rotational motion. Additionally, I would be surprised if you are able to obtain any useful information from the existing sensor. I haven't researched the hardware in the android devices, but I would suspect they are Linear Accelerometers. The device would need to be equipped with an Angular Accelerometer. However, if you are interested in calculating linear movement you'll need to do a little research on Numerical Analysis. You should find ways to perform calculus through mathematical techniques that are appropriate for situations that utilize the collection of actual data. FYI - If you look under OS/Sensors on the API Demos there are some spinny things and graphs to play with. J On Thu, Apr 8, 2010 at 7:41 PM, BobG bobgard...@aol.com wrote: Acceleration * time gives velocity. Accel * delta time gives delta velocity. You accumulate the deltas like this: velocity += deltavelocity. If you mult velocity * deltat you get delta position. Accumulate those to keep track of position. Thats how Inertial Navigation Systems flew ICBMs a couple 1000 miles back in the 60s. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] How to let soft keyboard overlap the footer of window
James Wang wrote: My customer want soft keyboard can overlap the footer(menu bar) of window when showing up. It should do that by default. Make sure you have android:windowSoftInputMode=adjustPan in your manifest for this activity. We noticed soft keyboard squeeze the foreground window to smaller size when showing up. That would occur if you have android:windowSoftInputMode=adjustResize in your manifest for this activity. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android App Developer Books: http://commonsware.com/books -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
[android-developers] Re: [android-porting] 3GP audio support in Eclair
On Fri, Apr 9, 2010 at 4:47 PM, Deva R r.deva...@gmail.com wrote: nothing looks positive yet., can you make sure 'ls /sdcard' is showing valid conent?? It shows all file including .3gp one as well : ls -l /sdcard audio bigplanet dcim images video MLO_working uImage uImage_Amit test2.3gp test_d_3gp.3gp test_d_amr.amr test_n_3gp.3gp junit.framework.AssertionFailedError: AMR getDuration at com.android.mediaframeworktest.functional.MediaPlayerApiTest.testAMRGetDuration(MediaPlayerApiTest.java:101) Assertionn is probably due to missing files., and i guess these MTS test file paths are hardcoded., can you place attached file in sdcard in below path and play?? /sdcard/mts_tests/media_api/music/test_amr_ietf.amr I have placed your test_amr_ietf.amr in /sdcard/mts_tests/media_api/music . now running command : am instrument -e class com.android.mediaframeworktest.functional.MediaPlayerApiTest#testAMRGetDuration -w com.android.m... says : com.android.mediaframeworktest.functional.MediaPlayerApiTest:NOHZ: local_softirq_pending 02 NOHZ: local_softirq_pending 02 NOHZ: local_softirq_pending 02 and it is not exiting . Thanks : Uander On Fri, Apr 9, 2010 at 4:38 PM, Uander uandro...@gmail.com wrote: Followed by your comments , plz find my inline replies : On Fri, Apr 9, 2010 at 2:42 PM, Deva R r.deva...@gmail.com wrote: Hi, - have ever seen a file inside gallery or music app? after booting eclair for first time, i always have to wait like 5 minutes for mediascanner to finish loading files.. manually you can trigger like menu - Dev Tools - Mediascanner, and wait for /sdcard scan to complete.. Tried this MediaScanner to scan sdcard . .3gp not scanned though . - rename .3gp as like .mp4 and see if it gets played under gallery app.. i've tried this on a broken setup, where Music app will crash on opening.. renamed .3gp to .mp4 . test_n_3gp.mp4 also not detected in Music and Gallery app . - regarding command line testing, alsa_aplay can test raw and selected formats.. alsa_aplay sdcard/test_n_3gp.3gp gives Playing raw data 'sdcard/test_n_3gp.3gp' : Unsigned 8 bit, Rate 8000 Hz, Mono for 2 minutes and then exited . no sound yet . u can use mediaframework tests to test audio/video record/playback via command line (adb/shell) source location: ./frameworks/base/media/tests/MediaFrameworkTest build command: ./make mediaframeworktest sample test command to play amr ./adb shell am instrument -e class com.android.mediaframeworktest.functional.MediaPlayerApiTest#testAMRGetDuration -w com.android.mediaframeworktest/.MediaFrameworkTestRunner Tried this on minicom for device . output comes as : com.android.mediaframeworktest.functional.MediaPlayerApiTest: Failure in testAMRGetDuration: junit.framework.AssertionFailedError: AMR getDuration at com.android.mediaframeworktest.functional.MediaPlayerApiTest.testAMRGetDuration(MediaPlayerApiTest.java:101) at java.lang.reflect.Method.invokeNative(Native Method) at android.test.InstrumentationTestCase.runMethod(InstrumentationTestCase.java:205) at android.test.InstrumentationTestCase.runTest(InstrumentationTestCase.java:195) at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169) at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154) at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:449) at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1447) Test results for MediaFrameworkTestRunner=.F Time: 0.74 FAILURES!!! Tests run: 1, Failures: 1, Errors: 0 Thanks : Uander -Deva On Fri, Apr 9, 2010 at 10:31 AM, Uander uandro...@gmail.com wrote: I want to check if I m able to play those files in command line in Android . what is the command to play a .3gp audio file . ? Thanks : Uander On Thu, Apr 8, 2010 at 10:51 PM, Uander uandro...@gmail.com wrote: Thanks Deva . I am also using Eclair Android 2.0 . but donno what bad happened with my luck . Does anyone faced this problem if Yes please put some points here How to look around with this oor what all I should cross check on my file system / opencore / codecs etc ?. Thanks : Uander On Thu, Apr 8, 2010 at 8:13 AM, Deva R r.deva...@gmail.com wrote: Hi Uander, both the files were listed under Music app.., and plays fine for me. i use android eclair latest.., nothing much, but attached log from the exercise below.. -deva # cd /sdcard # ls te* test_n_3gp.3gp test_n_amr.amr # # # W/IInputConnectionWrapper( 1357): showStatusIcon on inactive InputConnection I/ActivityManager( 837): Starting activity: Intent { act=android.intent.action.MAIN
[android-developers] Do Services *really* run in the Background?
I have a scenario where I start a Service from a splash screen. If I intentionally cause problems in that Service (such as an invalid port for the Socket connection) my UI Thread locks up. I have put a Timer in the Service, and have it perform logging at every tick. The Timer works from within the Service without flaw. So from that, I think I have determined that only the UI Thread is suffering. If I start a Service from an Activity and that Service has an issue (i.e. server connection problems), should that result in a lockup in the UI thread from which it was launched? Is there a technique for starting a Service and having it truly run in the background? Thanks, J -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
[android-developers] Reg: Layouts
Hello Everyone, I'm currently looking in to layouts. can anyone tell me which layout is the best layout to be used for all kind of applications. and Why? Thanks in Advance, Santha -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
Re: [android-developers] Do Services *really* run in the Background?
Jason LeBlanc wrote: I have a scenario where I start a Service from a splash screen. If I intentionally cause problems in that Service (such as an invalid port for the Socket connection) my UI Thread locks up. I have put a Timer in the Service, and have it perform logging at every tick. The Timer works from within the Service without flaw. So from that, I think I have determined that only the UI Thread is suffering. If I start a Service from an Activity and that Service has an issue (i.e. server connection problems), should that result in a lockup in the UI thread from which it was launched? All callbacks into the Service -- onCreate(), onStart(), onBind(), onDestroy(), etc. -- are called on the main application thread. This is the same behavior as is for activities, broadcast Receivers, etc. The problem is that background has two meanings. Services are automatically in the background visually (i.e., they are not on the screen). Services are *not* automatically in the background from a threading standpoint. Hence, you still will want to use AsyncTask, or IntentService, or manually-managed threads, to have work done off the main application thread. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android Online Training: 10-14 May 2010: http://onlc.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
Re: [android-developers] Do Services *really* run in the Background?
Have you tried launching a thread inside your Service and have your Service binded/started in the Application context? On Fri, Apr 9, 2010 at 5:23 AM, Jason LeBlanc jasonalebl...@gmail.comwrote: I have a scenario where I start a Service from a splash screen. If I intentionally cause problems in that Service (such as an invalid port for the Socket connection) my UI Thread locks up. I have put a Timer in the Service, and have it perform logging at every tick. The Timer works from within the Service without flaw. So from that, I think I have determined that only the UI Thread is suffering. If I start a Service from an Activity and that Service has an issue (i.e. server connection problems), should that result in a lockup in the UI thread from which it was launched? Is there a technique for starting a Service and having it truly run in the background? Thanks, J -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
Re: [android-developers] List View Item Strange Behavior
You are using convertView object which is a recycled view. On Thu, Apr 8, 2010 at 2:42 AM, Binesy ross.bi...@gmail.com wrote: Hi, I have been having some strange behavior when refreshing a listview from a button in a list item. Say you have a list of 4 items, indexes 0-3 and you click on item 4, and print the index. 3 is printed correctly, then i refresh the list. I click on item 4 again, but this time index 0 is printed, click again and we are back to 3. Why is this happening and how can I fix it? I have included some source below for you to have a look at how I have done this. Any help is much appreciated Binesy public class CrazyList extends Activity { private static final String TAG = CRAZY LIST; public class Item { public String name = null; public int counter = -1; public Item(String n) { name = n; counter = 0; } } private ArrayListItem names = null; private MyAdapter adapter = null; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); names = new ArrayListItem(); names.add(new Item(Ross)); names.add(new Item(Fred)); names.add(new Item(Bob)); names.add(new Item(Frank)); ListView list = (ListView)findViewById(R.id.ListView01); adapter = new MyAdapter(); list.setAdapter(adapter); } private void updateButtonText(int index) { names.get(index).counter++; adapter.notifyDataSetChanged(); } private class MyAdapter extends BaseAdapter { @Override public int getCount() { return names.size(); } @Override public Object getItem(int position) { return names.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { Container c = null; if(convertView == null) { convertView = View.inflate(getApplicationContext(), R.layout.item, null); c = new Container(); c.text = (TextView) convertView.findViewById(R.id.TextView01); c.button = (Button) convertView.findViewById(R.id.Button01); c.button.setTag(position); c.button.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { int number = (Integer)v.getTag(); Log.d(TAG, Button clicked is + number); updateButtonText(number); } }); convertView.setTag(c); } else c = (Container) convertView.getTag(); c.text.setText(names.get(position).name); c.button.setText(names.get(position).counter + ); return convertView; } public class Container { public TextView text = null; public Button button = null; } } } -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject. -- 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: real ip address
Thanks mscwd01 for answer, can you give example , code? thanks On Mar 30, 3:52 pm, mscwd01 mscw...@gmail.com wrote: The only way I found to do this was by opening a socket connection and reading the IP that way. I couldn't find a nice getIP() method. On Mar 30, 11:32 am,EnginArslan enginarsla...@gmail.com wrote: Hi All , Can I get real ip address of android phone Thanks -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
[android-developers] Re: Service vs Singleton
Using a service gives you: 1. Less chance of garbage collection problems from failing to null out the singleton. This one I don't understand. What do you mean? Andrey -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
[android-developers] Re: Android OpenGL Game - App Architecture and Threading Logic
I'm a bit confused. What exactly is Game.sInstance? And can you explain what the update() and render() methods do? (Well, I know what they _do_, but I do not know how they are doing it (pseudocode would work here).) My gameplay is probably going to be a bit bigger than what you have, so I don't think I'll be able to keep it inside the renderer class. On Apr 9, 4:27 am, Clankrieger tob...@googlemail.com wrote: Hi, I had a lot of difficulties getting the threading and app lifecycle issues done, too. For my part, this was much more confusing than getting the actual game done. ;) The good thing is: you do not have to do too much for the render- and logic-thread separation because most of the rendering time is getting spent outside of your renderer's onDraw method. This is how I got this done: The Game itself is owned by the glSurfaceView renderer instance. the when the game starts (at onResume), I start an updatethread that is very simple an does something like while(bKeeprunning) { synchronized(Game.sInstance) { Game.sInstance.update(); } Thread.sleep(50); } I have to add that my game logic is doing only this: logic. The world gets simulated. This is done less than 10 times per second - this is why I can have it sleep for 50 ms. sleeping is important here to give the render thread time to do this (I don't remember the full method signature, but I think you know what I mean): onDrawGlFrame() { synchronized(Game.sInstance) { Game.sInstance.render(); } Thread.sleep(5); } I defined the updatethread as class inside of the Renderer because it is so small. This gave me a huge performance boost. Handling the app lifecycle is less easy (at least for me). On Apr 9, 3:09 am, Eddie Ringle ed...@eringle.net wrote: Surprisingly, I don't seem to have issues with the OpenGL side of things (which is very unusual), but my problems stem from getting a clear idea for app architecture and a few other problems. Right now, most tutorials on the net just describe the render portion. I know that when I create a GLSurfaceView and hook a Renderer into it, it uses it's own thread for rendering. I want to do logic operations and other gameplay stuff (like moving characters and whatnot) in it's own thread as well. Can anyone explain a good approach to this? I'm guessing the two threads will have to be synchronized (do logic, render, repeat), and limited based on time so that it performs smoothly across different devices. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
Re: [android-developers] Re: Service vs Singleton
The singleton wont be killed by the system automatically like a service which could lead to GC problems On Fri, Apr 9, 2010 at 1:51 PM, ailinykh ailin...@gmail.com wrote: Using a service gives you: 1. Less chance of garbage collection problems from failing to null out the singleton. This one I don't understand. What do you mean? Andrey -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Service vs Singleton
Donal Rafferty wrote: The singleton wont be killed by the system automatically like a service which could lead to GC problems Correct. Objects held in static data members, or referenced from a static data member, will not be garbage collected. Hence, you need to remember to null out those static data member references. Services, on the other hand, will garbage collect automatically, assuming you do not put one in a static data member yourself. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android Training in US: 14-18 June 2010: http://bignerdranch.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
Re: [android-developers] Do Services *really* run in the Background?
Mark, I have tried moving the start Service call to a manually-managed thread within the Activity, but with the same results. The UI Thread still hangs when the Service attempts to connect to an invalid server. Agus, In the Service, I instanciate a Connection object from which the class extends a Thread. It's in the constructor of that the Connection class where I create a new Socket. Everything works properly when I feed that constructor a good IP and Port, the problem arises when I force that Socket to throw an exception. It seems like it takes longer than the ActivityManager is willing to wait for the exception to be thrown. I have no problems binding in the Application Context, when the Service starts up normally. Thanks, J On Fri, Apr 9, 2010 at 7:29 AM, Agus agus.sant...@gmail.com wrote: Have you tried launching a thread inside your Service and have your Service binded/started in the Application context? On Fri, Apr 9, 2010 at 5:23 AM, Jason LeBlanc jasonalebl...@gmail.comwrote: I have a scenario where I start a Service from a splash screen. If I intentionally cause problems in that Service (such as an invalid port for the Socket connection) my UI Thread locks up. I have put a Timer in the Service, and have it perform logging at every tick. The Timer works from within the Service without flaw. So from that, I think I have determined that only the UI Thread is suffering. If I start a Service from an Activity and that Service has an issue (i.e. server connection problems), should that result in a lockup in the UI thread from which it was launched? Is there a technique for starting a Service and having it truly run in the background? Thanks, J -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
Re: [android-developers] Do Services *really* run in the Background?
Jason LeBlanc wrote: I have tried moving the start Service call to a manually-managed thread within the Activity, but with the same results. The UI Thread still hangs when the Service attempts to connect to an invalid server. :: shrug :: If you think this is a bug in Android, create a sample project that demonstrates it and post it on http://b.android.com. Otherwise, you're doing something wrong. In the Service, I instanciate a Connection object from which the class extends a Thread. Are you saying that Connection extends Thread? It's in the constructor of that the Connection class where I create a new Socket. A Thread object is not on a separate OS thread until the Thread is called with start(). Notably, the Thread constructor is called on the thread of whoever invokes the constructor. Background work occurs on the Thread's run() method. You want to do the IP connection in the background. Hence, do not do it in a Thread constructor. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android Online Training: 10-14 May 2010: http://onlc.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
[android-developers] NPE in onItemClickListener
I have a (Multi)AutoCompleteTextView which uses an item click listener. I received a crash report which shows a NPE in onItemClick(). In onItemClick, I use the selected view (param #2 of the listener) to do manipulation to the text, but looking at the source code for AutoCompleteTextView and it has the following block: // Note that we don't have a View here, so we will need to // supply null. Hopefully no existing apps crash... mItemClickListener.onItemClick(list, null, completion.getPosition(), completion.getId()); Shouldn't the onItemClick listener always receive a non-null value for view? The docs (http://min.ie/3mr) say: view - The view within the AdapterView that was clicked (this will be a view provided by the adapter) Am I correct in assuming this is a bug? The stack trace can be seen here: http://paste2.org/p/765292 -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
[android-developers] 2nd phone line Line2 iPhone
Hello, Probably, you have heard of the iPhone application called Line2. In short, it gives an iPhone a second phone number and line complete with contacts list, voice mail, etc., etc. I have been working on an application in the same area for Android but have run into the system's security/permission barriers. I was wondering if anyone has thoughts as to how the Android security/ permission issues inherent when attempting to develop an application such as Line2 could be resolved. My hope is that on an open system such as Android, developing an application such as Line2 would not be harder than it is on a closed system such as the iPhone. Thanks. Alex Donnini -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
Re: [android-developers] 2nd phone line Line2 iPhone
alexdonnini wrote: Probably, you have heard of the iPhone application called Line2. In short, it gives an iPhone a second phone number and line complete with contacts list, voice mail, etc., etc. It is more generically referred to as voice over IP (VOIP). I was wondering if anyone has thoughts as to how the Android security/ permission issues inherent when attempting to develop an application such as Line2 could be resolved. What, specifically, do you feel are the Android security/permission issues inherent when attempting to develop a VOIP app? I ask because there are several VOIP apps for Android (such as Google Voice, Skype, SipDroid, and Fring, to name four off the top of my head). Hence, it would seem unlikely that there are Android security/permission issues in implementing a VOIP app, otherwise those apps would not exist. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android Consulting: http://commonsware.com/consulting -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
[android-developers] Re: 2nd phone line Line2 iPhone
Hi Mark, Did you actually take a look at Line2? If you have, would be interested in your more detailed feedback. I do not believe that any of the Android applications you mention performs the same functions as Line2. I may be mistaken but I do not believe that Line2 is simply a VOIP application. Based on my limited understanding (I could be wrong), Line2 actually manages calls either via ATT or the Internet (VOIP), i.e. works alongside/replaces the iPhone phone application. With regards to the security/permission barriers I refer to below, please refer to any attempt to access phone application related functions. Have you tried to do that in an application? If you have, which ones did you try to use? I am very interested in gaining a better understanding of how one could use phone application functions in one's own application (just like Line2 does on the iPhone). Thank you. Alex Donnini On Apr 9, 9:45 am, Mark Murphy mmur...@commonsware.com wrote: alexdonnini wrote: Probably, you have heard of the iPhone application called Line2. In short, it gives an iPhone a second phone number and line complete with contacts list, voice mail, etc., etc. It is more generically referred to as voice over IP (VOIP). I was wondering if anyone has thoughts as to how the Android security/ permission issues inherent when attempting to develop an application such as Line2 could be resolved. What, specifically, do you feel are the Android security/permission issues inherent when attempting to develop a VOIP app? I ask because there are several VOIP apps for Android (such as Google Voice, Skype, SipDroid, and Fring, to name four off the top of my head). Hence, it would seem unlikely that there are Android security/permission issues in implementing a VOIP app, otherwise those apps would not exist. -- Mark Murphy (a Commons Guy)http://commonsware.com|http://twitter.com/commonsguy Android Consulting:http://commonsware.com/consulting -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
Re: [android-developers] 2nd phone line Line2 iPhone
At least google voice isn't VOIP, and ISTR that neither is skype (although that may have changed with recent releases.) They both function by dialing special-use numbers (google voice uses http to set up a line to remote mapping, so that when you call 202-111-2345 gvoice connects you to 202-123-4567 and remaps the source #, etc. ISTR the skype app just phone-carded it - dial a generic access #, then dial codes to get connected..) Not familiar with sipdroid or fring, and as of 1.5 or so it became possible to manipulate the audio stream so they may well be proper sip clients now :) On Fri, Apr 9, 2010 at 9:45 AM, Mark Murphy mmur...@commonsware.com wrote: alexdonnini wrote: Probably, you have heard of the iPhone application called Line2. In short, it gives an iPhone a second phone number and line complete with contacts list, voice mail, etc., etc. It is more generically referred to as voice over IP (VOIP). I was wondering if anyone has thoughts as to how the Android security/ permission issues inherent when attempting to develop an application such as Line2 could be resolved. What, specifically, do you feel are the Android security/permission issues inherent when attempting to develop a VOIP app? I ask because there are several VOIP apps for Android (such as Google Voice, Skype, SipDroid, and Fring, to name four off the top of my head). Hence, it would seem unlikely that there are Android security/permission issues in implementing a VOIP app, otherwise those apps would not exist. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android Consulting: http://commonsware.com/consulting -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Urgent-Help
On Fri, Apr 9, 2010 at 12:48 AM, subrat kumar panda evergreen.sub...@gmail.com wrote: would you please anybody help me regarding this matter. it's very urgent First of all, why is this very urgent? Does someone's life depend on this? Along the same lines, please don't title posts Urgent-Help or anything along those lines. It doesn't give anyone any indication of what problem you're having, makes it harder to find your post later on if someone wanted to reference it, and makes you seem impatient, all of which will decrease your chances of getting a good answer. On Fri, Apr 9, 2010 at 1:02 AM, subrat kumar panda evergreen.sub...@gmail.com wrote: The GPS hasn been turned on in the first place. What does this mean? The GPS on your phone is off completely? That would be a problem. I took a quick look at your code and didn't see anything blatantly wrong. Put in more print statements and see if any of the status changed or provider enabled / disabled events are being called. - TreKing - Chicago transit tracking app for Android-powered devices http://sites.google.com/site/rezmobileapps/treking -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
[android-developers] Re: 2nd phone line Line2 iPhone
Understood but I am not interested in VOIP. I am interested in implementing phone application functions. Again, based on my limited understanding, Line2 is not just a VOIP application. It actually performs phone app functions and can let users pamek calls over the ATT network, but I could be wrong. As far as I know, in Android security/permission barriers prevent any application from using/implementing phone app functions. Thank you. Alex Donnini On Apr 9, 9:57 am, Disconnect dc.disconn...@gmail.com wrote: At least google voice isn't VOIP, and ISTR that neither is skype (although that may have changed with recent releases.) They both function by dialing special-use numbers (google voice uses http to set up a line to remote mapping, so that when you call 202-111-2345 gvoice connects you to 202-123-4567 and remaps the source #, etc. ISTR the skype app just phone-carded it - dial a generic access #, then dial codes to get connected..) Not familiar with sipdroid or fring, and as of 1.5 or so it became possible to manipulate the audio stream so they may well be proper sip clients now :) On Fri, Apr 9, 2010 at 9:45 AM, Mark Murphy mmur...@commonsware.com wrote: alexdonnini wrote: Probably, you have heard of the iPhone application called Line2. In short, it gives an iPhone a second phone number and line complete with contacts list, voice mail, etc., etc. It is more generically referred to as voice over IP (VOIP). I was wondering if anyone has thoughts as to how the Android security/ permission issues inherent when attempting to develop an application such as Line2 could be resolved. What, specifically, do you feel are the Android security/permission issues inherent when attempting to develop a VOIP app? I ask because there are several VOIP apps for Android (such as Google Voice, Skype, SipDroid, and Fring, to name four off the top of my head). Hence, it would seem unlikely that there are Android security/permission issues in implementing a VOIP app, otherwise those apps would not exist. -- Mark Murphy (a Commons Guy) http://commonsware.com|http://twitter.com/commonsguy Android Consulting:http://commonsware.com/consulting -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: 2nd phone line Line2 iPhone
alexdonnini wrote: Based on my limited understanding (I could be wrong), Line2 actually manages calls either via ATT or the Internet (VOIP), i.e. works alongside/replaces the iPhone phone application. It does not replace the iPhone phone application. It is just another application on the iPhone. Just like Fring, etc. on Android. Watch Line2's video on their home page and show me where they replace the iPhone phone application: http://www.line2.com/ With regards to the security/permission barriers I refer to below, please refer to any attempt to access phone application related functions. Have you tried to do that in an application? If you have, which ones did you try to use? I am very interested in gaining a better understanding of how one could use phone application functions in one's own application (just like Line2 does on the iPhone). You don't need any of that to implement Line2, just as Line2 did not need any of that to implement their iPhone app. alexdonnini wrote: Again, based on my limited understanding, Line2 is not just a VOIP application. Yes, it is. In fact, they even say they are VOIP on their comparison page: http://www.line2.com/voip-cell-comparison.aspx In the video, they are very careful to distinguish between calls they handle (over 3G/WiFi) and calls the iPhone handles (cellular voice). It actually performs phone app functions and can let users pamek calls over the ATT network, but I could be wrong. As ATT 3G data calls using VOIP, yes, it does. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android Consulting: http://commonsware.com/consulting -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
[android-developers] Re: Android OpenGL Game - App Architecture and Threading Logic
Another thought occurred to me. I'm more comfortable with the old- fashioned game loop, and I noticed I can turn off auto-rendering. I'll see if this works out instead. On Apr 9, 8:55 am, Eddie Ringle ed...@eringle.net wrote: I'm a bit confused. What exactly is Game.sInstance? And can you explain what the update() and render() methods do? (Well, I know what they _do_, but I do not know how they are doing it (pseudocode would work here).) My gameplay is probably going to be a bit bigger than what you have, so I don't think I'll be able to keep it inside the renderer class. On Apr 9, 4:27 am, Clankrieger tob...@googlemail.com wrote: Hi, I had a lot of difficulties getting the threading and app lifecycle issues done, too. For my part, this was much more confusing than getting the actual game done. ;) The good thing is: you do not have to do too much for the render- and logic-thread separation because most of the rendering time is getting spent outside of your renderer's onDraw method. This is how I got this done: The Game itself is owned by the glSurfaceView renderer instance. the when the game starts (at onResume), I start an updatethread that is very simple an does something like while(bKeeprunning) { synchronized(Game.sInstance) { Game.sInstance.update(); } Thread.sleep(50); } I have to add that my game logic is doing only this: logic. The world gets simulated. This is done less than 10 times per second - this is why I can have it sleep for 50 ms. sleeping is important here to give the render thread time to do this (I don't remember the full method signature, but I think you know what I mean): onDrawGlFrame() { synchronized(Game.sInstance) { Game.sInstance.render(); } Thread.sleep(5); } I defined the updatethread as class inside of the Renderer because it is so small. This gave me a huge performance boost. Handling the app lifecycle is less easy (at least for me). On Apr 9, 3:09 am, Eddie Ringle ed...@eringle.net wrote: Surprisingly, I don't seem to have issues with the OpenGL side of things (which is very unusual), but my problems stem from getting a clear idea for app architecture and a few other problems. Right now, most tutorials on the net just describe the render portion. I know that when I create a GLSurfaceView and hook a Renderer into it, it uses it's own thread for rendering. I want to do logic operations and other gameplay stuff (like moving characters and whatnot) in it's own thread as well. Can anyone explain a good approach to this? I'm guessing the two threads will have to be synchronized (do logic, render, repeat), and limited based on time so that it performs smoothly across different devices. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
Re: [android-developers] Contacting Market Customers
On Fri, Apr 9, 2010 at 6:01 AM, momojo jason.kah...@gmail.com wrote: Is this allowable by Google Checkout Terms? Did you, you know, read the terms? =P I haven't, but you do get a contact email with each purchase that I assume gets forwarded to the customers. I assume the point of this is for you to contact your customers, so I don't see how this would not be allowable. - TreKing - Chicago transit tracking app for Android-powered devices http://sites.google.com/site/rezmobileapps/treking -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
[android-developers] Re: NPE in onItemClickListener
What are you trying to do? Can you elaborate a little bit? I guess you want an Autocomplete textview that is capable of having multiple values, something like an email to field. If this is the case, you have a simpler solution. Just change the way, AutoCompleteTextView behaves. Here is an article that might help you. http://tech-droid.blogspot.com/2010/04/custom-autocomplete-for-android.html Thanks and Regards, Kumar Bibek On Apr 9, 6:35 pm, Al alcapw...@googlemail.com wrote: I have a (Multi)AutoCompleteTextView which uses an item click listener. I received a crash report which shows a NPE in onItemClick(). In onItemClick, I use the selected view (param #2 of the listener) to do manipulation to the text, but looking at the source code for AutoCompleteTextView and it has the following block: // Note that we don't have a View here, so we will need to // supply null. Hopefully no existing apps crash... mItemClickListener.onItemClick(list, null, completion.getPosition(), completion.getId()); Shouldn't the onItemClick listener always receive a non-null value for view? The docs (http://min.ie/3mr) say: view - The view within the AdapterView that was clicked (this will be a view provided by the adapter) Am I correct in assuming this is a bug? The stack trace can be seen here:http://paste2.org/p/765292 -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
Re: [android-developers] Do Services *really* run in the Background?
Mark, I'm almost certain that I'm doing something wrong. I would even dare to venture that I'm taking the wrong approach entirely. I don't know what I don't know. My plan for the Connection Service is to manage the connection to the remote server entirely in the background. I am planning for the Service to detect server availibility, handle Wifi - 3g transitions, bad server IP, etc. It works to keep the connection alive. No matter the status of the Connection, I want the Service to run in the background and provide a mechanism for the Activities that bind to it to check for a valid Connection. (static boolean?) Then I'll leave the responsiblity of taking the appropriate action for the User to the Activity. Additionally, if no Activities are bound to the Service, it provides information to the User via Notifications. Yes, the Connection extends Thread. If I start a Thread in an Activity, does that Thread need to complete execution before I can transition to the next Activity? Thanks, J On Fri, Apr 9, 2010 at 8:30 AM, Mark Murphy mmur...@commonsware.com wrote: Jason LeBlanc wrote: I have tried moving the start Service call to a manually-managed thread within the Activity, but with the same results. The UI Thread still hangs when the Service attempts to connect to an invalid server. :: shrug :: If you think this is a bug in Android, create a sample project that demonstrates it and post it on http://b.android.com. Otherwise, you're doing something wrong. In the Service, I instanciate a Connection object from which the class extends a Thread. Are you saying that Connection extends Thread? It's in the constructor of that the Connection class where I create a new Socket. A Thread object is not on a separate OS thread until the Thread is called with start(). Notably, the Thread constructor is called on the thread of whoever invokes the constructor. Background work occurs on the Thread's run() method. You want to do the IP connection in the background. Hence, do not do it in a Thread constructor. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android Online Training: 10-14 May 2010: http://onlc.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Do Services *really* run in the Background?
Jason LeBlanc wrote: Yes, the Connection extends Thread. Then be sure not to do anything time-consuming in the Connection constructor. Put the time-consuming stuff in run(). In this case, that includes opening your socket connection, because while it might not be time-consuming normally, it will be if it cannot resolve DNS, etc. If I start a Thread in an Activity, does that Thread need to complete execution before I can transition to the next Activity? No. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Warescription: Three Android Books, Plus Updates, One Low Price! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
Re: [android-developers] help about new ContactsContract API
You should either use real, existing account name and type or null for both. If you are inserting into a google account, you should also add it to the MyContacts group. On Apr 9, 2010 2:08 AM, Gibson zclgib...@gmail.com wrote: Hi, I try to use following code to insert a new contact into the ContactsProvider. But I cannot see it in the native Contacts application. Is there something wrong with my code? ContentValues values = new ContentValues(); values.put(RawContacts.ACCOUNT_TYPE, ); values.put(RawContacts.ACCOUNT_NAME, ); Uri rawContactUri = getContentResolver().insert(RawContacts.CONTENT_URI, values); long rawContactId = ContentUris.parseId(rawContactUri); values.clear(); values.put(Data.RAW_CONTACT_ID, rawContactId); values.put(Data.MIMETYPE, StructuredName.CONTENT_ITEM_TYPE); values.put(StructuredName.DISPLAY_NAME, test); getContentResolver().insert(Data.CONTENT_URI, values); BR Gibson -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject. -- 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] Same Title bar but different view below it?
Hi, In one of my Android Application I need to keep the title bar same but the view that is shown in the rest of the screen changes. So, I have taken different Activity for all the views that I need to show and set the title bar in every Activities onCreate method. Now, the problem is that I have a button in the title bar and need to perform certain action on its click event. Writing the same event handling code in every Activity class is very cumbersome. Is there any other way out that whenever there is a click event on that button of the title bar then we can have the same functionality without writing the same code in all the Activity classes. Can we use ViewGroup for that? I don't have much idea about ViewGroup. Is that possible with ViewGroup? If anyone knows the solution then please let me know. Thanks Regards Sunil -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
[android-developers] Re: MediRecorder query
check this file libmediaplayerservice/MediaRecorderClient.cpp. This client i guess gets called by libmediaplayerservice/ MediaPlayerService.cpp file which gets the object of MediaRecorderClient. In this file(MediaRecorderClient.cpp) we are creating the object of PV media and passing it to user to set the audio source for recording. This file has this call MediaRecorderClient::setAudioSource for setting the audio source. This call in-turn goes to PV framework(external/opencore/android) for setting the audio source. How your call IMediaRecorder-setAudioSource is mapped to MediaPlayerService.cpp file is left as an exercise for 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 To unsubscribe, reply using remove me as the subject.
Re: [android-developers] Same Title bar but different view below it?
javame_android wrote: In one of my Android Application I need to keep the title bar same but the view that is shown in the rest of the screen changes. So, I have taken different Activity for all the views that I need to show and set the title bar in every Activities onCreate method. Now, the problem is that I have a button in the title bar and need to perform certain action on its click event. Writing the same event handling code in every Activity class is very cumbersome. Is there any other way out that whenever there is a click event on that button of the title bar then we can have the same functionality without writing the same code in all the Activity classes. Step #1: Create a subclass of Activity that includes your button logic Step #2: Have your other activities subclass the class you created in step #1 -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy _The Busy Coder's Guide to *Advanced* Android Development_ Version 1.4 Available! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
[android-developers] dex.jar not loaded from SDK folder
I got the following error this morning: Unknown error: Unable to build: the file dex.jar was not loaded from the SDK folder! Everything was fine when I shut down last night, but this morning I get this error. I am at a loss as to what to do about it. Any suggestions? Running Eclipse Ganymede Eclipse SDK Version: 3.4.1 Build id: M20080911-1700 The project has minSDK=3, targetSDK=4 Android SDK installed: 0.9.6.v201002051504-24846 which appears to be the latest version. Have been developing in Android for over a year. Google Search wasn't helpful. Any suggestions would be much appreciated. Best Regards, Eric -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
[android-developers] HTML page on Android 2.1 browser renders very small
I have a bunch of pages that render normally on the Android 1.6 native browser as well as on the iphone Safari browser, but are heavily zoomed out and small by default on the Android 2.1 native browser. The pages are zoomed out by about 4x making them appear very small. Of course I can manually zoom in, but I dont want the users to have to deal with that. Anyone else face this issue, and is there a fix for this that doesn't break how it works on other browsers? thanks Jay -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
Re: [android-developers] Reg: Layouts
On Fri, Apr 9, 2010 at 7:26 AM, Santha nsd1...@gmail.com wrote: I'm currently looking in to layouts. Good for you! can anyone tell me which layout is the best layout to be used for all kind of applications. There is none. and Why? Because there is no best for all, only best for your particular need. Otherwise there would only be one Layout class. - TreKing - Chicago transit tracking app for Android-powered devices http://sites.google.com/site/rezmobileapps/treking -- 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: Same Title bar but different view below it?
Hi, Thanks for your fast response. I am just a bit confused by what you said. Suppose I have a Class A that has my button logic, then according to what I understood I need to 1. Create a subclass of A such as Class B extends A 2. Other activities subclass B such as Class C extends B If that's correct then why can't Class C directly extends A such as Class C extends A Please correct me if I am wrong. Thanks Regards Sunil -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
[android-developers] Re: Reg: Layouts
That sounds like a trick question ;). The best layout depends on the situation you are in, the context. There is no one best for all kind of applications. That said, RelativeLayout is often noted as the most robust layout because it can sometimes be used to replace multiple other types of layouts (still it's not the best all the time). http://android-developers.blogspot.com/2009/10/ui-framework-changes-in-android-16.html One thing I would recommend that not enough people use, regardless of what layouts you are working with, is the layoutopt tool. This is a tool that can help you detect common layout problems and lets you know how to resolve them. http://android-developers.blogspot.com/2009/11/optimize-your-layouts.html On Apr 9, 8:26 am, Santha nsd1...@gmail.com wrote: Hello Everyone, I'm currently looking in to layouts. can anyone tell me which layout is the best layout to be used for all kind of applications. and Why? Thanks in Advance, Santha -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
Re: [android-developers] 2nd phone line Line2 iPhone
On 04/09/2010 06:57 AM, Disconnect wrote: At least google voice isn't VOIP, and ISTR that neither is skype (although that may have changed with recent releases.) They both function by dialing special-use numbers (google voice uses http to set up a line to remote mapping, so that when you call 202-111-2345 gvoice connects you to 202-123-4567 and remaps the source #, etc. ISTR the skype app just phone-carded it - dial a generic access #, then dial codes to get connected..) Skype is VoTCP, more specifically (ick, but it's their NAT/firewall traversal mechanism). They have TDM gateways which you pay for but they're accessed via IP. They may have more access mechanisms these days, but that's what the original Skype did. Not familiar with sipdroid or fring, and as of 1.5 or so it became possible to manipulate the audio stream so they may well be proper sip clients now :) I've always been mystified why people consider voice a creature apart from everything else; it's just a media recorder hooked into media player transported by the net in real time. Sure it has complications -- like 3g's latency being horrible, and handoff considerations and cpu consumption for codecs, echo cancellation, comfort noise, etc -- but there's nothing really *new* about those things. If people approached it without thinking about telephony _at all_, they'd probably be a lot better off :) Mike On Fri, Apr 9, 2010 at 9:45 AM, Mark Murphy mmur...@commonsware.com mailto:mmur...@commonsware.com wrote: alexdonnini wrote: Probably, you have heard of the iPhone application called Line2. In short, it gives an iPhone a second phone number and line complete with contacts list, voice mail, etc., etc. It is more generically referred to as voice over IP (VOIP). I was wondering if anyone has thoughts as to how the Android security/ permission issues inherent when attempting to develop an application such as Line2 could be resolved. What, specifically, do you feel are the Android security/permission issues inherent when attempting to develop a VOIP app? I ask because there are several VOIP apps for Android (such as Google Voice, Skype, SipDroid, and Fring, to name four off the top of my head). Hence, it would seem unlikely that there are Android security/permission issues in implementing a VOIP app, otherwise those apps would not exist. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android Consulting: http://commonsware.com/consulting -- 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 mailto:android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com mailto:android-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Same Title bar but different view below it?
Hi, One more thing then when I need to display this subclasses, will they be displayed as we normally display one activity from another activity i.e. startActivity(intentObj). Please reply if anyone knows the solutions. Thanks regards Sunil -- 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: Android OpenGL Game - App Architecture and Threading Logic
I suggest you take a look at the open source Android game Replica Island. Chris Pruett (a Google employee and Android advocate) programmed it and I understand he uses a Thread for rendering, a Thread for game logic and a Thread for the Activity (life cycle, input etc...). He has a synchronization mechanism executed each frame to sync up the renderer and game logic Threads. Find it at http://code.google.com/p/replicaisland/ On Apr 9, 10:22 am, Eddie Ringle ed...@eringle.net wrote: Another thought occurred to me. I'm more comfortable with the old- fashioned game loop, and I noticed I can turn off auto-rendering. I'll see if this works out instead. On Apr 9, 8:55 am, Eddie Ringle ed...@eringle.net wrote: I'm a bit confused. What exactly is Game.sInstance? And can you explain what the update() and render() methods do? (Well, I know what they _do_, but I do not know how they are doing it (pseudocode would work here).) My gameplay is probably going to be a bit bigger than what you have, so I don't think I'll be able to keep it inside the renderer class. On Apr 9, 4:27 am, Clankrieger tob...@googlemail.com wrote: Hi, I had a lot of difficulties getting the threading and app lifecycle issues done, too. For my part, this was much more confusing than getting the actual game done. ;) The good thing is: you do not have to do too much for the render- and logic-thread separation because most of the rendering time is getting spent outside of your renderer's onDraw method. This is how I got this done: The Game itself is owned by the glSurfaceView renderer instance. the when the game starts (at onResume), I start an updatethread that is very simple an does something like while(bKeeprunning) { synchronized(Game.sInstance) { Game.sInstance.update(); } Thread.sleep(50); } I have to add that my game logic is doing only this: logic. The world gets simulated. This is done less than 10 times per second - this is why I can have it sleep for 50 ms. sleeping is important here to give the render thread time to do this (I don't remember the full method signature, but I think you know what I mean): onDrawGlFrame() { synchronized(Game.sInstance) { Game.sInstance.render(); } Thread.sleep(5); } I defined the updatethread as class inside of the Renderer because it is so small. This gave me a huge performance boost. Handling the app lifecycle is less easy (at least for me). On Apr 9, 3:09 am, Eddie Ringle ed...@eringle.net wrote: Surprisingly, I don't seem to have issues with the OpenGL side of things (which is very unusual), but my problems stem from getting a clear idea for app architecture and a few other problems. Right now, most tutorials on the net just describe the render portion. I know that when I create a GLSurfaceView and hook a Renderer into it, it uses it's own thread for rendering. I want to do logic operations and other gameplay stuff (like moving characters and whatnot) in it's own thread as well. Can anyone explain a good approach to this? I'm guessing the two threads will have to be synchronized (do logic, render, repeat), and limited based on time so that it performs smoothly across different devices.- Hide quoted text - - Show quoted text - -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] HTML page on Android 2.1 browser renders very small
On Fri, Apr 9, 2010 at 9:51 AM, Jay-andro jayan...@gmail.com wrote: Anyone else face this issue, and is there a fix for this that doesn't break how it works on other browsers? The new browser has a setting open pages in overview that was on by default for me. Do you have this enabled? It will zoom out to show most of the page when it first loads. - TreKing - Chicago transit tracking app for Android-powered devices http://sites.google.com/site/rezmobileapps/treking -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
[android-developers] Re: Where is the import android.hardware.CameraDevice
Most of the tutorials that use CameraDevice are from ~2007. CameraDevice was around pre-1.0, I believe. Currently you would use the Camera class and the callbacks around it, etc.: http://developer.android.com/reference/android/hardware/Camera.html. Here is a more recent tutorial (no idea if it's any good, just noticed the date and that it uses Camera): http://www.brighthub.com/mobile/google-android/articles/43414.aspx. On Apr 9, 1:14 am, saikiran n saikiran@gmail.com wrote: Hi , Iam trying to implement camera application in android. In several sites they used import android.hardware.CameraDevice; But when iam doing same import it is giving me error that it can't be resolved. In which sdk the CameraDevice class is defined. I tried 1.1,1.5,2.0,2.1 but it was not there Please help me Regards, Saikiran -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
[android-developers] Re: Service vs Singleton
Is there anything wrong about putting those background tasks on threads? That's how I've been doing it so far. I don't need these tasks to do any IPC and my Runnables already support Lifecycle logic (implemented by me initially for other java project) On Apr 9, 9:11 am, Mark Murphy mmur...@commonsware.com wrote: Donal Rafferty wrote: The singleton wont be killed by the system automatically like a service which could lead to GC problems Correct. Objects held in static data members, or referenced from a static data member, will not be garbage collected. Hence, you need to remember to null out those static data member references. Services, on the other hand, will garbage collect automatically, assuming you do not put one in a static data member yourself. -- Mark Murphy (a Commons Guy)http://commonsware.com|http://twitter.com/commonsguy Android Training in US: 14-18 June 2010:http://bignerdranch.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
[android-developers] Re: Same Title bar but different view below it?
Hi, I have been able to extend the class and get the button click event in the same Activity. But now there is another issue. I want to display images in Gallery from that button click but its not happening so if I click on that button from another activity. The onclick method is being called but its not changing the view to Gallery. If I click on that button from the main Activity in which there is the button logic then the Gallery view is being displayed. Can anyone let me know what is the problem? Thanks regards Sunil -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
[android-developers] Re: Android OpenGL Game - App Architecture and Threading Logic
It's pretty easy to do this: I use a World to write to and read from for the two sides. Makes networking nice too. My World has a simple lock. Only one thing can write to it or read from it at a time. in GameLogicThread: run() { while (!done) { // wait for renderer world.getLock(); // blocks update() world.releaseLock(); } } in Renderer: onDrawFrame() { world.getLock(); // blocks draw() world.releaseLock(); } On Apr 9, 3:27 am, Clankrieger tob...@googlemail.com wrote: Hi, I had a lot of difficulties getting the threading and app lifecycle issues done, too. For my part, this was much more confusing than getting the actual game done. ;) The good thing is: you do not have to do too much for the render- and logic-thread separation because most of the rendering time is getting spent outside of your renderer's onDraw method. This is how I got this done: The Game itself is owned by the glSurfaceView renderer instance. the when the game starts (at onResume), I start an updatethread that is very simple an does something like while(bKeeprunning) { synchronized(Game.sInstance) { Game.sInstance.update(); } Thread.sleep(50); } I have to add that my game logic is doing only this: logic. The world gets simulated. This is done less than 10 times per second - this is why I can have it sleep for 50 ms. sleeping is important here to give the render thread time to do this (I don't remember the full method signature, but I think you know what I mean): onDrawGlFrame() { synchronized(Game.sInstance) { Game.sInstance.render(); } Thread.sleep(5); } I defined the updatethread as class inside of the Renderer because it is so small. This gave me a huge performance boost. Handling the app lifecycle is less easy (at least for me). On Apr 9, 3:09 am, Eddie Ringle ed...@eringle.net wrote: Surprisingly, I don't seem to have issues with the OpenGL side of things (which is very unusual), but my problems stem from getting a clear idea for app architecture and a few other problems. Right now, most tutorials on the net just describe the render portion. I know that when I create a GLSurfaceView and hook a Renderer into it, it uses it's own thread for rendering. I want to do logic operations and other gameplay stuff (like moving characters and whatnot) in it's own thread as well. Can anyone explain a good approach to this? I'm guessing the two threads will have to be synchronized (do logic, render, repeat), and limited based on time so that it performs smoothly across different devices. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
[android-developers] Re: Service vs Singleton
On Apr 9, 8:11 am, Mark Murphy mmur...@commonsware.com wrote: Donal Rafferty wrote: The singleton wont be killed by the system automatically like a service which could lead to GC problems Correct. Objects held in static data members, or referenced from a static data member, will not be garbage collected. Hence, you need to remember to null out those static data member references. Services, on the other hand, will garbage collect automatically, assuming you do not put one in a static data member yourself. Why it should be garbage collected? It lives and dies with Application. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
Re: [android-developers] Re: Service vs Singleton
ailinykh wrote: On Apr 9, 8:11 am, Mark Murphy mmur...@commonsware.com wrote: Donal Rafferty wrote: The singleton wont be killed by the system automatically like a service which could lead to GC problems Correct. Objects held in static data members, or referenced from a static data member, will not be garbage collected. Hence, you need to remember to null out those static data member references. Services, on the other hand, will garbage collect automatically, assuming you do not put one in a static data member yourself. Why it should be garbage collected? It lives and dies with Application. Static data members live and die with the process by default, which is not the same as the lifespan of an Application object. If you want a static data member to live and die with the Application, then you need to null out the data member when the Application object is terminated. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Warescription: Three Android Books, Plus Updates, One Low Price! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
[android-developers] combining 1.5 and 1.6
Hi I'm wondering if it's possible to have an app that has a portion of its code implemented using Android 1.5 (API Level 3) and part using 1.6. (For example maybe implementing one of the app's activities in 1.6 while the overall app is in 1.5)? thanks much Brian -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
Re: [android-developers] Re: how to get device's movement speed?
I also thought getting angular movement from the accelerometer would be a problem. However, note that it provides *proper acceleration*. You can track the ambient gravitational field as a 3D vector. On Apr 9, 2010 4:55 AM, Jason LeBlanc jasonalebl...@gmail.com wrote: Well, if your just spinning the device on end, I would consider it's movement speed to be Zero. Your interested in angular velocity, which is not linear velocity. So the fact that 'velocity = distance/time' doesn't matter for this scenario. Instead of a linear measurement like miles per hour (mph), you'll want to determine revolutions per minute (rpm). So the real challenge is how do you take the information provided by the device, and determine rpm. I haven't played around with it but I would suspect you get accelerations on more than one axis due to rotational motion. Additionally, I would be surprised if you are able to obtain any useful information from the existing sensor. I haven't researched the hardware in the android devices, but I would suspect they are Linear Accelerometers. The device would need to be equipped with an Angular Accelerometer. However, if you are interested in calculating linear movement you'll need to do a little research on Numerical Analysis. You should find ways to perform calculus through mathematical techniques that are appropriate for situations that utilize the collection of actual data. FYI - If you look under OS/Sensors on the API Demos there are some spinny things and graphs to play with. J On Thu, Apr 8, 2010 at 7:41 PM, BobG bobgard...@aol.com wrote: Acceleration * time gives veloc... -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
[android-developers] Re: Service vs Singleton
On Apr 9, 11:07 am, Mark Murphy mmur...@commonsware.com wrote: ailinykh wrote: On Apr 9, 8:11 am, Mark Murphy mmur...@commonsware.com wrote: Donal Rafferty wrote: The singleton wont be killed by the system automatically like a service which could lead to GC problems Correct. Objects held in static data members, or referenced from a static data member, will not be garbage collected. Hence, you need to remember to null out those static data member references. Services, on the other hand, will garbage collect automatically, assuming you do not put one in a static data member yourself. Why it should be garbage collected? It lives and dies with Application. Static data members live and die with the process by default, which is not the same as the lifespan of an Application object. If you want a static data member to live and die with the Application, then you need to null out the data member when the Application object is terminated. First at all singleton could be a member of the application. Then it will garbage collected with application. But what I don't understand why lifespan of Application is not the same as process's lifespan. Process without application doesn't make any sense. As far as I understand one process runs one application. Is it correct? Andrey -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
Re: [android-developers] combining 1.5 and 1.6
BrianS wrote: Hi I'm wondering if it's possible to have an app that has a portion of its code implemented using Android 1.5 (API Level 3) and part using 1.6. (For example maybe implementing one of the app's activities in 1.6 while the overall app is in 1.5)? You can write to the 1.5 API, then use reflection or conditional class loading to use 1.6 classes, methods, fields, etc. The biggest area of potential trouble will be attempting to override 1.6 methods from an Activity or other manifest-registered component. Here is an example of a project using reflection: http://github.com/commonsguy/cw-android/tree/master/APIVersions/Tagger2/ Here is an example of a project using conditional class loading: http://github.com/commonsguy/cw-advandroid/tree/master/Contacts/Spinners/ -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 3.0 Available! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
[android-developers] Re: Android OpenGL Game - App Architecture and Threading Logic
Where do you store all your attributes, like player position? Currently I just have a GLQuad class that I use to create new quads, texture them, and manage position and velocity. Do you store them in World, and then each side can access them from the world object? Also, threading is new to me, so I really have no clue what a lock is. On Apr 9, 12:03 pm, Robert Green rbgrn@gmail.com wrote: It's pretty easy to do this: I use a World to write to and read from for the two sides. Makes networking nice too. My World has a simple lock. Only one thing can write to it or read from it at a time. in GameLogicThread: run() { while (!done) { // wait for renderer world.getLock(); // blocks update() world.releaseLock(); } } in Renderer: onDrawFrame() { world.getLock(); // blocks draw() world.releaseLock(); } On Apr 9, 3:27 am, Clankrieger tob...@googlemail.com wrote: Hi, I had a lot of difficulties getting the threading and app lifecycle issues done, too. For my part, this was much more confusing than getting the actual game done. ;) The good thing is: you do not have to do too much for the render- and logic-thread separation because most of the rendering time is getting spent outside of your renderer's onDraw method. This is how I got this done: The Game itself is owned by the glSurfaceView renderer instance. the when the game starts (at onResume), I start an updatethread that is very simple an does something like while(bKeeprunning) { synchronized(Game.sInstance) { Game.sInstance.update(); } Thread.sleep(50); } I have to add that my game logic is doing only this: logic. The world gets simulated. This is done less than 10 times per second - this is why I can have it sleep for 50 ms. sleeping is important here to give the render thread time to do this (I don't remember the full method signature, but I think you know what I mean): onDrawGlFrame() { synchronized(Game.sInstance) { Game.sInstance.render(); } Thread.sleep(5); } I defined the updatethread as class inside of the Renderer because it is so small. This gave me a huge performance boost. Handling the app lifecycle is less easy (at least for me). On Apr 9, 3:09 am, Eddie Ringle ed...@eringle.net wrote: Surprisingly, I don't seem to have issues with the OpenGL side of things (which is very unusual), but my problems stem from getting a clear idea for app architecture and a few other problems. Right now, most tutorials on the net just describe the render portion. I know that when I create a GLSurfaceView and hook a Renderer into it, it uses it's own thread for rendering. I want to do logic operations and other gameplay stuff (like moving characters and whatnot) in it's own thread as well. Can anyone explain a good approach to this? I'm guessing the two threads will have to be synchronized (do logic, render, repeat), and limited based on time so that it performs smoothly across different devices. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
[android-developers] Re: plotting Market sales - determining if your android work is profitable
Here it is for Android: http://code.google.com/p/chartdroid/wiki/MarketSalesPlotter On Apr 4, 12:35 pm, Lance Nanek lna...@gmail.com wrote: Neat. I wonder if the market API could be used to do graphs for free apps as well:http://code.google.com/p/android-market-api/ On Apr 4, 1:54 am, kostmo kos...@gmail.com wrote: I thought I'd share a script that I've been working on:http://www.anddev.org/viewtopic.php?p=30732 It lets you generate parameterizable histograms of Android Market sales by automatically downloading data from Google Checkout. Hope someone finds it useful. Karl -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
[android-developers] Re: OutOfMemoryError: how best to transfer large video files into a byte array?
Why are you reading the entire file into a byte array? That sounds right there like the OutOfMem error. public static byte[] getBytesFromFile(ContentResolver cR, String fileUriString) throws IOException { Uri tempuri = Uri.parse(fileUriString); InputStream is = cR.openInputStream(tempuri); byte[] b3 = readBytes(is); is.close(); return b3; } when you're about to do your multipart post just read a little, write a little. Buffer the sending process, you don't need to do multiple PUTs or POSTS (and rewrite your webserver) On Apr 8, 7:40 pm, Mark Murphy mmur...@commonsware.com wrote: Bob Kerns wrote: I'm a bit puzzled why the other respondents didn't pick up this, maybe I missed something in the discussion? But anyway, the basic flaw in your strategy is reading it all into memory at once. There's no need to do so, and that is ALWAYS going to impose a limit on the size of file you can handle, on any platform. I didn't miss it. OTOH, I was trying to scope my response into something that didn't mess up the original plan too much and stuck to things I knew worked with HttpClient. And, as previously noted, I'm short on sleep. :-( That has the fatal drawback that the camera will be tied up, and possibly blocked, if the server is too slow -- which is likely. I'm reasonably certain the Uri being handed back from the Intent will be to a file handled by the MediaStore, not live off the camera. I wonder why the multipart stuff was left out of the SDK? It's an oft-asked question with no known answer. -- Mark Murphy (a Commons Guy)http://commonsware.com|http://twitter.com/commonsguy Android 2.x Programming Books:http://commonsware.com/books -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
Re: [android-developers] Re: Service vs Singleton
ailinykh wrote: First at all singleton could be a member of the application. Then it will garbage collected with application. Then it is not a singleton. It is a data member of Application. As far as I understand one process runs one application. At a time, yes. However, when all components of an Android application are destroyed, the process is retained for a while in a pool, for reuse by another application. This saves CPU time and battery life, by avoiding forking a new process and setting up a new Dalvik VM. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 3.0 Available! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
[android-developers] Re: unable to open database file after OS upgrade
*bump* On Fri, Apr 2, 2010 at 12:53 PM, Mariano Kamp mariano.k...@gmail.comwrote: Hi, recently I very often get error reports from users that upgrade their OS. This includes at least 1.5, 1.6, 2.1 and custom ROMs. Anybody else seeing these? Any idea what to do about it? Cheers, Mariano One example: -- Time: Fri Mar 26 11:36:41 PDT 2010 -- Android Version: sdk=4, release=1.6, inc=21415 -- Memory free: 0.53MB total: 3.01MB max: 16.00MB -- Custom ROM: Stock Android -- Device: dream -- Model: T-Mobile G1 -- Stacktrace:(2135) java.lang.RuntimeException: Unable to get provider com.newsrob.AssetContentProvider: android.database .sqlite.SQLiteException: unable to open database file at android.app.ActivityThread.installProvider(ActivityThread.java:4112) at android.app.ActivityThread.installContentProviders(ActivityThread.java:3908) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:3867) at android.app.ActivityThread.access$2800(ActivityThread.java:116) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1831) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:123) at android.app.ActivityThread.main(ActivityThread.java:4203) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:521) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549) at dalvik.system.NativeStart.main(Native Method) Caused by: android.database.sqlite.SQLiteException: unable to open database file at android.database.sqlite.SQLiteDatabase.dbopen(Native Method) at android.database.sqlite.SQLiteDatabase.init(SQLiteDatabase.java:1584) at android.database .sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:638) at android.database .sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:659) at android.database .sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:652) at android.app.ApplicationContext.openOrCreateDatabase(ApplicationContext.java:482) at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:193) at android.database .sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:98) at com.newsrob.DB.init(DB.java:194) at com.newsrob.EntryManager.init(EntryManager.java:203) at com.newsrob.EntryManager.getInstance(EntryManager.java:822) at com.newsrob.AssetContentProvider.onCreate(AssetContentProvider.java:42) at android.content.ContentProvider.attachInfo(ContentProvider.java:697) at android.app.ActivityThread.installProvider(ActivityThread.java:4109) ... 12 more -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
Re: [android-developers] Re: unable to open database file after OS upgrade
Mariano Kamp wrote: *bump* What have you done to gather more info? For example, is the issue that the database is deleted, or that the database exists but somehow the permissions are messed up? On Fri, Apr 2, 2010 at 12:53 PM, Mariano Kamp mariano.k...@gmail.com mailto:mariano.k...@gmail.com wrote: Hi, recently I very often get error reports from users that upgrade their OS. This includes at least 1.5, 1.6, 2.1 and custom ROMs. Anybody else seeing these? Any idea what to do about it? Cheers, Mariano One example: -- Time: Fri Mar 26 11:36:41 PDT 2010 -- Android Version: sdk=4, release=1.6, inc=21415 -- Memory free: 0.53MB total: 3.01MB max: 16.00MB -- Custom ROM: Stock Android -- Device: dream -- Model: T-Mobile G1 -- Stacktrace:(2135) java.lang.RuntimeException: Unable to get provider com.newsrob.AssetContentProvider: android.database.sqlite.SQLiteException: unable to open database file at android.app.ActivityThread.installProvider(ActivityThread.java:4112) at android.app.ActivityThread.installContentProviders(ActivityThread.java:3908) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:3867) at android.app.ActivityThread.access$2800(ActivityThread.java:116) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1831) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:123) at android.app.ActivityThread.main(ActivityThread.java:4203) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:521) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549) at dalvik.system.NativeStart.main(Native Method) Caused by: android.database.sqlite.SQLiteException: unable to open database file at android.database.sqlite.SQLiteDatabase.dbopen(Native Method) at android.database.sqlite.SQLiteDatabase.init(SQLiteDatabase.java:1584) at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:638) at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:659) at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:652) at android.app.ApplicationContext.openOrCreateDatabase(ApplicationContext.java:482) at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:193) at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:98) at com.newsrob.DB.init(DB.java:194) at com.newsrob.EntryManager.init(EntryManager.java:203) at com.newsrob.EntryManager.getInstance(EntryManager.java:822) at com.newsrob.AssetContentProvider.onCreate(AssetContentProvider.java:42) at android.content.ContentProvider.attachInfo(ContentProvider.java:697) at android.app.ActivityThread.installProvider(ActivityThread.java:4109) ... 12 more -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy _The Busy Coder's Guide to *Advanced* Android Development_ Version 1.4 Available! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
Re: [android-developers] Re: OutOfMemoryError: how best to transfer large video files into a byte array?
Why are you reading the entire file into a byte array? That sounds right there like the OutOfMem error. Because it's the only way that I know to get from a content Uri to the byte array that I use to create the FilePart element of the multipart message. It is possible to create the FilePart element using a File object (this handles even a 50MB file successfully, though it takes around half an hour to create, so I don't fancy using it in practice). However, I can't work from a File object, because I have to use the content Uri that is returned by ACTION_VIDEO_CAPTURE. Originally I did pass a File Uri as extra output to ACTION_VIDEO_CAPTURE, but that unfortunately breaks the 'retake' and 'delete' buttons on the video camera. when you're about to do your multipart post just read a little, write a little. Buffer the sending process, Thanks, but please could you explain what you mean by that? Perhaps with an example? Mark warned that creating buffers tends to clog up memory. Indeed, after increasing the buffer size to 1MB, as he predicted, I can now handle files up to about 5MB. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
[android-developers] Calling close() on a Cursor that's backing a ListView
I'm using a SimpleCursorAdapter with ListView. I just noticed that calling AbstractCursor.close() in a non-UI thread will cause this exception: android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views. at android.view.ViewRoot.checkThread(ViewRoot.java:2462) at android.view.ViewRoot.requestLayout(ViewRoot.java:512) at android.view.View.requestLayout(View.java:7071) at android.view.View.requestLayout(View.java:7071) at android.view.View.requestLayout(View.java:7071) at android.view.View.requestLayout(View.java:7071) at android.view.View.requestLayout(View.java:7071) at android.widget.AbsListView.requestLayout(AbsListView.java:969) at android.widget.AdapterView $AdapterDataSetObserver.onInvalidated(AdapterView.java:811) at android.database.DataSetObservable.notifyInvalidated(DataSetObservable.java: 43) at android.widget.BaseAdapter.notifyDataSetInvalidated(BaseAdapter.java: 54) at android.widget.CursorAdapter $MyDataSetObserver.onInvalidated(CursorAdapter.java:391) at android.database.DataSetObservable.notifyInvalidated(DataSetObservable.java: 43) at android.database.AbstractCursor.deactivateInternal(AbstractCursor.java: 89) at android.database.AbstractCursor.close(AbstractCursor.java:108) Is this a bug or intentional? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
[android-developers] Re: Best practise for storing app. Configuration
Here's a static wrapper I implemented to get and set properties real easy package gubatron.android.util; import java.util.Arrays; import android.content.Context; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; /** * Convenience class to get or set preference values without dealing with Android's SharedPreferenes and the editor. * Licensed under LGPL. * * @author gubatron * * Examples: * * PrefUtils.setString(key, value) * * String value = PrefUtils.getString(key); * PrefUtils.getString(key, defaultValue); * * */ public final class PrefUtils { private static SharedPreferences PREFERENCES; private static Editor EDITOR; static { PREFERENCES = GlobalVariables.APP_CONTEXT.getSharedPreferences(GlobalConstants.PREFS_FILE_NAME, Context.MODE_PRIVATE); EDITOR = PREFERENCES.edit(); } public static String getString(String prefKeyName) { return getString(prefKeyName, null); } public static String getString(String prefKeyName, String defaultValue) { String result = PREFERENCES.getString(prefKeyName, defaultValue); if (result == null) return null; return result; } public static byte[] getByteArray(String prefKeyName) { return getByteArray(prefKeyName, null); } public static void setString(String prefKeyName, String value) { EDITOR.putString(prefKeyName,value); EDITOR.commit(); } public static byte[] getByteArray(String prefKeyName, String defaultValue) { String result = getString(prefKeyName, defaultValue); if (result == null) return null; return result.getBytes(); } public static void setByteArray(String prefKeyName, byte[] value) { EDITOR.putString(prefKeyName,new String(value)); EDITOR.commit(); } public static boolean getBoolean(String prefKeyName, boolean defaultValue) { return PREFERENCES.getBoolean(prefKeyName, defaultValue); } public static void setBoolean(String prefKeyName, boolean value) { EDITOR.putBoolean(prefKeyName,value); EDITOR.commit(); } public static int getInt(String prefKeyName, int defaultValue) { return PREFERENCES.getInt(prefKeyName, defaultValue); } public static void setInt(String prefKeyName, int value) { EDITOR.putInt(prefKeyName,value); EDITOR.commit(); } public static void clearSettings() { EDITOR.clear(); EDITOR.commit(); } public static void testPrefUtils() { clearSettings(); assert(getString(GlobalConstants.PREF_KEY_UUID)==null); byte[] macAddress = WifiUtils.getWiFiMACAddress(GlobalVariables.APP_CONTEXT); PrefUtils.setByteArray(GlobalConstants.PREF_KEY_UUID, macAddress); int macAddressChecksum = ByteUtils.tripleByteArrayToSmallInt(ByteUtils.getByteArrayChecksum(macAddress)); byte[] fetchedMacAddress = PrefUtils.getByteArray(GlobalConstants.PREF_KEY_UUID); int fetchedAddressChecksum = ByteUtils.tripleByteArrayToSmallInt(ByteUtils.getByteArrayChecksum(fetchedMacAddress)); Arrays.equals(macAddress, fetchedMacAddress); assert(macAddressChecksum == fetchedAddressChecksum); PrefUtils.setInt(test.int.key, Integer.MAX_VALUE); assert(Integer.MAX_VALUE == PrefUtils.getInt(test.int.key,0)); PrefUtils.setInt(test.int.key, Integer.MIN_VALUE); assert(Integer.MIN_VALUE == PrefUtils.getInt(test.int.key,0)); } } On Apr 9, 5:47 am, Kim Ras rask...@gmail.com wrote: Excellent, I looked at that and was not sure if that fas able to share the settings between Servises and Activities.. I will look again Thanks Kim -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
Re: [android-developers] how to read database of one application in another application using contentproviders
Android security does not allow reading another apps DB directly. You need to create a ContentProvider for that AFIAK. On Thu, Apr 8, 2010 at 11:26 PM, saikiran n saikiran@gmail.com wrote: Hi, I implemented sqlitedatabase using content provider in one application. And created some tables and some data in that. By using another application how to read those database. I am doing in second application as a sql query by using Content uri what i used in application one. But it is throwing exception that read permissin is required. How to give those permissions is it in application1 or 2. Can anybody help me -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
Re: [android-developers] Re: MediaRecorder: unsupported paramter
I am trying to create an application that streams video from android camera to a desktop. I am testing it in a Nexus One Device. I created a application based on the example of the file VideoCamera.java of Sipdroid and the file VideoCamera.java of Camera application. The difference between them, is that on Siproid the output of mMediaRecorder.setOutputFile is one socket and on the Camera is a file. Now I am trying to write the data from Camera to a file and later to the socket, but I am getting this error: ERROR/CameraInput(437): Unsupported parameter(x-pvmf/media-input-node/cap-config-interface;valtype=key_specific_value) ERROR/CameraInput(437): VerifiyAndSetParameter failed on parameter #0 I am looking for some fix to this, but until now no luck. Any help is appreciated. The code is in the links bellow: http://pastebin.com/yVQA1rTE http://pastebin.com/6gKdJv5h Regards, Rogerio 2010/1/28 3pei 333...@gmail.com I have encountered this too. On Jan 28, 7:11 am, Arron arro...@gmail.com wrote: I took the example from the API: MediaRecorder recorder = new MediaRecorder(); recorder.setAudioSource(MediaRecorder.AudioSource.MIC); recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP); recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); recorder.setOutputFile(PATH_NAME); recorder.prepare(); recorder.start(); // Recording is now started When I try to run this, I get the following: ERROR/audio_input(30): unsupported parameter: x-pvmf/media-input-node/ cap-config-interface;valtype=key_specific_value Anyone knows what's wrong? Additionally the code example in the dev guide is completely wrong. It uses code that don't even exist in the API. 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.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
[android-developers] Re: Send email in background
Just for anybody who comes across this link wondering the same thing, this worked for me: http://www.androidsnippets.org/snippets/166/ I only used a gmail account, but it worked. Good luck. On Apr 7, 8:32 am, RMD rmdel...@gmail.com wrote: Thanks for all the responses. I was just getting the phone toemail me gps data about were my phone has been. It might be easier to have it go to a web server and just log in to look at it. I figured as much about the spam possibilities I suppose it was mostly, I wonder if I can..., knowing that I will burn up a few hours trying it see it work. thanks again, Robert On Apr 5, 9:39 am, RMD rmdel...@gmail.com wrote: Is there and accepted way tosendanemailin thebackground? RMD -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
[android-developers] Re: Multiple Listviews in single Activity?
@Frank Weiss I understand the difference between the two. The problem that I was trying to solve is that the behavior differs when an item is selected by the user versus by the program. When selected by the user, the appearance changes to reflect its selected state but when selected by the program it does not. In my program I select an item in the list and expected that when I did so, the appearance (in my case lighting up the radio button) would reflect its state of selection, but it did not, hence my post. If you are wondering why I would programmatically select an item in a list, it is because I am rearranging the list based on user input (Move Up and Move Down buttons) and I want the original item that the user selected to stay selected and for its appearance to reflect its selected state. On Apr 8, 8:24 pm, Frank Weiss fewe...@gmail.com wrote: I kind of hate to butt into this laborious thread, but I want to add my 2 cents. @DonFrench: IMO you have confused the behavior and the appearance of radio buttons a bit. By behavior, I mean the underlying state of the control group. The behavior is clearly 1-of N (although none selected is another possible state). How that is displayed (appearance) is another matter. The default appearance on Android seems to be two concentric gray circles, with the inner one green to indicate the selected state. However, in principle, the appearance of the selected state can be of almost limitless and creative alternatives: 1) Bolded label 2) Drop shadow to indicate 3-D depressed state 3) Blinking text 4) Darker or lighter background, or different color 5) Arrow icon 6) Underlined label 7) Checkmark 8) Square box with checkmark 9) Open vs closed door icon 10) How about a detent dial, like on classic stereo gear source selectors etc. It's debatable whether a consistent appearance (or style) accross all Android applications is better than the latitude of creative design. I'm pretty sure that game developers want to have their own hallmarks. I think describing the problem in terms of the behavior instead of appearence and elaborate analogs would make the conversation about programming the darn things much easier. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
[android-developers] Re: OutOfMemoryError: how best to transfer large video files into a byte array?
I suppose when you say FilePart, you mean this org.apache.commons.httpclient.methods.multipart.FilePart I'm thinking along these lines after looking at that API (I haven't tested this) final File theFile = new File(yourFileLargerThan2Mb.ext); //Implement your own PartSource to feed your File PartSource partSource = new PartSource() { //this should return a buffered reader... right? public InputStream createInputStream() { return BufferedInputStream (new FileInputStream(theFile)); } //implement the other methods of the interface public String getFileName() { return theFile.getName(); } public long getLength() { return theFile.length();// although this might be how much is left on the stream, not sure. } } FilePart part = FilePart(theFileName, partSource); then use your part on your multipart request. On Apr 9, 12:43 pm, Anna Powell-Smith annapowellsm...@googlemail.com wrote: Why are you reading the entire file into a byte array? That sounds right there like the OutOfMem error. Because it's the only way that I know to get from a content Uri to the byte array that I use to create the FilePart element of the multipart message. It is possible to create the FilePart element using a File object (this handles even a 50MB file successfully, though it takes around half an hour to create, so I don't fancy using it in practice). However, I can't work from a File object, because I have to use the content Uri that is returned by ACTION_VIDEO_CAPTURE. Originally I did pass a File Uri as extra output to ACTION_VIDEO_CAPTURE, but that unfortunately breaks the 'retake' and 'delete' buttons on the video camera. when you're about to do your multipart post just read a little, write a little. Buffer the sending process, Thanks, but please could you explain what you mean by that? Perhaps with an example? Mark warned that creating buffers tends to clog up memory. Indeed, after increasing the buffer size to 1MB, as he predicted, I can now handle files up to about 5MB. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
Re: [android-developers] Calling close() on a Cursor that's backing a ListView
westmeadboy wrote: I'm using a SimpleCursorAdapter with ListView. I just noticed that calling AbstractCursor.close() in a non-UI thread will cause this exception: android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views. at android.view.ViewRoot.checkThread(ViewRoot.java:2462) at android.view.ViewRoot.requestLayout(ViewRoot.java:512) at android.view.View.requestLayout(View.java:7071) at android.view.View.requestLayout(View.java:7071) at android.view.View.requestLayout(View.java:7071) at android.view.View.requestLayout(View.java:7071) at android.view.View.requestLayout(View.java:7071) at android.widget.AbsListView.requestLayout(AbsListView.java:969) at android.widget.AdapterView $AdapterDataSetObserver.onInvalidated(AdapterView.java:811) at android.database.DataSetObservable.notifyInvalidated(DataSetObservable.java: 43) at android.widget.BaseAdapter.notifyDataSetInvalidated(BaseAdapter.java: 54) at android.widget.CursorAdapter $MyDataSetObserver.onInvalidated(CursorAdapter.java:391) at android.database.DataSetObservable.notifyInvalidated(DataSetObservable.java: 43) at android.database.AbstractCursor.deactivateInternal(AbstractCursor.java: 89) at android.database.AbstractCursor.close(AbstractCursor.java:108) Is this a bug or intentional? This is intentional. The Cursor is tied to the UI thread once you put it in a CursorAdapter and attach that CursorAdapter to an AdapterView (e.g., ListView). -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android Training in NYC: 4-6 June 2010: http://guruloft.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
Re: [android-developers] combining 1.5 and 1.6
Often easier is to build against the newest API you want to use, so you have full access to the newer XML attributes (which will be ignored by older platforms), and use any of a number of options for avoiding use of newer APIs on older platforms. There is a general blog post on dealing with backwards compatibility here: http://android-developers.blogspot.com/2009/04/backward-compatibility-for-android.html Also my recent post on the Service APIs makes use of a couple different strategies: http://android-developers.blogspot.com/2010/02/service-api-changes-starting-with.html On Fri, Apr 9, 2010 at 9:24 AM, Mark Murphy mmur...@commonsware.com wrote: BrianS wrote: Hi I'm wondering if it's possible to have an app that has a portion of its code implemented using Android 1.5 (API Level 3) and part using 1.6. (For example maybe implementing one of the app's activities in 1.6 while the overall app is in 1.5)? You can write to the 1.5 API, then use reflection or conditional class loading to use 1.6 classes, methods, fields, etc. The biggest area of potential trouble will be attempting to override 1.6 methods from an Activity or other manifest-registered component. Here is an example of a project using reflection: http://github.com/commonsguy/cw-android/tree/master/APIVersions/Tagger2/ Here is an example of a project using conditional class loading: http://github.com/commonsguy/cw-advandroid/tree/master/Contacts/Spinners/ -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 3.0 Available! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject. -- 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: AsyncTask : java.util.concurrent.RejectedExecutionException
Hi arnouf, I don't mean to butt in but I suspect this is a similar problem to something I saw before. In your ViewAdapter, I am assuming you are creating or using a View which is or contains an ImageView which you are trying to load the image contents for remotely. If you are always creating the view in your adapter, then it simplifies the process a lot but at a performance tradeoff since you won't get the View recycling that the ListView does for you. If you create only when the view passed into your adapter is null, and use the passed in View other times then you gain some performance, however now you have to sync the ImageViews to what is being displayed on the screen or else like you said, you may get images rendered in the incorrect cells of the list. So there are 2 problems, #1 For the AsyncTask, you can still use the AsyncTask, but stagger their execution (try using a handler on the UI thread to spawn the AsyncTask after a delay, via postDelay). #2 The Image Syncing problem, when you get the information back you should make sure the view that the task is loading the image for is not dirty. By dirty I mean that the ListView is still displaying that cell and it is the correct cell. It may have been recycled and passed back to your adapter as the user scrolled and you will end up out of sync. I have been storing the image url in the tag of the image view and on a successful image load comparing the tag with the source of the image bitmap to make sure the view still is fresh. If you cache the image somewhere (in memory or storage) you can then retrieve it faster later and just fill the image view next time that cell needs to be rendered. Not sure if this is the exact problem you describe but I don't see any harm in giving some advice. Hope it helps. -Greg On Apr 7, 8:14 am, arnouf arnaud.far...@gmail.com wrote: I'm not sure that it will resolve my first problem related to the image loaded from remote and display in my listview I can useAsynctaskin my adapter to load each image. But when I do a bog scroll, displayed image are not to the good place (ex. : the image number 4 is displayed at the line 15 ...). It's trying to tesolve this first issue, that I meet the exception. But this issue is maybe due to the Async pooltoo. I come you back later. Thanks On Apr 7, 4:37 pm, Mark Murphy mmur...@commonsware.com wrote: When you have a lot of Image to load this is a big limitation. You can: -- Grab the source code toAsyncTask, clone it into your own package, and modify the LinkedBlockingQueue. I did this with my AsyncTaskEx class. -- SkipAsyncTaskand roll your own thread pool. -- Mark Murphy (a Commons Guy)http://commonsware.com AndroidApp Developer Books:http://commonsware.com/books.html -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
[android-developers] Retrieving PackName from RecentTaskInfo
I'm trying to the the application and icons for Recent Tasks, but I can't seem to get the appInfo using the RecentTaskInfo. The getApplicationInfo call is what is failing due to the getPackageName() returning null. ActivityManager manager = (ActivityManager)getSystemService(Context.ACTIVITY_SERVICE); ListRecentTaskInfo tasks = manager.getRecentTasks(50, 1); for (int counter = 0; counter tasks.size(); counter++) { RecentTaskInfo task = tasks.get(counter); PackageManager pm = this.getPackageManager(); try { ApplicationInfo appInfo = pm.getApplicationInfo(task.origActivity.getPackageName(),0); String applicationName = getPackageManager().getApplicationLabel(appInfo).toString(); Drawable icon = appInfo.loadIcon(pm); . I've also tried: ApplicationInfo appInfo = pm.getApplicationInfo(task.baseIntent.getPackage(),0); In which getPackage() is returning null.. maybe I'm going about this the wrong way and was hoping for some tips? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
[android-developers] Re: Service vs Singleton
Thank you, Mark! First at all singleton could be a member of the application. Then it will garbage collected with application. Then it is not a singleton. It is a data member of Application. Sorry, I wasn't precise. As far as I understand one process runs one application. At a time, yes. However, when all components of an Android application are destroyed, the process is retained for a while in a pool, for reuse by another application. This saves CPU time and battery life, by avoiding forking a new process and setting up a new Dalvik VM. I see. Now it becomes more clear. One more related question. What do mean by when all components of an Android application are destroyed? Let's talk about Activity, for example. Does destroy Activity means unload Java class? If so, what happens when system tries to destroy activity but it is referenced by another object ( for instance, a singleton may keep reference to it) ? Andrey -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
Re: [android-developers] Re: Service vs Singleton
ailinykh wrote: What do mean by when all components of an Android application are destroyed? Let's talk about Activity, for example. Does destroy Activity means unload Java class? No, I mean destroyed, as in onDestroy(). If so, what happens when system tries to destroy activity but it is referenced by another object ( for instance, a singleton may keep reference to it) ? The component is destroyed from an Android standpoint, but the Activity will not be garbage collected. This results in a memory leak and is why mutable static data members should be avoided where possible. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android App Developer Books: http://commonsware.com/books -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Timing out an AsyncTask?
I know how to use AsyncTask in a standard manner to manage operations that are in the background in relation to a UI thread. However, I want to run a task in the background which might run for a very long time under certain circumstances. In these cases, I would like to force the background task to fail if it runs for an excessive amount of time. I know that I can invoke the get(long timeout, TimeUnit unit) method of AsyncTask in my UI thread in order to terminate my background task if it runs too long. However, in that case, my UI will block while this get() command is waiting. There are probably other drawbacks to directly calling get() in this manner, not the least of which being an evil interaction with the done() method of AsyncTask's contained FutureTask object, which itself is calling get() -- at least this is what I see when I look at the source code for AsyncTask. So what is the canonical, Android-approved method for timing out an overly-long-running AsyncTask? 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 To unsubscribe, reply using remove me as the subject.
[android-developers] Hard to describe ... How to quickly scan through all rows?! How to pass a cursor between two activities?!
Hi, I have an app that has a list view of messages and a detail view. If you click on a message in the list view the detail view is opened for the message in the row you clicked on. In the detail view you also can go back and forth to other messages. So I pass in the position of the row the user clicked on and the criteria I need to rebuild the cursor like I did for the list. Then I use Cursor.moveToPosition() to get to the selected row. So far so good. There is only one issue, when an import is running in the background that inserts new (or deletes aged) messages then between the time of the click and the time the detail view queries the database again it maybe that the position is not valid anymore. Any idea how to deal with that? I tried to pass in a key instead and then go through all rows until I find the one that has the same key, but this takes a real long time and doesn't seem feasable at all. But maybe I am doing it wrong. It looks something like this: while (contentCursor.moveToNext()) { if (42 == contentCursor.getLong(0)) break; } Any better way to do that in general? I could try what happens when I pass in the position also and start from there. Usually that should work and when it doesn't then I could scan all messages?! The problem is, scanning all say 1,000 articles may take more than 5 seconds on a G1. Cheers, Mariano -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
Re: [android-developers] Retrieving PackName from RecentTaskInfo
Mark Hansen wrote: I'm trying to the the application and icons for Recent Tasks, but I can't seem to get the appInfo using the RecentTaskInfo. The getApplicationInfo call is what is failing due to the getPackageName() returning null. ActivityManager manager = (ActivityManager)getSystemService(Context.ACTIVITY_SERVICE); ListRecentTaskInfo tasks = manager.getRecentTasks(50, 1); for (int counter = 0; counter tasks.size(); counter++) { RecentTaskInfo task = tasks.get(counter); PackageManager pm = this.getPackageManager(); try { ApplicationInfo appInfo = pm.getApplicationInfo(task.origActivity.getPackageName(),0); String applicationName = getPackageManager().getApplicationLabel(appInfo).toString(); Drawable icon = appInfo.loadIcon(pm); . I've also tried: ApplicationInfo appInfo = pm.getApplicationInfo(task.baseIntent.getPackage(),0); In which getPackage() is returning null.. maybe I'm going about this the wrong way and was hoping for some tips? It may be there's a way to get things to work going down the path you're headed. Personally, I'd look at the source to RecentApplicationsDialog and see how they do it. You can find this in Google Code Search by searching on: package:android recentapplicationsdialog The reloadButtons() method uses getRecentTasks(). They create an Intent for each task, use resolveActivity() on PackageManager to get the ResolveInfo on the activity, then use loadLabel()/loadIcon() to get the display stuff. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android App Developer Books: http://commonsware.com/books -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
Re: [android-developers] Do Services *really* run in the Background?
I strongly recommend using IntentService, which takes care of the threading for you. Unless you are good at multithreading (I will claim that 90% of developers are not) then it is a good idea to stay away from Thread and use some higher-level facilities like IntentService, AsyncTask, etc. On Fri, Apr 9, 2010 at 7:40 AM, Mark Murphy mmur...@commonsware.com wrote: Jason LeBlanc wrote: Yes, the Connection extends Thread. Then be sure not to do anything time-consuming in the Connection constructor. Put the time-consuming stuff in run(). In this case, that includes opening your socket connection, because while it might not be time-consuming normally, it will be if it cannot resolve DNS, etc. If I start a Thread in an Activity, does that Thread need to complete execution before I can transition to the next Activity? No. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Warescription: Three Android Books, Plus Updates, One Low Price! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject. -- 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: Android OpenGL Game - App Architecture and Threading Logic
Yeah, you're going to want to model your game like you would model the real world: class World { public Player player; public Enemy[] enemies; public int timeLeft; public int level; //etc.. } Then you update the world (usually by calls to player.update, enemy.update, etc) from your logic thread. Then what I like to do is separate the rendering stuff from the simulation so that I have renderers for specific things: class PlayerRenderer extends BaseRenderer { // knows about player geometry, knows how to draw the player and anything player-related.. } Then in my main Renderer, I just call out to the individual component renderers: class WorldRenderer implements Renderer { onDrawFrame(GL gl) { // clear, set up projection, etc playerRenderer.draw(gl, world.player); enemyRenderer.draw(gl, world.enemies); // etc.. } } And that's how I do it. I have just a little bit of initialization communication from the Renderer side to the game logic so that we can set up positioning of touchable UI components but otherwise it's always GameThread updates World, WorldRenderer draws World, repeat. On Apr 9, 11:25 am, Eddie Ringle ed...@eringle.net wrote: Where do you store all your attributes, like player position? Currently I just have a GLQuad class that I use to create new quads, texture them, and manage position and velocity. Do you store them in World, and then each side can access them from the world object? Also, threading is new to me, so I really have no clue what a lock is. On Apr 9, 12:03 pm, Robert Green rbgrn@gmail.com wrote: It's pretty easy to do this: I use a World to write to and read from for the two sides. Makes networking nice too. My World has a simple lock. Only one thing can write to it or read from it at a time. in GameLogicThread: run() { while (!done) { // wait for renderer world.getLock(); // blocks update() world.releaseLock(); } } in Renderer: onDrawFrame() { world.getLock(); // blocks draw() world.releaseLock(); } On Apr 9, 3:27 am, Clankrieger tob...@googlemail.com wrote: Hi, I had a lot of difficulties getting the threading and app lifecycle issues done, too. For my part, this was much more confusing than getting the actual game done. ;) The good thing is: you do not have to do too much for the render- and logic-thread separation because most of the rendering time is getting spent outside of your renderer's onDraw method. This is how I got this done: The Game itself is owned by the glSurfaceView renderer instance. the when the game starts (at onResume), I start an updatethread that is very simple an does something like while(bKeeprunning) { synchronized(Game.sInstance) { Game.sInstance.update(); } Thread.sleep(50); } I have to add that my game logic is doing only this: logic. The world gets simulated. This is done less than 10 times per second - this is why I can have it sleep for 50 ms. sleeping is important here to give the render thread time to do this (I don't remember the full method signature, but I think you know what I mean): onDrawGlFrame() { synchronized(Game.sInstance) { Game.sInstance.render(); } Thread.sleep(5); } I defined the updatethread as class inside of the Renderer because it is so small. This gave me a huge performance boost. Handling the app lifecycle is less easy (at least for me). On Apr 9, 3:09 am, Eddie Ringle ed...@eringle.net wrote: Surprisingly, I don't seem to have issues with the OpenGL side of things (which is very unusual), but my problems stem from getting a clear idea for app architecture and a few other problems. Right now, most tutorials on the net just describe the render portion. I know that when I create a GLSurfaceView and hook a Renderer into it, it uses it's own thread for rendering. I want to do logic operations and other gameplay stuff (like moving characters and whatnot) in it's own thread as well. Can anyone explain a good approach to this? I'm guessing the two threads will have to be synchronized (do logic, render, repeat), and limited based on time so that it performs smoothly across different devices. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
Re: [android-developers] Timing out an AsyncTask?
AsyncTask was not designed for long running operations and should definitely not be used in the way you describe here. To cancel a task, just invoke cancel(). On Fri, Apr 9, 2010 at 10:50 AM, HippoMan hippo.mail...@gmail.com wrote: I know how to use AsyncTask in a standard manner to manage operations that are in the background in relation to a UI thread. However, I want to run a task in the background which might run for a very long time under certain circumstances. In these cases, I would like to force the background task to fail if it runs for an excessive amount of time. I know that I can invoke the get(long timeout, TimeUnit unit) method of AsyncTask in my UI thread in order to terminate my background task if it runs too long. However, in that case, my UI will block while this get() command is waiting. There are probably other drawbacks to directly calling get() in this manner, not the least of which being an evil interaction with the done() method of AsyncTask's contained FutureTask object, which itself is calling get() -- at least this is what I see when I look at the source code for AsyncTask. So what is the canonical, Android-approved method for timing out an overly-long-running AsyncTask? 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 To unsubscribe, reply using remove me as the subject. -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Animations and Threads
Hello, with AnimationDrawable I can handle animations well. But this class doesn't pay when I use a thread which draws on the canvas because it has no sense to draw with AnimationDrawable to the background of a View when there are a lot of animations to draw (http:// developer.android.com/intl/fr/reference/android/graphics/drawable/ AnimationDrawable.html). So my guess is it to not use AnimationDrawable but to read every single png file in an array of BitMaps and draw the right offset to the canvas to the right time. Is there a better way to use animations with threads? Regards. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
[android-developers] Re: Android OpenGL Game - App Architecture and Threading Logic
I wonder how much true parallelism is happening when the game logic runs on a separate thread than the rendering (in addition to the Activity thread for a total of 3). I do not claim to be an expert in this arena, but what follows is what I think about the subject of threads in Android games. Since we are dealing with a single CPU device, there is only a possibility to gain speed when the game logic thread and the GPU are processing simultaneously. It could be easy to have the rendering thread spend a lot of time on the CPU instead of the GPU if there are many calls to GL being made. And in order to get the most bang for the true parallelism buck, you would need to make sure the rendering pipeline has as few calls to GL as possible (preferably 1 for glDrawArrays and 1 bind texture atlas for an entire scene and then 1 to swap the buffers, of course there are a few others surrounding that, but hopefully you see my point). The basic point is, the more calls to GL, the more time CPU cycles are taken up in the rendering thread and since there is one CPU, the game logic thread is not simultaneously running. My overall take for most 2D games on Android is that you are better off with a single thread for both game logic and rendering UNLESS you have optimized your OpenGL rendering pipeline down to have a bare bones minimum of GL calls in a sort of render the entire scene at once from vertexes and 1 texture. With 3D games, the rendering pipeline seems more conducive to the render all at once implementation. I tried going down the path of 3 total threads and found not nearly enough performance benefit for the threading overhead (programming and context switching). In my case, I would have had to re-write quite a bit of my rendering pipeline to minimize the GL calls made to render each frame, so I opted with 2 total threads - Activity and All Else (game logic and rendering). On Apr 9, 12:03 pm, Robert Green rbgrn@gmail.com wrote: It's pretty easy to do this: I use a World to write to and read from for the two sides. Makes networking nice too. My World has a simple lock. Only one thing can write to it or read from it at a time. in GameLogicThread: run() { while (!done) { // wait for renderer world.getLock(); // blocks update() world.releaseLock(); } } in Renderer: onDrawFrame() { world.getLock(); // blocks draw() world.releaseLock(); } On Apr 9, 3:27 am, Clankrieger tob...@googlemail.com wrote: Hi, I had a lot of difficulties getting the threading and app lifecycle issues done, too. For my part, this was much more confusing than getting the actual game done. ;) The good thing is: you do not have to do too much for the render- and logic-thread separation because most of the rendering time is getting spent outside of your renderer's onDraw method. This is how I got this done: The Game itself is owned by the glSurfaceView renderer instance. the when the game starts (at onResume), I start an updatethread that is very simple an does something like while(bKeeprunning) { synchronized(Game.sInstance) { Game.sInstance.update(); } Thread.sleep(50); } I have to add that my game logic is doing only this: logic. The world gets simulated. This is done less than 10 times per second - this is why I can have it sleep for 50 ms. sleeping is important here to give the render thread time to do this (I don't remember the full method signature, but I think you know what I mean): onDrawGlFrame() { synchronized(Game.sInstance) { Game.sInstance.render(); } Thread.sleep(5); } I defined the updatethread as class inside of the Renderer because it is so small. This gave me a huge performance boost. Handling the app lifecycle is less easy (at least for me). On Apr 9, 3:09 am, Eddie Ringle ed...@eringle.net wrote: Surprisingly, I don't seem to have issues with the OpenGL side of things (which is very unusual), but my problems stem from getting a clear idea for app architecture and a few other problems. Right now, most tutorials on the net just describe the render portion. I know that when I create a GLSurfaceView and hook a Renderer into it, it uses it's own thread for rendering. I want to do logic operations and other gameplay stuff (like moving characters and whatnot) in it's own thread as well. Can anyone explain a good approach to this? I'm guessing the two threads will have to be synchronized (do logic, render, repeat), and limited based on time so that it performs smoothly across different devices. -- 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: Timing out an AsyncTask?
Of course I know about cancel(). When I mentioned the use of get(long timeout, TimeUnit unit), I thought it would be obvious that I would then invoke cancel() to terminate my overly-long-running task. But then, my UI thread would block while I'm waiting, as I stated above, which is not desirable. Nor is the fact that the done() method of AsyncTask's contained FutureTask object also calls get(). I asked what is the Android-approved, canonical method for doing what I want to do. Given that AsyncTask is not the intended mechanism for invoking and optionally timing out a long-running task, what *is* the recommended method for doing so in Android? Thanks again, 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 To unsubscribe, reply using remove me as the subject.