[android-developers] Re: Getting a complete list of android native drawables
> As with other resources, the official list of public resources is here: > > http://developer.android.com/reference/android/R.drawable.html > > Note that a lot of these are actually things like state list drawable XML > files, which map to some set of multiple underlying images that you can > not > directly access. Great, thanks! -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.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 -~--~~~~--~~--~--~---
[android-developers] Re: www.developer.android.com is gone!!!!
Nox wrote: > I´ve got a problem with the Android homepage, it isn´t working!!! There is no www on the Android home page. The site is: http://developer.android.com Without the www, it is working fine for me. -- Mark Murphy (a Commons Guy) http://commonsware.com Android App Developer Training: http://commonsware.com/training.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 -~--~~~~--~~--~--~---
[android-developers] Re: Can only hear sound when playing video
bestpriv...@googlemail.com wrote: > Any news on this one? I also only get sound. I tried the demo code on > both emulator and g1 but it only get sound, no video. The "Documentaries and You" video from this link definitely works for both sound and video: http://www.law.duke.edu/cspd/contest/finalists/ If that video works, then there is something about the video you have been trying that does not work with the codecs built into Android. Post details about the video (codec, framerate, size, etc.) and perhaps somebody can point out a known reason why it does not work. -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.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 -~--~~~~--~~--~--~---
[android-developers] Re: Can only hear sound when playing video
bestpriv...@googlemail.com wrote: > On 21 Mrz., 15:42, Mark Murphy wrote: >> The "Documentaries and You" video from this link definitely works for >> both sound and video: >> >> http://www.law.duke.edu/cspd/contest/finalists/ > > Thank you very much Mark. You just made my day :-) Aw, shucks. I'd've settled for just making your hour. ;-) > The sample code works fine with that clip. I did not expect Android to > be that picky on codecs. It'll probably get better over time. If you can narrow down the codec issue, consider seeing if it is reported over on http://b.android.com, and if not, post an issue. -- Mark Murphy (a Commons Guy) http://commonsware.com Android App Developer Training: http://commonsware.com/training.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 -~--~~~~--~~--~--~---
[android-developers] Re: Retreivng data from internet source.
> > Hi, I used the code you suggested Simon in this way, > > try{ > > URL myURL = new URL("http://www.indulec.ie/weather.txt";); > > URLConnection conn = myURL.openConnection(); > conn.connect(); > > BufferedReader is = new BufferedReader(new InputStreamReader > (conn.getInputStream(), "UTF8")); > > FileOutputStream fOut = openFileOutput("news.txt", > MODE_WORLD_READABLE); > > OutputStreamWriter osw = new OutputStreamWriter(fOut, "UTF8"); > > String istr; > > while ((istr = is.readLine()) != null) > osw.write(istr+"\n"); > osw.close(); > } > catch (IOException e) { > throw new RuntimeException(e); > > } > > but it doesn't seem to be editing my news.txt file. I have it saved in > the assets folder of my application. Is this correct? You are attempting to download news.txt. Given your code, when downloaded, that file will appear in: /data/data/your.package.here/files > I have uses-permission> included in my Manifest, this just has to be > physically typed in right? I don't need to add it in some way. No, but it might be in the wrong spot. If you could, post both your AndroidManifest.xml that you are using with the above code and the actual Java error you are receiving (via adb logcat, DDMS, the DDMS perspective in Eclipse). -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.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 -~--~~~~--~~--~--~---
[android-developers] Re: Retreivng data from internet source.
> I'm not receiving any error. Ah, sorry. I was sifting through earlier messages in the thread and thought you were getting an error. > Its just that when I click the button in > my application which should call a function to go online and download > data to the news.txt file, nothing happens. The manifest looks OK. You use "UTF8" instead of "UTF-8" in your streams, and I think the latter is the correct value there. If it helps, here is a slight variation of your algorithm, at least on the reading side: http://www.exampledepot.com/egs/java.net/ReadFromURL.html Do you have any evidence that the code is executing (e.g., stepping through it in Eclipse, sprinkling in Log.d statements)? -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.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 -~--~~~~--~~--~--~---
[android-developers] Re: OOXML MimeType application/vnd.openxmlformats-officedocument.wordprocessingml.documen t not available in android?
> set an intent-filter > > > > but Android never bind *.docx Documents with my application. > > Can it be, that Android doesn't know, that there is such a mimetype > out there? Are you sure your Web server is serving up the file with that MIME type? If you are not downloading the file via a Web server, how are you opening it? -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.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 -~--~~~~--~~--~--~---
[android-developers] Re: OOXML MimeType application/vnd.openxmlformats-officedocument.wordprocessingml.documen t not available in android?
> you are right. The web server didn't serve the right mimetype. I > tested it now via a microsoft iis server and ooxml works fine there. > > I hoped for a built-in mimetype detection in android just in case the > web servers don't deliver the right mimetype. Android, AFAIK, does not have any file-extension-to-MIME-type mappings outside of the media files for which it has codecs. -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.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 -~--~~~~--~~--~--~---
[android-developers] Re: Retreivng data from internet source.
> I can't find /data/data/my.package.here/files. I don't seem to have a > data folder. Are you working on the emulator, or the device? If it's the device, you probably cannot browse to the location using DDMS due to security restrictions. However, you should be able to use adb pull to pull the file given the full path, IIRC. The emulator, though, should let you browse to your package (whatever the name is, shown above as my.package.here) and its contents. -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.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 -~--~~~~--~~--~--~---
[android-developers] Re: Retreivng data from internet source.
> I'm working on the emulator using eclipse. I have a workspace for the > project on my desktop. When I go into my application's folder my > options are other folders like .setting, assets, res, bin and src. I > don't know where to go to find the news.txt file. Ah! You're looking in your project, not in the device. Go to the DDMS perspective, and you should find a menu choice(?) for browsing the file system of the running emulator. In the standalone DDMS, it's a "File Explorer" menu choice. -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.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 -~--~~~~--~~--~--~---
[android-developers] Re: Retreivng data from internet source.
murphy wrote: > Okay, I went to the Device's menu Sorry. Back up. You said you use Eclipse. Eclipse, with the Android plugin, has a perspective called DDMS. If you cannot find it, run the ddms program from the tools/ folder in your SDK, then select your running emulator in the table on the left. In either the perspective or the standalone tool, there should be a menu choice called File Explorer. Choose it. That will bring up a tree showing the contents of the filesystems on your running emulator. In there, browse to /data/data/whatever.you.elected.to.call.your.package/files, and you will (hopefully) see your files. -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.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 -~--~~~~--~~--~--~---
[android-developers] Re: Getting a complete list of android native drawables
Marco Nelissen wrote: > On the other hand, you might be better off using your own copy of the > system icons. For example, if you were to use system icons plus some > additional ones in the same style that you made yourself, your > application's menus will look weird if the system icons are > redesigned. Android has been beaten up in the past for apps not having a consistent look and feel, particularly when compared with iPhone. It is likely to get beaten up for it in the future. While having apps with disparate UIs is part-and-parcel of having an open platform, it might be nice if there was at least some measure of guidance for how application developers *can* strive for a consistent look and feel if they so choose. In other words, let developers have the freedom to follow a lead as much as they have the freedom to chart their own course. Either a sporadically-consistent look and feel is a goal of the core Android team, or it isn't. Speaking as a developer, it would be nice to know which philosophy the core Android team is adopting. If the core Android team would like a consistent look and feel from apps (e.g., Ms. Hackborn's repeated insistence that "close" menu items are evil), then you're going to have to throw us a bone now and again with advice on how to maintain a consistent look and feel with the stock Android apps. I would think rules for how to have consistent menu icons might be part of that. If, on the other hand, the core Android team is not terribly interested in UI look fidelity, or feels it's not an issue because of re-branding that device manufacturers might do, that's perfectly fine. However, if the UI critics continue harping on the issue, please don't blame the developer community for not following non-existent style guidance. The worst answer is no answer at all, where we are left with conflicting guidance: the core Android team sometimes berating us for not slavishly following the stock apps design (e.g., not having "close" menu items) and sometimes saying that our efforts to follow the stock apps design may be fruitless (e.g., you might change the icon style out from under us). - Also, with specific respect to the icons, bear in mind that we're working under a 70MB hard cap, and so every KB we can slice off our apps makes it that much more likely somebody will keep our apps around, rather than discarding them to free up space. Hence, the interest in avoiding redundant icons. -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.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 -~--~~~~--~~--~--~---
[android-developers] Re: Retreivng data from internet source.
murphy wrote: > Thanks for the explanation. I found the files there alright so the > code is working which is great. Now I need to access the files in the > device to display their contents in a TextView in a screen. I've been > trying to do something like this: > > String text = new String(istr); > TextView tv = (TextView)findViewById(R.id.somenews); > tv.setText(text); > setContentView(R.layout.latestnews); > > but I'm not really sure how to do it. setContentView() has to be called before findViewById(), assuming the layout you define in setContentView() has the widgets you're trying to access in findViewById(). -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.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 -~--~~~~--~~--~--~---
[android-developers] Re: Retreivng data from internet source.
murphy wrote: > I've added in also the line FileInputStream fIn = openFileInput > ("news.txt"); but I don't know what to do with it once I open it to be > able to display it in my TextView in a new screen. http://www.exampledepot.com/egs/java.io/ReadLinesFromFile.html -- Mark Murphy (a Commons Guy) http://commonsware.com Warescription: Three Android Books, Plus Updates, $35/Year --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: How to find Jarsigner
Nox wrote: > Unfortunately there is no Jarsigner!!! > Can I find it in an other way? > I need it urgent, because I want to publish my app. The jarsigner program is not from Android or the Android SDK. Your Java JDK should have come with it -- if it did not, try downloading and reinstalling the JDK again from Sun. -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.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 -~--~~~~--~~--~--~---
[android-developers] Re: handset error log
Bob wrote: > Is there a way for me to get an error report from my phone (not > emulator) about why it is force closing? With it plugged in via the USB cable, you do it the same way you would with the emulator -- adb logcat, DDMS, or the DDMS perspective in Eclipse. -- Mark Murphy (a Commons Guy) http://commonsware.com Android App Developer Training: http://commonsware.com/training.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 -~--~~~~--~~--~--~---
[android-developers] Re: PreferenceScreen Close
Noam wrote: > Let me rephrase my question. > > I have two PreferenceScreens - A and B. > In PrefScreen A, there is an option to go to B. When the user is on B, > and then leaves B and goes back to A, I would want to run a certain > method. Is there a way to do that? Implement onResume() in A. -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.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 -~--~~~~--~~--~--~---
[android-developers] Re: PreferenceScreen Close
Noam wrote: > I have tried that, but since both A and B are in the same java file, > then it won't work. Oh, oops. Sorry. Have you tried overriding onContentChanged()? I'm not sure when that all gets called, but there's a decent chance it is called when the screen changes content. That would probably trap both B->A and A->B; you'd need to figure out how to track which is which (e.g., also override onPreferenceTreeClick()). If that doesn't help, since PreferenceActivity extends ListActivity, you might try calling registerDataSetObserver() on the activity's ListAdapter and see if the DataObserver gets control when screens change. -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.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 -~--~~~~--~~--~--~---
[android-developers] Re: PreferenceScreen Close
Noam wrote: > Thanks for that incredible answer. It couldn't be all that incredible. ;-) > Since I'm such a noobie, I hardly understand anything from that > paragraph. Could you please show me some code so I could understand > better? Well, not really, because I've never tried either of them myself. The first one is easy: overriding onContentChanged() in your PreferenceActivity is no different than overriding onCreate() or onResume() or any of the other activity callbacks. Be sure to call super.onContentChanged(), and then log when onContentChanged() gets called (or set breakpoints, if you use a debugger). If it gets control when you need it, you should be in good shape. For the second one, see: http://developer.android.com/reference/android/widget/Adapter.html#registerDataSetObserver(android.database.DataSetObserver) (or http://tinyurl.com/dcrorv if that URL is too long for your mail client) Call getListAdapter() in your PreferenceActivity to get the adapter, then call registerDataSetObserver(), and see when the observer gets control (via logging statements or breakpoints). - Mark Murphy (a Commons Guy) http://commonsware.com Android App 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 -~--~~~~--~~--~--~---
[android-developers] Re: backup database
daniel.benedykt wrote: > Is there a standard way to backup the database of my app. Standard? No. > I know I can write data to a file from the DB and restore it at any > time with my code, but what happens if for some reason the user loose > all the data on the phone. Is there a way to make a backup to a > computer? You should have access to the database file, so you can transfer it via whatever mechanism you like (e.g., HTTP) to whatever destination you can reach via the Internet. I would make sure you do not have any active SQLiteDatabase objects referencing it, though. -- Mark Murphy (a Commons Guy) http://commonsware.com Warescription: Three Android Books, Plus Updates, $35/Year --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: PendingIntent problem
info+farm wrote: > Am I the only one who is having this problem? > Actually, I am going to find a workaround for this problem, but I > would like to know what I am doing wrong. I do not remember the answer, but I do know this was discussed on this list within the past few months. Search the list for PendingIntent and you will probably find it. -- Mark Murphy (a Commons Guy) http://commonsware.com Warescription: Three Android Books, Plus Updates, $35/Year --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Center drawable?
Keith Wiley wrote: > Question: I can place a drawable png on a button no problem, but the > only placement options are along the sides. Have you tried ImageButton? -- Mark Murphy (a Commons Guy) http://commonsware.com Android App 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 -~--~~~~--~~--~--~---
[android-developers] Re: Construct typeface object from file?
Stoyan Damov wrote: > Now, the thing is, why isn't this supported, > and would it be supported? FWIW, most of Typeface's logic is implemented in C via JNI. We'd need to modify lower-level firmware stuff to expose the right behaviors for Typeface to surface. I've logged this as: http://code.google.com/p/android/issues/detail?id=2284 -- Mark Murphy (a Commons Guy) http://commonsware.com Android App Developer Training: http://commonsware.com/training.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 -~--~~~~--~~--~--~---
[android-developers] Re: Construct typeface object from file?
zl25drexel wrote: > Hi, does anyone know how to construct a typeface object from a file? > Say i have a .ttf file on the SD card, how do i load it into my app? I do not believe you can. You can create a Typeface object from a suitable TTF that is packaged as an asset with your application, but there is no method on Typeface to create one from a file outside of there. -- Mark Murphy (a Commons Guy) http://commonsware.com Android App 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 -~--~~~~--~~--~--~---
[android-developers] Re: Get scroll position in a list activity
Ivan Soto wrote: > I'm trying to get the scroll position on a ListActivity. Here is what > I'm trying to do: > I have a list activity that is populated from an XML file. Another > thread downloads all pictures so the user can see the list while the > thread is still downloading the files. > > What I'm trying to do is when the thread finishes getting all pics it > reads the listview scroll position, refresh the listview and scroll to > that position again. Have you considered using placeholder images instead? Replace the placeholder images with the real ones as they come in. Then, when the background thread finishes, you do not have to do anything -- the images are already loaded. This eliminates the need to "refresh the listview" and any accompanying confusing such a refresh might cause the user. -- Mark Murphy (a Commons Guy) http://commonsware.com Android App 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 -~--~~~~--~~--~--~---
[android-developers] Re: Cupcake coming in April? Where is the SDK?
tauntz wrote: > We need an official SDK - > and we need it as soon as the tree is stable enough (and way before > it's pushed to the carriers/end-users) Please understand that Android is open source. There is no "pushed to the carriers/end users" -- hardware manufacturers are welcome to pull from the tree whenever they see fit. -- Mark Murphy (a Commons Guy) http://commonsware.com Android App 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 -~--~~~~--~~--~--~---
[android-developers] Re: Multiple ListViews in one Activity
Wouter wrote: > I now have different Listviews and I have different contextmenu's for > these listviews because they need different actions. > But i want to do this for the options menu to. The options menu is for the activity. Context menus are for the widget. > Can i create a > different options menu listener for every listview? No. -- Mark Murphy (a Commons Guy) http://commonsware.com Android App 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 -~--~~~~--~~--~--~---
[android-developers] Re: Get scroll position in a list activity
Ivan Soto wrote: > Do you have any article/tutorial about the placeholder images to share? > I'm trying to find one with no luck. I have used the technique, but not in code I'm allowed to share. I do need to more formally write this up at some point, but I do not have anything immediately handy. The gist of it is that you create your adapter and set it up, in getView() or newView()/bindView() (depending on adapter choice), to see if the thumbnail has been downloaded. If so, use it for the list row being inflated/updated; if not, leave the ImageView in the row pointing to some placeholder Drawable resource. This means as the user scrolls, she will pick up the thumbnails. Also, at the end, you can quickly iterate over the rows (ListView is a ViewGroup, IIRC, so there are methods to iterate its children) and ensure each of those rows' ImageViews are using their associated thumbnails. -- Mark Murphy (a Commons Guy) http://commonsware.com Android App 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 -~--~~~~--~~--~--~---
[android-developers] Re: Cupcake coming in April? Where is the SDK?
tauntz wrote: > Did you just say that Google is not pushing code/releases to tmo Of course Google doesn't push code/releases to T-Mobile. T-Mobile is a mobile carrier. > and > that tmo pulls the public source at random points in time, adds dream > specific bits and releases it to end-users? HTC pulls source at whatever time schedule they deem appropriate. HTC engineers are working on the code constantly and can make their own decisions vis a vis their product lines. Neither you nor I, nor possibly Google, is in position to tell HTC what they can or cannot do. Now, if HTC is sensible, they will primarily stick to major releases plus milestone bug fix updates, but that's not something you should be relying upon. > You do realize that all > releases till today have come from a closed source project and not > AOSP? HTC may have access to a private *repository*, but AFAIK, the bits are still open source. Open source is a matter of licensing, not a statement of public collaborative development. > (Even if Google doesn't actually push the code/release to tmo, they > certainly do tell tmo (and other carriers) when the code in the repo > is "stable enough" so they can pull and release. I certainly would hope so. > What I'm asking for, > is that at this point in time (eg Google has designated the code as > "stable enough to release") we get an official SDK - is that too much > to ask?) Of course it is. A "point in time" is infinitesimally short. Assuming you were being loose with your terms, how long would you consider a "point in time" to be? A second? A minute? An hour? A day? A week? A month? A year? Let us suppose that they tag whatever repository HTC works from for each major release. Once they tag the firmware release -- in effect, designating the code as "stable enough to release" -- they still need to build, test, fix, package, and release the SDK. That will take some time, even if they have been doing some of that work along the way, because up until now, the firmware has been a moving target, and the apps that ship with the firmware are not built on the SDK. For example, they may not test on Windows routinely due to the hassles involved in building the Windows version of the SDK. Should that take months? No. Might it take weeks? Possibly, depending on what is all involved and how many people are doing the work. Now, the *right* answer is for this to be a true public collaborative development project, so nightly builds of emulator images and corresponding SDKs are available, so we can apply tinderbox and smoke testing sessions and the like. In time, we should be able to cut the time between tagging the final shipping firmware and releasing the corresponding SDK with emulator images to be hours, not weeks. And perhaps it's at that level already, and I just haven't seen it since we haven't had all that many releases yet. But this still does not prevent hardware manufacturers from doing what they want. As evidenced by "pre-N" wireless routers, hardware manufacturers are not necessarily constrained by what would seem to be common sense to us out here. They'll do what they do. So if a device (e.g., G2) contains bits of cupcake in advance of an official cupcake-based release shipping, that was the manufacturer's decision. -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.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 -~--~~~~--~~--~--~---
[android-developers] Re: HttpUrlConnection - Authentication
nEx.Software wrote: > I am beating my head against a wall trying to figure out why I cannot > get Authenticated on my server whilst using HttpUrlConnection. I need > to post a file in a post method and it seems I cannot do so with the > DefaultHttpClient and a regular HttpPost (unless I am completely > missing something?). I can get DefaultHttpClient to authenticate just > fine using setCredentials() but the same doesn't exist for > HttpUrlConnection so I try to set through setRequestProperty: > conn.setRequestProperty("Authorization", "Basic " + > Base64EncodedUserNamePassword); to no avail. Can anyone offer some > insight? Thanks in advance. I don't have a direct answer, but JTwitter uses HttpUrlConnection, uses the same general technique you're describing, and it works on Android. Take a peek at their code and perhaps you'll see something that helps. http://www.winterwell.com/software/jtwitter.php -- Mark Murphy (a Commons Guy) http://commonsware.com Warescription: Three Android Books, Plus Updates, $35/Year --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: ClassLoader.isAncestorOf(ClassLoader) Bug
Daniel Janev wrote: > My colleagues has found a bug in the java.lang.ClassLoader > implementation of the cupcake tag of the Android platform. Did you file this on http://b.android.com? That is the issue tracker for Android. I do not see your issue out there, so I strongly encourage you to file it there. > I hope that you will be able to fix this as soon as possible and to > update the cupcake branch too. Please notify me when this is ready. If you would take the time to file this on http://b.android.com, you will automatically be notified of progress on the issue. -- Mark Murphy (a Commons Guy) http://commonsware.com Warescription: Three Android Books, Plus Updates, $35/Year --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: HttpUrlConnection - Authentication
nEx.Software wrote: > Thanks for the lead Mark. I really appreciate it. I hope it gives me > some insight. So, is my assessment right in that the HttpPost/ > HttpClient route is not possible for this sort of thing currently? If by "this sort of thing" you mean pre-emptive HTTP authentication, it definitely can be done. In my tutorials book, I show creating a Twitter client using HttpClient and pre-emptive HTTP authentication (nasty!), then ripping all that out and replacing it with JTwitter (crisp and clean!). While I like HttpClient in general, pre-emptive HTTP authentication is not one of its strong suits. > I > see there used to be a MultipartEntity class which was removed with > the 1.0 SDK. That looks like it might have been what I needed. Anyway > thanks again. I think others have just grabbed an edition of that from http://hc.apache.org. -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.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 -~--~~~~--~~--~--~---
[android-developers] Re: Alias custom view path in XML
Ward Willats wrote: > Is there a way to alias the path to my custom view class (perhaps in > its ) so I can say > > > > in the XML, instead of > > > > (I played around with the months ago, namespaces and what-not, but > never found a solution.) > > Just a "nice to have" thing. Not that I'm aware of. Otherwise, I would have expected Google to avail itself of the technique with MapView. Right now, we have to spell out the whole fully-qualified class name when putting MapView in our layouts (unless something changed on that front that I missed). -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.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 -~--~~~~--~~--~--~---
[android-developers] Re: api to install update apk in private-app folder
Zi Yong Chua wrote: > I have a question with regards to an update feature that I am trying > to put in my application. I am wondering if it is possible for an > application to download a new apk and install it inside the /data/app- > private folder (which i presume is for copy protected apps)? I do not believe that is possible. -- Mark Murphy (a Commons Guy) http://commonsware.com Android App Developer Training: http://commonsware.com/training.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 -~--~~~~--~~--~--~---
[android-developers] Re: api to install update apk in private-app folder
Zi Yong Chua wrote: > Its not possible to do the install or to install it in app-private may > I ask? You cannot directly install anything. At best, you can hand the APK off to the system, and Android can install it, but I do not believe you can control where it gets installed (that's up to Android). This is what happens when you download an APK, at any rate -- I assume there is some what to trigger the same code from your own application. -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.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 -~--~~~~--~~--~--~---
[android-developers] Re: How to change the tab icon dynamically
manoj wrote: > can any one please help me. Its requirement of the client. You can try holding onto the TabHost.TabSpec objects you create and call setIndicator() again when the icon changes. I have no idea if that will work. You might try subclassing TabHost and see if you can handle the icon change yourself, though I have no idea if this is possible, and you would need to not use TabActivity (which, IIRC, creates its own TabHost object). You can always roll your own tab-style UI using a ViewFlipper or similar widget. -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.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 -~--~~~~--~~--~--~---
[android-developers] Re: Multiple ListViews in one Activity
Wouter wrote: > I now have another problem. > i now have multiple listviews in my listactivity. > When i reach the bottom of the screen one of the lists put scrollbars > in the listview. > But i cant scroll the whole activity! I cannot scroll when i have a > long list.How can i fix this? > putting the listviews in a scrollview? I don't think you can. I am assuming from your problem that you are trying to have one ListView stacked above the other ListView. If so, I would strongly encourage you to consider: -- Putting all the items in one ListView, perhaps with some sort of visual separator, as described by Jeff Sharkey (see below URL) or my Advanced Android book http://www.jsharkey.org/blog/2008/08/18/separating-lists-with-headers-in-android-09/ -- Putting the lists side-by-side rather than stacked -- Switching one to a Spinner -- Using tabs, ViewFlipper, or some other means to have the lists on separate "screens" -- Using separate activities, one per list -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.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 -~--~~~~--~~--~--~---
[android-developers] Re: Localizing layouts?
BoD wrote: > Hi! > Is it possible to localize layouts (in the same way you can have a > 'por' and a 'land' layout? > > As you may know some languages are less 'verbose' than others, thus > sometimes layout adjustments might be needed according to the current > language. Sure! http://developer.android.com/guide/topics/resources/resources-i18n.html#AlternateResources For English and German, for example, you would need: res/layout-en-land res/layout-de-land res/layout-de (for portrait -- or use layout-de-port) res/layout (for English portrait) The language code must precede the orientation code. -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.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 -~--~~~~--~~--~--~---
[android-developers] Re: Multiple ListViews in one Activity
Wouter wrote: > I have multiple lists because every list uses another database adapter > for getting data from a database. And also the onItemClick must be > different for every list! > Would i be able to still do this when I make one listview? You would only have one onItemClick and would have to determine what you want to do in that case. Also, you would only have one context menu. On the other hand, your scrolling would work better. >> -- Putting the lists side-by-side rather than stacked > > What do you mean with this? Left to right rather than top to bottom. -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.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 -~--~~~~--~~--~--~---
[android-developers] Re: Bug in UK i18n?
Michael Bollmann wrote: > Did anyone encounter this problem? > > I got the following files: > > /res/values/strings.xml > /res/values-de/strings.xml > /res/values-en-rUK/strings.xml > /res/values-en-rUS/strings.xml > > [GOOD] Setting german locale overrides default strings > [GOOD] Setting us locale overrides default strings > [BAD] Setting UK locale chooses default strings instead of uk strings > > My adp1 got only us locale so i only tested it on the emulator but > i got confirmation from uk users that this happens on real devices too. You may be using the wrong code for UK strings. According to the ISO 3166-1-alpha-2 standard: http://www.iso.org/iso/country_codes/iso_3166_code_lists/english_country_names_and_code_elements.htm the UK would be -rGB, not -rUK. -- Mark Murphy (a Commons Guy) http://commonsware.com Warescription: Three Android Books, Plus Updates, $35/Year --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Multiple ListViews in one Activity
Wouter wrote: > Ok i understand. But how can i make one listview for all these > adapters. I gave you a link earlier. Here it is again: http://www.jsharkey.org/blog/2008/08/18/separating-lists-with-headers-in-android-09/ -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.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 -~--~~~~--~~--~--~---
[android-developers] Re: Multiple ListViews in one Activity
Wouter wrote: > Thank you! Can i put my data from the simplecursoradapter in it? It takes any sort of adapter, as far as I know. -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.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 -~--~~~~--~~--~--~---
[android-developers] Re: Image from internet won't display.
murphy wrote: > Hi all, I'm trying to get an image to display from an internet source > but nothing it coming up on my screen. After the button click which > calls the code I am presented with a blank screen. The code I'm using > is: > > try { > URL url = new URL("http://code.google.com/android/ > images/logo_android.gif"); > URLConnection conn = url.openConnection(); > conn.connect(); > InputStream is = conn.getInputStream(); > BufferedInputStream bis = new BufferedInputStream > (is); > Bitmap bm = BitmapFactory.decodeStream(bis); > bis.close(); > is.close(); > > ImageView image = (ImageView)findViewById > (R.id.timetableImage); > setContentView(R.layout.timetable); > image.setImageBitmap(bm); > > } catch (Exception e) { > // TODO Auto-generated catch block > e.printStackTrace(); > } > > Can any one see what's wrong? Yes. You're calling setContentView(). In most activities, setContentView() is called once, early in onCreate(). It is infrequently called in an event handler (e.g., button click callback). More importantly, any widgets you got after the first setContentView() and before the second setContentView() are unusable. Hence, your findViewById() call immediately before the setContentView() will return you a widget...but that widget is then taken off the screen by the setContentView(). -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.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 -~--~~~~--~~--~--~---
[android-developers] Re: Image from internet won't display.
murphy wrote: > Do you mean put the setContentView() before findViewById()? I tried > that but it still comes up blank. Sorry if I'm not understanding you. All I can tell you is that having setContentView() in a button's click handler is a "code smell". Having more than one setContentView() in an activity is possible but rather unusual and not recommended for newcomers to Android. Change your code to only call setContentView() once, early in onCreate(). If that does not clear up your problem, confirm your ImageView works with something other than the downloaded GIF, such as a Drawable resource (e.g., res/drawable/test_image.png). -- Mark Murphy (a Commons Guy) http://commonsware.com Android App Developer Training: http://commonsware.com/training.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 -~--~~~~--~~--~--~---
[android-developers] Re: Multiple ListViews in one Activity
Wouter wrote: > Ok i have integrated it now in my applications. It works now to show > the 2 lists as one 1 list with seperated headers. > But now, how can i determine which list is was, to integrate my > seperated actions? > I have a lists for flights and hotels (for example). When i click on a > item in the flight list i have to open another activity then when I > click on a item in the hotel list! The same way you do with any list: call getItem() on the adapter. -- Mark Murphy (a Commons Guy) http://commonsware.com Android App Developer Training: http://commonsware.com/training.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 -~--~~~~--~~--~--~---
[android-developers] Re: Multiple ListViews in one Activity
If you cannot figure out how to use the SeparatedListAdapter, or where it may need to be extended to help you achieve your ends, find some other UI pattern you are more comfortable with. Wouter wrote: > How? if i want to delete a item in my list what do i have to do with > getItem? > for example I have a delete option in my OptionsMenu: > > This was my original code: > public boolean onOptionsItemSelected(MenuItem item) { > switch (item.getItemId()) { > case DELETE_ID: > > Cursor flightsCursor = flightDbHelper.fetchAllFlights(); > long position = listView.getSelectedItemId(); > flightsCursor.moveToPosition((int) position); > flightDbHelper.deleteFlight(position); > fillData(); > > break; > } > > but now i have to detect which list it was so i have to delete it from > my flight database or hotel database! > How can i do that? > > On Mar 24, 9:34 pm, Mark Murphy wrote: >> Wouter wrote: >>> Ok i have integrated it now in my applications. It works now to show >>> the 2 lists as one 1 list with seperated headers. >>> But now, how can i determine which list is was, to integrate my >>> seperated actions? >>> I have a lists for flights and hotels (for example). When i click on a >>> item in the flight list i have to open another activity then when I >>> click on a item in the hotel list! >> The same way you do with any list: call getItem() on the adapter. >> >> -- >> Mark Murphy (a Commons Guy)http://commonsware.com >> Android App Developer Training:http://commonsware.com/training.html > > -- Mark Murphy (a Commons Guy) http://commonsware.com Android App Developer Training: http://commonsware.com/training.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 -~--~~~~--~~--~--~---
[android-developers] Re: How do I pass data in an intent from an activity started from the launcher?
me tun wrote: > Does this mean I essentially cannot initialize my application with any > data I want to pass to it this way? It seems very strange? Each activity usually only has one icon in the launcher. There is nothing to pass in that you could not just as easily have encoded into the activity itself. -- Mark Murphy (a Commons Guy) http://commonsware.com Android App 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 -~--~~~~--~~--~--~---
[android-developers] Re: How do I pass data in an intent from an activity started from the launcher?
me tun wrote: > OK, time to come clean, I know people who "are hacking the framework" > are not generally well received around here... It's more that there are other lists for those who "are hacking the framework": http://source.android.com/discuss > But when we launch an activity we want to pass some data (lets say > FULL_SCREEN / HALF_SCREEN) and we want the activity to start in full > screen or half screen. Is this possible? Not directly. And, when you "are hacking the framework", you might consider making a patch to allow one to define "extras" in the manifest to put in the Intent used to launch from the launcher. Or, perhaps you can use an alternative home screen (e.g., dxTop) and work with that developer on this project. However, it should be fairly trivial for you to create a shallow activity class hierarchy to handle this, at least as a workaround. For example, suppose the name of the activity you presently have is FooActivity. You're trying to launch FooActivity in one of two modes, and your attempts to do so via modifying the Intent used to launch the activity has been foiled. So, do the following: 1. Make FooActivity abstract, requiring a boolean useFullScreen() method 2. Create FullFooActivity and HalfFooActivity, each extending FooActivity, with FullFooActivity implementing useFullScreen() to return true and HalfFooActivity to implement useFullScreen() to return false 3. Create separate entries in the manifest for FullFooActivity and HalfFooActivity, each with the standard launcher intent-filter 4. Use useFullScreen() to do whatever it was you were looking to handle via the customized Intent Clunky, but it works, until you can amend a home application that is more amenable to your requirements. -- Mark Murphy (a Commons Guy) http://commonsware.com Android App 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 -~--~~~~--~~--~--~---
[android-developers] Re: can we change the resolution of images taken by camera
cindy wrote: > The image size is about 1mg, which takes long time to transfer to > server in 3G network. How can I reduce the resolution of image ? Is > there any parameter we can set before taken picture? Camera.Parameters has setPictureSize(). Camera has setParameters(). I haven't tried this, but in theory, you should be able to control the resolution this way. -- Mark Murphy (a Commons Guy) http://commonsware.com Android App 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 -~--~~~~--~~--~--~---
[android-developers] Re: How do I pass data in an intent from an activity started from the launcher?
me tun wrote: > I had already tried Mark's way (great book btw) Thanks! > which does work but > isn't quite an elegant solution nor is it exactly what I'm trying to > achieve. Oh, well. In these support forums, it's win a few, lose a few. -- Mark Murphy (a Commons Guy) http://commonsware.com Android App 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 -~--~~~~--~~--~--~---
[android-developers] Re: How to set the video in full screen mode?
manoj wrote: > Hi, > > I am writing a small video player application. It's working fine. > > The video is visible on the device, but the app name is visible on the > top of the video. > > I want to avoid this (complete full screen mode, there is no appname > only video should be there). > > Can you please tell me how to achieve this? http://androidguys.com/?p= In particular, read the comments, where I think half the core Android team jumped in to tell me how better to solve the problem... ;-) -- Mark Murphy (a Commons Guy) http://commonsware.com Warescription: Three Android Books, Plus Updates, $35/Year --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: DexClassLoader Feature in the Cupcake
Questions regarding Android development tools or pre-released versions of the firmware should be addressed to a discussion list for the Android open source project: http://source.android.com/discuss Ask wrote: >Please respond.. Whether DexFile class can solve this purpose? > > On Mar 25, 11:52 am, Asif k wrote: >> Hi all, >> >>Can anyone please provide some information regarding the reflection >> API DexclassLoader, which will be includeed in cupcake release?? In >> the latest development of the cupcake, whether this feature is added >> or still to be done?? >> >>I f already included then any reference which will explain about >> how to download that cupcake source from the repo, compile that source >> and add in the current sdk. I am using windows plateform and running >> the applications on the emulator. -- Mark Murphy (a Commons Guy) http://commonsware.com Warescription: Three Android Books, Plus Updates, $35/Year --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Local and Remote Services
Vipul Sagare wrote: > After spending few days with Services API, here are some of my > questions. I would appreciate your answers and any leads to blogs/postings. > > I have already gone through API reference and APIDemos for AlarmService, > LocalService, and RemoteService. > > - Are there any good sample applications for each? See below. > - Wouldn't most applications use Local Service? That is difficult to say in the abstract, though I would not be surprised if more use local services than remote services. > - What are some of the applications which would be good candidate for > remote services but not for local services? Here are three off the top of my head: 1. You want third-party programs to use the service (even if you are using it locally, it needs to support AIDL interfaces and such for use remotely) 2. You are reusing a service from a third-party program 3. You want part of your application to run with different permissions than another part of your application (e.g., firewalling off certain sections), and so you split part of it out into a remote service > -Is there any other resource apart from API reference, APIDemos and dev > guide for this topic that one would recommend?(Some of the blogs are > a bit outdated) You mean besides (*cough*) various Android books? ;-) In all seriousness, services have not received quite as much attention as activities. There are probably good samples out on anddev.org, and you might consider poking through code.google.com or github's Android projects to see if anything strikes your fancy. > -To start an Activity from service, the use of Notification with > PendingIntent is the "best and only" way. Is that correct? Best, yes. Only, no. AFAIK, you can call startActivity() from a service, though your users may threaten you with bodily harm if you do so, since you might be interrupting them in the middle of something else they are doing. -- Mark Murphy (a Commons Guy) http://commonsware.com Warescription: Three Android Books, Plus Updates, $35/Year --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: android http GET 400 error
zeeshan wrote: > Hi Android Experts, > > i need to make a GET request to the http://www.x.com/server.xml which > takes 3 mandatory headers > > hdr1,hdr2,hdr3 > > i am trying this code Your code appears to be setting form variables, which are not HTTP headers. Headers are set via setRequestProperty() with URLConnection, just as you are using it for Connection and Content-Type. -- Mark Murphy (a Commons Guy) http://commonsware.com Warescription: Three Android Books, Plus Updates, $35/Year --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: android http GET 400 error
zeeshan wrote: > well, thanks > > i added these headers > > conn.setRequestProperty("hdr-1",this.hdr1); > conn.setRequestProperty("hdr-2",this.hdr2); > conn.setRequestProperty("hdr-3",this.hdr3); > > but now i am getting 500 error response > > i need to use a get method for http://www.x.com/server.xml with the > mandatory headers i just added > > just wondering if something wrong in my code or in server itself. > > shall i use httpget method? You can try that. If the server in question offers any examples of accessing its content programmatically (e.g., example curl or wget commands), review those and see if there is anything obvious you are missing. Of course, the best solution is if somebody offered a Java API for accessing this Web service (e.g., JTwitter for Twitter). -- Mark Murphy (a Commons Guy) http://commonsware.com Android App Developer Training: http://commonsware.com/training.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 -~--~~~~--~~--~--~---
[android-developers] Re: How to display 2 ListViews on the screen at the same time
xinit wrote: > Hello > > I am trying to design a UI which utlizes two ListViews on the screen > at the same time. > Is this possible ? > > > So here is a quick example of how I was intending to do this. > > 1) Create an XML which positions 2 ListViews one onto of the other > each ListView having there own ID > > android:id="@android:id/list" > android:layout_width="fill_parent" > android:layout_height="198px" > > > > android:id="@+id/ListView01" > android:layout_width="192px" > android:layout_height="215px" > > > > > 2) Create two string arrays and populate each listview via > ArrayAdapter > > private String[] mStrings = { > "Abbaye de Belloc", "Abbaye du Mont des Cats", "Abertam", > "Abondance", "Ackawi", > "Acorn", "Adelost", "Affidelice au Chablis", "Afuega'l > Pitu", "Airag", "Airedale", > "Aisy Cendre"}; > > private String[] mStrings2 = {"dsds", "qwqwqq", " dsdsdsd sdsdsds > ", "dsdsds sdsds"}; > > public void onCreate(Bundle savedInstanceState) { > super.onCreate(savedInstanceState); > setContentView(R.layout.main); > > setListAdapter(new ArrayAdapter(this, R.layout.row, > R.id.label, mStrings)); > setListAdapter(new ArrayAdapter(this, R.layout.frow, > R.id.ListView01, mStrings2)); > } > > > > This does not work. > Can anyone advise ? You cannot use the ListActivity methods for managing the second ListView. You will need to use findViewById() and handle that ListView manually. -- Mark Murphy (a Commons Guy) http://commonsware.com Android App Developer Training: http://commonsware.com/training.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 -~--~~~~--~~--~--~---
[android-developers] Re: How to display 2 ListViews on the screen at the same time
xinit wrote: > For Example if I have two ListViews one ontop of another, for me to > scroll the list in the bottom ListView I have to navigate all the way > down through all items in ListView 1 before entering or focussin on > List View2. Simple: don't use two lists on the screen at one time. -- use a Spinner for one -- use tabs to put them on separate tabs -- use ViewFlipper to flip between the two lists based on a button click or option menu choice -- use multiple activities, one list per activity -- Mark Murphy (a Commons Guy) http://commonsware.com Warescription: Three Android Books, Plus Updates, $35/Year --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: android http GET 400 error
zeeshan wrote: > thanks for the reply Mark! > > i tried httpget also but same 500 error. > > is there any sniffing tool i can configure with emulator to check the > exact http trafic format? I seem to recall there are various local proxy servers you can use to intercept HTTP traffic, though getting a proxy server to work with the emulator is not terribly easy given the number of questions that seem to come up related to it. Instead, particularly if you are using OS X or Linux as your development environment, I would focus on trying to get curl working. Once you have curl properly downloading the content, converting that into Android code (whether URLConnection or HttpClient) should be relatively straightforward. You might also inquire with whoever is hosting the server if they have any recipes for Web service access. -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.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 -~--~~~~--~~--~--~---
[android-developers] Re: Creating multiple layouts
Vijay Bahirji wrote: > Hi, > > I am new to android and trying to create a customized list. Every item > in the list has TextView and one Ratingbar. I now want add a couple of > command buttons at the end of the list (like BACK, HOME, , NEXT). When > I add these extra views to the layout xml file then they get added > along with every item in the list. I think there should be another > layout defined for the buttons to be displayed separate from the list. > Anyone has an idea on how to do this? Have two layout files. One is for the activity, one is for the rows in the activity. The first you would use with setContentView(); the latter you would either supply to your adapter or use when you manually inflate the rows. -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.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 -~--~~~~--~~--~--~---
[android-developers] Re: Singleton in different service which share same process
Jove wrote: > Hi guys, > I meet an issue. > I have two services, both of them lies in separate apk, which run > in same process. The two service share same jar file by > method. The jar file implement a class, say "test", is a singleton. > But I found that two instance of test is created under this case, > could anybody give me some tips? I want to ensure it's singleton. If you can explain a bit about how you are using for your own JAR files, I might be able to figure out why you are getting two instances. I have not seen much use of outside of the Google Maps situation. How are you using it in your application? -- Mark Murphy (a Commons Guy) http://commonsware.com Android App Developer Training: http://commonsware.com/training.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 -~--~~~~--~~--~--~---
[android-developers] Re: is video recording available in V1.1?
zeeshan wrote: > i am looking for video recording example, it suppose to be in api- > sample but not available > i am wondering if 1.1 release still missing this feature? Video recording is not available in the current version of Android. -- Mark Murphy (a Commons Guy) http://commonsware.com Android App Developer Training: http://commonsware.com/training.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 -~--~~~~--~~--~--~---
[android-developers] Re: written file not found
Mak wrote: > Hi. > I've written an file with the following comands: > > String ausgabe; > > try{ >java.io.BufferedWriter fos = (new java.io.BufferedWriter( new > java.io.OutputStreamWriter( > openFileOutput("testfile.txt", MODE_APPEND ; > > if (ausgabe.length() != 0){ > fos.write(ausgabe); > } > > catch (FileNotFoundException f){ >System.out.println("Not found"); > } > > Everything works and on the emulator i've got no problem. > The written file "testfile.txt" can be found in /data/data/mypackage/ > files. > But on my G1 the folder "/data" is empty, no folder /data/packages can > be found with > "Astro File Manager" or LindaFileManager. Probably, that is because they cannot browse /data due to security restrictions. > Anyone any idea where to find the files of my applications? They are in the same spot on the device as they are in the emulator. You just cannot browse to them. However, you can use adb pull to download them. > Why do i have only the folders /data, /sdcard and /system on the > emulator but > on the device there are much more? You have all of same folders on the device; you just cannot browse them. -- Mark Murphy (a Commons Guy) http://commonsware.com Android App 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 -~--~~~~--~~--~--~---
[android-developers] Re: TERRIBLE BUG: aapt crashes on Windows
Stoyan Damov wrote: > I can't provide a way to reproduce the problem. 1. Create a fresh project. 2. Copy your entire res/ tree out of your current project into the fresh project. 3. Try building. If the build crashes, then zip up the new project and attach it to the issue. Or, try winnowing out some resources (e.g., ones you might not want to upload) and see if the problem persists -- if the problem goes away, it may be tied to the resources you removed. If that doesn't crash, then the problem depends on other stuff (e.g., your original project's manifest, other build settings you may have enabled) and may truly be difficult to reproduce without uploading your original app, which I suspect you may be less than inclined to do. But if you really want this "TERRIBLE BUG" fixed, you really should consider at least trying to give the developers steps to reproduce the crash. - Providing steps to reproduce failures, whether in tools or class libraries or whatever, has been a standard of professional application development for a couple of decades now. I distinctly remember getting yelled at by engineers for failing to provide steps to reproduce bugs back as a summer intern in 1990, and I don't get the sense they were cutting-edge on that topic. It's also a quite common request in open source projects. For example, here is where Mozilla asks for steps to reproduce the problem: https://developer.mozilla.org/en/Bug_writing_guidelines And Ubuntu: https://wiki.ubuntu.com/Bugs/HowToTriage#Improving%20a%20bug%20report And OpenOffice.org: http://qa.openoffice.org/ooQAReloaded/Docs/QA-Reloaded-BasicRules.html And Moodle: http://docs.moodle.org/en/How_to_add_steps_to_reproduce_to_a_bug_report Heck, even not-really-open-source Microsoft is into the game: https://connect.microsoft.com/content/content.aspx?ContentID=3480&SiteID=168#BM8 As one person put it, "If your bug is not reproducible it will never get fixed." (from http://www.softwaretestinghelp.com/how-to-write-good-bug-report/) -- Mark Murphy (a Commons Guy) http://commonsware.com Android App Developer Training: http://commonsware.com/training.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 -~--~~~~--~~--~--~---
[android-developers] Re: TERRIBLE BUG: aapt crashes on Windows
Stoyan Damov wrote: > David, give me a break. The tool should have been instrumented in the > 1st place to catch these crashes (SetUnhandledExceptionFilter and > MiniDumpWriteDump ring a bell?). To quote yourself: "Am I supposed to wrap ALL my code in exception handlers? What good if I do that?" (from http://tinyurl.com/ct3fcf) -- Mark Murphy (a Commons Guy) http://commonsware.com Warescription: Three Android Books, Plus Updates, $35/Year --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: TERRIBLE BUG: aapt crashes on Windows
Stoyan Damov wrote: > It would be nice, if you stopped playing Google's advocate for one day :) You mean like this: http://www.networkworld.com/community/node/40044 and this: http://www.networkworld.com/community/node/39099 and this: http://www.networkworld.com/community/node/38830 and many others? Trust me, "I calls 'em as I sees 'em". I just don't tend to bash Google/OHA on these lists too much, because that will be more likely to be seen as personal attacks on the core Android team, and they aren't the source of my ire. -- Mark Murphy (a Commons Guy) http://commonsware.com Warescription: Three Android Books, Plus Updates, $35/Year --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Emulator crashing
青铜 wrote: > I also have this question. > Every time I run HelloMapView (the example code in dev.android), I > only can see the title of the app, and the content is just black. Did you get your own Maps API key, as outlined in step #4? -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.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 -~--~~~~--~~--~--~---
[android-developers] Re: need some collection help
Josh wrote: > I want to store objects into an array or collection(whichever is best > suited to this in dalvik). You mean like the ones in the java.util package? > the objects are basically just VO's all of > the same class that i want to keep track of. What's a VO? -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.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 -~--~~~~--~~--~--~---
[android-developers] Re: written file not found
Mak wrote: >> Probably, that is because they cannot browse /data due to security >> restrictions. > > What permissions do i need to see all files on the device? > tools like ASTRO have -i hope so- the permissions for reading all > self written files on my device. Probably not. Or, more accurately, they have permissions to read "all self written files", but not necessarily browse the directories that contain them. > maybe my application has not enough permissions? There are no permissions to say "let my app read all files anywhere". > I thought that the adb pull is a tool for eclipse and the emulator. > how can i use that on the g1? You can't. My apologies, I thought your goal was to view the files. -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.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 -~--~~~~--~~--~--~---
[android-developers] Re: Building user interfaces at runtime with layouts from server
> I chose the "do it yourself" approach and parse the layout.xml by > myself. The simple part (reading the element names and building the > widget tree) works quite well. Then I wrote an own implementation of > android.util.AttributeSet which wraps a org.w3c.dom.NamedNodeMap. When > I try to instantiate a View class with my own AttributeSet > implementation I get hit by a ClassCastException. After a short > investigation I found the following code. > > When can I expect this to be fixed? Sometime after it is listed as an issue on http://b.android.com, and then sometime after somebody with the itch elects to scratch it and submit a patch to http://source.android.com. That could be somebody on the core Android team, but it does not have to be. Considering how many outstanding feature requests there are, you will probably get a faster response if you can submit a patch yourself or directly engage with somebody who can submit a patch for you. -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.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 -~--~~~~--~~--~--~---
[android-developers] Re: need some collection help
Josh Dobbs wrote: > Here's what my code looks like... > > * > > private > > * Collection __cars_; > > Car _myCar_= > > *new* Car(1,1,*false*,5, "blue"); > > Car _myCar2_= *new* Car(1,1,*false*,5, "red"); > > _cars.add(myCar); > _cars.add(myCar2); Collection is an interface, not a class. There are about 20 or so concrete Collection classes (e.g., ArrayList) that you can choose from. http://java.sun.com/docs/books/tutorial/collections/index.html http://mindprod.com/jgloss/collection.html -- Mark Murphy (a Commons Guy) http://commonsware.com Android App 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 -~--~~~~--~~--~--~---
[android-developers] Re: Observation and comments on Android and "regularly" scheduled events
clarkbriancarl wrote: > The best I can get in a 24 our period for an > alarm scheduled every 10 miutes is about 75% (110 out of 144 repeating > alarms). I have tried varying this interval from 1 minute to 30 > minutes with the same result. I have tested on a non-rooted T-Mobile > both 1.0 and 1.1 firmware. I have tested on an ADP using both 1.0 and > 1.1 firmware. I have tried using "PARTIAL_WAKE_LOCK" and > "FULL_WAKE_LOCK" feature of the PowerManager. Nothing seems to work. > Android just will not run an event consistently. Post an issue to http://b.android.com with sample source code that demonstrates the problem. If you want, reply on this thread with a link to your issue. -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.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 -~--~~~~--~~--~--~---
[android-developers] Re: Observation and comments on Android and "regularly" scheduled events
clarkbriancarl wrote: > THanks for the reply. I use your book as a reference from time to > time. I would recommend it to anyone reading this. Thanks! > Before I open an issue, I would like to hear from other developers to > see if their experiences have been similar, and if not, do some code > comparison to see what they are doing different. I just want to make > sure this is an issue and not a mistake on my part. > > I am willing to post some code if it is needed. I'm sure there are some folk who could eyeball some sample code and point out possible problems but may not have source they are in position to upload. That's one of the many advantages of having sample projects that reproduce possible bugs. Your issue illustrates, though, that I need to beef up my AlarmService section in the Advanced Android book, so I'll try to spend some time reproducing your scenario and seeing if I get similar results. To invert the Stones, "Ti-i-i-ime is not on my side (no it ain't)", but I'll hopefully be able to squeeze this in this weekend. -- Mark Murphy (a Commons Guy) http://commonsware.com Android App Developer Training: http://commonsware.com/training.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 -~--~~~~--~~--~--~---
[android-developers] Re: Observation and comments on Android and "regularly" scheduled events
Dianne Hackborn wrote: > This is unfortunately tricky to do right now; in the future we would > really like to make wakelock management easier for these situations. You ain't just whistlin' "Dixie" -- it took me a while to figure out how to implement it, and that was even *after* you described the pattern. Heaven help me if I'd've been trying to noodle that out independently. I need another day or two to make sure I've solved clarkbriancarl's issues, then I'll write something up. Thanks! -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.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 -~--~~~~--~~--~--~---
[android-developers] Re: Observation and comments on Android and "regularly" scheduled events
Mariano Kamp wrote: > I use a static member for that and it makes my eyes bleed. Umm...hmm...well...er... If you want your service to completely go away between alarms, you need your BroadcastReceiver to be registered via the manifest, rather than tied into the system via registerReceiver() in the service. The latter approach would likely keep the Service referenced and kept from being garbage collected. Given that, we now need to allocate a WakeLock in a BroadcastReceiver and get it over to a newly-minted Service. WakeLock is not Parcelable. Hence, I see no way to get the WakeLock to the Service except through some static data member, somewhere. Whether that is a member on the Service, on the BroadcastReceiver, or in some third class is an implementation detail. On the other hand, using registerReceiver() would allow you to keep the WakeLock in the Service object without the static data member. It's a trade-off -- if your alarm will fire frequently enough, it might be better to keep the Service around rather than reallocating it all the time. If your alarm is rather infrequent, though, I'd think it would be better to let the Service go away and get reallocated when the alarm fires. I'll be writing up the infrequent-alarm case (even though my sample code will probably have the alarm going off every 5 minutes or so, just to provide more rapid feedback to those playing with the code). The good news, though, is that Ms. Hackborn's technique works great -- haven't missed an alarm in 12 hours (every 5 minutes), and the device definitely has been asleep between alarms, given the battery level. > And > it makes it harder to handle cases where start is called more than once. That problem can be dealt with, despite the static data member. Though I'll need to beef up my sample some for this scenario -- I was thinking the service would be long since wrapped up before the next alarm fired. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 2.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 -~--~~~~--~~--~--~---
[android-developers] Re: What about a virtual keyboard?
Nox wrote: > Hi everyone, > If I´m using the T-Mobile G1, then the QWERTZ- keyboard is very good. > But if I only want to use one hand, then I have to use the keyboard. > > Is it possible to add a virtual keyboard to the T-Mobile G1? > I've heard, the new HTC Magic (with Android) has got one!!! On-screen keyboards are being worked on as part of the forthcoming "cupcake" release. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android App 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 -~--~~~~--~~--~--~---
[android-developers] Re: How to place small icon in top-right corner?
Sebastian Pawlak wrote: > Hello, > > I need to place small icon (40x40px) in right-top corner > of a view. The problem is, that there will be many widgets > around such icon.. How to achieve my purpose? > (please see picture: http://img19.imageshack.us/img19/9904/androidk.jpg) > > Thanks in advance for help. If you are using RelativeLayout for the rest of the screen, just add the icon as another widget, anchored to the top and right. If you are using a series of nested LinearLayouts for your current widgets, either switch to a RelativeLayout. Or, you could wrap your top-most LinearLayout in a FrameLayout, add a RelativeLayout as a child of that FrameLayout (so it is a peer of the top-most LinearLayout), and then use the RelativeLayout to anchor the icon in the upper-left. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android App Developer Training: http://commonsware.com/training.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 -~--~~~~--~~--~--~---
[android-developers] Re: Observation and comments on Android and "regularly" scheduled events
Mariano Kamp wrote: > Now you would have two active wake locks and actually when using a naive > approach to a static variable you would have overwritten the old wake > lock, which would lead to the old lock not being releases which would > lead to the phone not shutting down. Have you tried using setReferenceCounted(true) on the WakeLock? From a glance at the WakeLock code, you should not need to have two WakeLocks in your case -- one reference-counted WakeLock should suffice. In the scenario you described: -- The activity tells the service, "yo! sync me!" -- The service acquires the reference-counted WakeLock (count now = 1) -- The alarm goes off and starts the service -- The started service acquires the *same* reference-counted WakeLock (count now = 2) -- The work from the activity-initiated sync wraps up and releases the WakeLock (count now = 1 and we are still locked) -- The work from the alarm wraps up and releases the WakeLock (count now = 0 and the lock is truly released) Admittedly, this is all theoretical, as I haven't tried reference counted WakeLocks, though I think I'm going to give that a shot here. > The short story is, passing in a wake lock using a > naive approach of a static variable doesn't work when the service can be > started again during its runtime. That depends on what your static variable holds. ;-) -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android App Developer Training: http://commonsware.com/training.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 -~--~~~~--~~--~--~---
[android-developers] Re: Observation and comments on Android and "regularly" scheduled events
Mariano Kamp wrote: > On Sat, Mar 28, 2009 at 4:37 PM, Mark Murphy <mailto:mmur...@commonsware.com>> wrote: > > Have you tried using setReferenceCounted(true) on the WakeLock? > > No, I didn't know about that. Sounds interesting. Thanks for the pointer. > > > In the scenario you described: > > -- The activity tells the service, "yo! sync me!" > > -- The service acquires the reference-counted WakeLock (count now = 1) > > -- The alarm goes off and starts the service > > -- The started service acquires the *same* reference-counted WakeLock > (count now = 2) > > -- The work from the activity-initiated sync wraps up and releases the > WakeLock (count now = 1 and we are still locked) > > Acquiring the wake lock in the service might be ok in the real world, > but conceptually this is too late. The OS could have put the phone to > sleep between the alarm going off and the service acquiring the wake lock. Ah, yeah, right -- the stuff I already have going. The BroadcastReceiver needs to have access to the WakeLock. If this is a registerReceiver() case, it can use the same object without resorting to a static data member; otherwise, it'll still need one. I'm working on this stuff right now. Well, OK, not right now, since I'm typing this reply, but I'll be working on it again as soon as I send this. Assuming, of course, that my personal wake lock doesn't lapsZz... ;-) -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 2.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 -~--~~~~--~~--~--~---
[android-developers] Re: How to find Jarsigner
Nox wrote: > Does anyone know how to install the JDK on Linux? > The location of the downloaded JDK is: > /home/viktor/Desktop/android-sdk-linux_x86-1.1_r1/jdk-6u13-linux- > i586.bin Usually, *.bin packaged JDKs are programs you run. But, generally speaking, installation instructions for the JDK should be available from where you downloaded the JDK. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 2.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 -~--~~~~--~~--~--~---
[android-developers] Re: How to find Jarsigner
Nox wrote: > So, how can I run or execute the JDK??? http://java.sun.com/javase/6/webnotes/install/jdk/install-linux.html -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 2.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 -~--~~~~--~~--~--~---
[android-developers] Re: Observation and comments on Android and "regularly" scheduled events
Dianne Hackborn wrote: > Yes you need to use a global variable for the wake lock. Gross, but it > works. OK, here's a cut at a sample app: http://groups.google.com/group/cw-android/web/Alarm.zip [NOTE: If you found this message in the archives and are reading it after June 1, 2009, please visit http://commonsware.com/AdvAndroid/ and download the source code from the link provided there, as the code probably has changed] It needs more testing, particularly for Mr. Kamp's scenario, but I think it has a chance of holding up. Note that if you try building it, adjust default.properties to reflect your SDK location, and you'll need an SD card (or card image in the emulator). The goal behind this example is to demonstrate what a lot of people have been requesting: cron-style functionality. Meaning, a scheduler should trigger their code on a fixed interval, including from the point when the device boots, and should cause the code to run even if the device is otherwise asleep. It also attempts to handle Mr. Kamp's scenario where the same logic might also be invoked beyond just the scheduler, and where the logic might sometimes run longer than the alarm period. When installed, it will set up a RECEIVE_BOOT_COMPLETED BroadcastReceiver, which in turn will set up an AlarmManager ELAPSED_REALTIME_WAKEUP alarm set to recur at five minute intervals. The app's "purpose" is to add an entry to a running log file on the SD card (placed there for simplicity when testing on a device). The actual work to log the data to the file is done by a WakeWorkManager. This class manages a background thread for a service with automatic WakeLock management for background work. It wraps a LinkedBlockingQueue and, so long as there is work in the queue, keeps a partial WakeLock. This allows the service (and the BroadcastReceiver that starts the service upon an alarm) to "fire and forget" -- work will get done and the service will stop when everything is done, with a WakeLock ensuring the device will run only as long as is needed. The service/BroadcastReceiver pair needs a second WakeLock to ensure that everything stays awake long enough to pop the work into the work manager. However, this second WakeLock is then released (the "forget" part of "fire and forget"). This second WakeLock is a static data member on the service class, which, as Ms. Hackborn indicates, seems unavoidable in the current Android SDK. C'est la vie. Right now, the WakeWorkManager uses only a single background thread. If jobs will routinely take longer than the alarm period (e.g., slow data transfer), you'll probably want more than one thread. Implementation of this is left as an exercise for the reader. I am definitely up for comments, particularly if you see that I am screwing up WakeLocks or whatnot. Either reply on this thread or join the cw-android Google Group and chime in there. Thanks to all who contributed ideas and insights, on this thread (e.g., Ms. Hackborn, Mr. Kamp) and on past threads (e.g., Jon Culverson). -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 2.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 -~--~~~~--~~--~--~---
[android-developers] Re: Insanely slow read() from HttpsURLConnection...
> So I have the following code... > > StringBuilder sb = new StringBuilder(4096); > > while (true) { > int i = in.read(); > if (i == 0) > break; > else if (i == -1) > throw new EOFException(); > sb.append((char)i); > } > > What I see (with thousands of times run) is that this code takes about > 1ms for every 7-10 bytes read... So reading just 10k takes almost a > SECOND! You could try: http://www.exampledepot.com/egs/java.net/ReadFromURL.html or: http://java.sun.com/docs/books/tutorial/networking/urls/readingWriting.html If you cannot get HttpsURLConnection to do what you want, you could try switching to HttpClient and using the Response Handler pattern from: http://hc.apache.org/httpcomponents-client/examples.html -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.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 -~--~~~~--~~--~--~---
[android-developers] Re: Can we call framework classes directly?
> e.g. it would be useful to call some methods in > com.android.camera.ImageManager / ImageLoader rather than trying to > copy / paste them into my project and figure out all missing > references etc. If they are not in the SDK, do not attempt to call them. If you feel there are classes that should be pulled forward into the SDK, file an issue at http://b.android.com so the idea gets tracked, or possibly submit a patch if you're in position to work on the firmware itself. -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.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 -~--~~~~--~~--~--~---
[android-developers] Re: Question about one application requiring another application or service
Streets Of Boston wrote: > Bump :-) > Has anyone dealt with a similar problem before? I will be dealing with a similar problem over the next month or so. Take these thoughts with a decent-sized grain of salt. >> I'm writing a user-app that allows the user to upload pics using a >> service. The service can be used by multiple user-apps, not just mine. >> I'd like to have the service being installed in its own apk, instead >> of bundling it with each user-app. >> >> Has anyone had experience with this scenario? Only theory, not practice as yet. >> What is the best scenario i should implement so that the user >> downloads the service that the user-app needs? U...that depends a bit on how you define "best". >> Can be this be done >> automatically (that would be best)? No. Android does not have a package management system that tracks dependencies (a la apt or yum in Linux). >> If not, in your opinion, what >> would be the most user-friendly way for doing so? Set up your UI to detect if the service is or is not installed. When the user clicks the menu choice (or whatever) that leads down the path where you need the service, display a "hey, you need to grab the such-and-so add-on to enable this feature -- click here!" screen. The "click here" would either open a Market Uri (if you're distributing the add-on via the Market) or your Web site (if you're not). They'd download/install the service and eventually wander their way back to your app, at which point you can detect that the service is available. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Warescription: Three Android Books, Plus Updates, $35/Year --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: How can i use vold(New volume manager daemon) to automatically mount sdcard when device startup?
Jiang Jiang wrote: > I am porting android to my own device now. Questions regarding porting Android to new platforms are best asked on discussion lists concerning porting Android to new platforms, such as [android-porting]: http://source.android.com/discuss This list is for developers using the SDK to build applications much more so than it is for firmware-level questions such as the ones you posed. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Warescription: Three Android Books, Plus Updates, $35/Year --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: How do I make my application to be restarted after the phone is powered-on again?
pperotti wrote: > Can anyone give me a hint about what should I do to make my > application to be restarted automatically after the phone has been > powered-off and powered-on again ? > > I read that regular alarms do not survive phone reboots so, I'm > assuming there should be a way to do it. You have to register a BroadcastReceiver to get control when the phone reboots and then re-register your alarms. We just had an extended thread on this very list on a related topic: http://groups.google.com/group/android-developers/browse_thread/thread/947fd3d0ed878c66# -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Warescription: Three Android Books, Plus Updates, $35/Year --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: How do I make my application to be restarted after the phone is powered-on again?
pperotti wrote: > Thanks Mark, I have just read also the response in the last update of > your latest book. That was fast! ;-) -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android App 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 -~--~~~~--~~--~--~---
[android-developers] Re: Webview Question: onCreate always get called when activity comes to foreground
j wrote: > I launch my TestWebView activity. After my web page is loaded, I put > the app in the background by pressing the Home key. Then I bring the > TestWebActivity back to the foreground. Unexpectedly, TestWebView's > onCreate() is called when I bring the activity to the foreground. But > onDestroy is never called. This same thing happens every time I > tested. It appears the old TestWebView was not completely killed so > there are possibly duplicate web clients running. U...I'm not seeing this in one of my WebView test projects. Visit http://commonsware.com/AdvAndroid, download the source code, and look at WebView/GeoWeb1. I just put a Log.w() call in onCreate() and things behaved as expected: I got the onCreate() when I first fired up the app, but when I clicked on Home, then clicked on the app again in the launcher, my existing instance popped right back up and I did not get a second onCreate() call. If I back-arrow out of the app and then relaunch it, I do get another onCreate(). Now, I'm not using setWebChromeClient() or a few of your other options, so it's conceivable that somehow changes matters. And you didn't post your manifest, so there might be something in there that impacts matters. But I'd start with some other WebView-using code (either mine or an API sample or something) and see if it gives you the same behavior. Assuming its onCreate() is not being fired multiple times, start tracking down the differences between your app and the working code. If you can narrow down the source of your difficulty, or if I misunderstood the pattern you used to cause the problem, let us know! -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android App 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 -~--~~~~--~~--~--~---
[android-developers] Re: Asset Image in WebView
Beginner wrote: > Hi, > > I'm trying to load an image (tried both gif and png) from my assets > directory, into a webview. > > In my assets folder, I have an image called myImage.gif > > Here's my code: > > WebView data = (WebView) findViewById(R.id.data) > data.loadData(" android_assets/myImage.gif\" />", "text/html", "UTF-8"); > > > All that happens when I try it, is that I get a blank screen with a > empty 42px/42px box. > > In logcat, I see the message: > > 03-30 00:21:14.398: DEBUG/WebCore(214): Console: Not allowed to load > local resource: file:///android_assets/myImage.gif line: 0 source: > > > What am I doing wrong? Try loadDataWithBaseUrl() instead of loadData(), supplying some bogus value for the base URL (e.g., fake://dagnabbit/would/somebody/explain/the/need/for/this). See: http://groups.google.com/group/android-beginners/browse_thread/thread/a66e63959bb89193/a7e8782c85076bf7 -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 2.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 -~--~~~~--~~--~--~---
[android-developers] Re: Asset Image in WebView
Beginner wrote: > Wow. That worked. Thanks a bunch. > > Is there a bug already opened for this? Or... There was a bug already opened. And closed. Without what I would consider an adequate explanation. It's one of my pet peeves, which is why I come up with slightly different fake URLs to try to get answers by poking fun at the problem. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 2.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 -~--~~~~--~~--~--~---
[android-developers] Re: Application that loops every minute - how to efficiently do it
simonc wrote: > Apparently the when you sleep() a thread it stops > running for the time given. That is the definition of sleep(). ;-) > I'm using it to ensure that my internet connection isn't ever open for > more than a minute something like this: > > while (true) { > if (getConnectionOpenTime()>1minute) { > closeConneection(); > } > Thread.sleep()1000*60; > } > > The connection gets re-opened elsewhere so this needs to keep looping. If this is happening in an Activity, you can use View#postDelayed() to schedule a Runnable to be executed after such-and-so delay. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android App 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 -~--~~~~--~~--~--~---
[android-developers] Re: RESTful user authentication
Wouter wrote: > But how can i make a restful webservice (in Java) where I can > authenticate a user.. Use HTTP authentication. See _RESTful Web Services_ (O'Reilly & Associates, 2007), Chapter 8, pages 238-243. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Warescription: Three Android Books, Plus Updates, $35/Year --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: RESTful user authentication
Wouter wrote: > How can i make a Java restful webservice with a (mysql) database? > I want to login and do other stuff later with the webservice like > getting data from a user, friend, places.. These questions are not Android questions. You will have better luck asking those questions some place that is focused on server-side Java. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 2.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 -~--~~~~--~~--~--~---
[android-developers] Re: how to add "--core-library" to Eclipse ?
Dan Bornstein wrote: > Maybe it needs some further wordsmithing. As another "for instance" of this error, I am working on Android-ifying some existing Java code that relies on java.beans.PropertyChangeListener and java.beans.PropertyChangeEvent. I can pull those files out of Apache Harmony, and they are nicely self-contained -- PropertyChangeEvent references PropertyChangeListener, but everything else they use are supplied by Android. When I tried putting src/java/beans/PropertyChangeEvent.java and src/java/beans/PropertyChangeListener.java in my source tree, though, I triggered the --core-library error message from dx. > In particular, dx > rejects the definition of classes in namespaces which are already used > by classes in the standard boot classpath or are likely to be defined > in future incarnations of the platform. The problem is that you put us out here in a bind: we can't use your classes (because they are not in the SDK) and you won't let us use our edition of those classes. I would recommend the --core-library dx error message have a link to some documentation page where this gets spelled out, so we know what to expect. In particular, a list of the prohibited namespaces would be handy, so we don't have to just guess what we can and cannot use. FYI, I have filed this in the issue tracker as: http://code.google.com/p/android/issues/detail?id=2329 -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 2.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 -~--~~~~--~~--~--~---
[android-developers] Re: cant read file from data/data/pkg/files/...
Komal wrote: > but i cant save image at runtime in the assets folder using > file:///android_asset/filename.jpg Assets are packaged inside the APK and are read-only. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android App Developer Training: http://commonsware.com/training.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 -~--~~~~--~~--~--~---
[android-developers] Re: cant read file from data/data/pkg/files/...
Komal wrote: > Can i read from data/data/pkg/files/filenm in java script/html page? I don't know. I have never tried it. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android App Developer Training: http://commonsware.com/training.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 -~--~~~~--~~--~--~---
[android-developers] Re: Error on adb push
guishenl...@gmail.com wrote: > Hi all, > When I tried to copy a file in my PC to the Android Emulator, I > used the command > "C:\Documents and Settings\Alioth>adb push D:\Data\Android\1.jpg \data > \data\". > But the it didn't work and the error message was > "failed to copy 'D:\Android\1.jpg' to '\data\data\': Read-only file > system". > I don't know what to do, can anyone help me ? 1. Android is Linux-based, so your path separator should be / instead of \ in the final parameter on your adb push command. 2. You may not be able to push files to /data/data on the emulator. You definitely cannot on a device. Your files do not belong there. Put them in /data/data/your.package.here/files, where your.package.here is the Java package associated with your Android application. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 2.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 -~--~~~~--~~--~--~---
[android-developers] Re: android.intent.action.TIME_TICK - Has anyone used it?
simonc wrote: > I'm trying to get an application / reciever / anything that can > perform a task once every minute. That seems harsh for battery life, but maybe there's more to this that I'm not privy to. > I can't seem to get it to send > the intent to my application and I can't find anything much on the > internet. Per the documentation: "You can not receive this through components declared in manifests, only by exlicitly [sic] registering for it with Context.registerReceiver()." In your case, you are trying to receive this through a manifest-declared receiver, which will not work. Either switch to a registerReceiver() implementation, or use AlarmManager. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android App Developer Training: http://commonsware.com/training.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 -~--~~~~--~~--~--~---
[android-developers] Re: Passing a 2 dimensional array to an Activity
Miguel Paraz wrote: > On Apr 1, 1:55 pm, Zhubham wrote: >> I need to pass a 2 dimensional array to an ACTIVITY from a SERVICE. >> How can I achieve this in minimum number of statements (as in avoiding >> putExtras for each and every string stored in the array)?? > > Hi, > You could use the JSON en/decoding functions. You can store lists and > maps of Strings. They probably consume more CPU, though. If the service is in the same process as the activity, you can use the singleton pattern and have the activity call some method on the service object. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android App 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 -~--~~~~--~~--~--~---
[android-developers] Re: Use native C/C++ libraries
gunar wrote: > Is it possible to use a native C/C++ library? If you are developing changes to the firmware, yes. Questions on this are best address to a mailing list appropriate for firmware-level discussions: http://source.android.com/discuss If you are developing an application designed to be installed on existing devices (e.g., off of the Android Market), no. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android App 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 -~--~~~~--~~--~--~---