[android-beginners] Re: Selecting a city & location
> I have an app in which I want to be able to select a location from a > list of cities, and find out the latitude / longitude for that city. > > Now surely I don't need to store all that data in the app myself? > There must be an "intent" or similar available already to get that > info? Certainly the "clock" & "weather" apps (on my htc hero) already > have a list of cities - can I somehow access that? The "clock" and "weather" apps (widgets?) on your Hero are proprietary and, AFAIK, have no documented Intents for anything, let alone getting latitude and longitude of a city from a list. I am not aware of anything built into Android that offers such an Intent. -- 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 Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Please Help Urgent: Get active context dynamically of an application
> Sorry if I lost my patient and posted it twice but you response > (>>If > you want that > fast of a response, please hire a consultant.) is bit harsh. Perhaps. Bear in mind that there are other resources besides these lists for getting help: http://www.androidguys.com/2009/06/22/youve-got-questions-thats-understandable/ If you do not think your questions are getting sufficient attention here, try StackOverflow, for example. -- 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 Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Please Help Urgent: Get active context dynamically of an application
>> I posted this questions twice. I will really appreciate your help. Am I >> asking very basic or vice versa? Or it is not possible in Android. >> Please >> help. I cannot speak for anyone else, but I saw and skipped your previous messages because you insist upon cross-posting to multiple lists, and I get tired of it. Please only post to one list at a time. You also reposted this twice within the past few hours. If you want that fast of a response, please hire a consultant. >>> The scenario is, I have an AsyncTask inside an activity_A. And on >>> successful completion (means in onPostExecute) of this AsyncTask I want >>> to >>> show a dialog >>> >>> (AlertDialog.Builder builder = new >>> AlertDialog.Builder(*Activity_A.this*);) >>> >>> >>> >>> But in the meanwhile(before completing this AsyncTask) if the >>> application >>> is moved to another activity_B. The above dialog context will not be >>> the >>> current Context so it will through an Exception. Bear in mind that there may not be a "current Context". The user might have exited your activity, for example. I am not aware of a 100% reliable way to raise a dialog triggered asynchronously, such as in onPostExecute(). One approximate answer is to have the activity register a listener object with the service (e.g., in onCreate()) and unregister itself later (e.g., in onDestroy()). The service would call a method on the listener object (if it is not null) to have the listener/activity raise the dialog. -- 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 Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Sense UI
> 'Where do i get the sense UI theme? Is it opensourced?" It is not open source, and AFAIK the theme is not distributed to third parties. -- 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 Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Scroll image like a WebView
> Scaling will not work, and yes, I need to scroll in both directions. > > This is for an Android port of Nethack: > > http://www.nethack.org/ > > For reference, here's an image of the WinCE port: > > http://images.google.com/imgres?imgurl=http://freewareppc.com/images/products/games/nethack.gif&imgrefurl=http://freewareppc.com/games/nethack.shtml&usg=__V2gViMypkQ0c-uVhdy-kZnJhC9Q=&h=206&w=168&sz=16&hl=en&start=1&sig2=LE6i0h0F_Y4qJ38HDPfA7g&um=1&tbnid=3nSzvzw93Y2NeM:&tbnh=105&tbnw=86&prev=/images%3Fq%3Dwince%2Bnethack%26hl%3Den%26client%3Dfirefox-a%26rls%3Dorg.mozilla:en-US:official%26sa%3DN%26um%3D1&ei=veq6SpzDFqiQtAPlp6mYCQ > > There's a large map, the tiles are 16x16 pixels, and scrolling in both > directions is absolutely required. > > This is really something that should be easy in Android, but I have no > idea how to do it. Try using the 2D graphics API (Canvas and SurfaceView). I suspect there are few, if any, games on Android akin to Nethack that attempt to use the widget API (ImageView and scrolling containers). I know that Ed Burnette's book _Hello, Android_ covers this API, albeit for a Sudoku game rather than something like Nethack. One of these days, I'll have to learn this stuff myself... -- 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 Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Phone call, recording
> And how about NDK? That would be a good question to ask on the [android-ndk] Google Group. -- 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 Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Phone call, recording
> Did Android SDK 1.6 provide api to work with call stream? (incomming/ > outcomming) Not that I have seen. -- 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 Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Possible to send object via intent extras?
> Is it possible to send an object via intent extras? > > I would like to send a pipeoutputstream to another APK (project via > extra). That is not possible. > Can I save an object to a bundle somehow? Only if you can make it implement Parcelable or Serializable. If you need to expose some sort of stream, you will need to wrap the stream in some API that you expose to other applications via AIDL. -- 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 Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: NDk c File operation
> o.s is Linux (ubuntu), i am having a simple .c program in NDk that > will do fopen(), fread(), > the .c file is compiling and library is getting built, but when i run > that project using emulator the fopen is returning NULL. > what i doubt is does NDk support file operation ? > if yes please let me know how to do that . Please post NDK questions to the [android-ndk] Google Group: http://groups.google.com/group/android-ndk -- 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 Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Active and deactivate the Wifi Radio
> Hello everyone,how can I do to enable and disable the Wifi Radio? Try WifiManager#setWifiEnabled() > If I try to instantiate the object > > WifiLock wifi = new WifiLock (); > > tells me that the costructor is not visible! Correct. > What should I do? Use WifiManager.createWifiLock() if you truly need a WifiLock. -- 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 Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Communicate between two threads
> i've used the handler approach, and it gets really, really ugly. i have > this huge switch statement covering all the possible messages. it's so > ugly it made me think i must be doing something wrong. I usually use the Runnable-consuming methods on Handler (post() and postDelayed(), also available on all subclasses of View) to get around this. But, then again, I code in Ruby when I am not doing Android development, so I am used to the quasi-closure structure you get with Runnable objects. -- 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 Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Communicate between two threads
> could on also use a dedicated broadcast receiver? for example, the > activity registers a BR that has a handle to the activity itself. the > client then sendBroadcasts() to the BR? Yes, but that would be a lot more overhead and a lot more public. Intents are broadcast to the device as a whole, not just within your application. Ordinarily, I would have suggested AsyncTask, but I believe the threading model the OP needs for the ServerSocket will not work well with the AsyncTask framework. -- 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 Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Communicate between two threads
> What is the best way now, to pass information (IP or client socket > object) between the two thread? > > (so that I could update the ListView in thread one when new incoming > socket is accepted) Use a Handler, to send either messages or Runnable objects to be executed on the UI thread. -- 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 Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: RUN App problem
> > I am getting the following error dialog on the Emulator everytime any > of my Apps was about to start: > > SORRY! > The application com.android.demo.notepad1 (process > com.android.demo.notepad1) has stopped unexpectedly. Please try again. > > Any ideas, hints, suggestions...will be most welcomed. Look at your Java stack trace via adb logcat, DDMS, or the DDMS perspective in Eclipse. It will tell you where you are going wrong. -- 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 Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: make my own libraries
Michael Dorin wrote: > Hello, > I am making libraries that I would like to use on different projects. > So far I am just copying the code in... > > Is there an easy way to make a 'library' project...and I import? That depends on what you want in the library. If the library is just Java code (perhaps using Android SDK APIs), then you can just package up the compiled class files into a JAR. Then, drop that JAR in the libs/ directory of projects wishing to reuse the code (and, if you are using Eclipse, add that JAR to the build path). You can see samples of this technique in some of my CommonsWare Android Components: http://github.com/commonsguy/cwac-adapter http://github.com/commonsguy/cwac-sacklist http://github.com/commonsguy/cwac-endless Look at the "jar" target I added to the build.xml files in each of those projects. This approach has limitations: -- You cannot package resources, so your classes must accept resource IDs as parameters, or you can use Resources#getIdentifier() to try looking up the resource ID by name (though this may be slow). -- While you can put activities and other components in the JAR, the application wishing to use those components still needs to declare those components in its manifest. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy _Beginning Android_ from Apress Now Available! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: auto-enable GPS
martin-g ml wrote: > Honestly I was expecting such kind of response from both of you :-) > The secret sauce is "android.permission.WRITE_SECURE_SETTINGS". Note > _SECURE_. This is the only place where Android didn't tell me "You need > XYZ permission to do ..." so far. You are correct that I had the wrong permission in my previous post -- I apologize for the error. On an Android 1.6 emulator, and on a retail (non-rooted) T-Mobile G1 running Android 1.5, creating and installing an application that attempts to request android.permission.WRITE_SECURE_SETTINGS results in: WARN/PackageManager(56): Not granting permission android.permission.WRITE_SECURE_SETTINGS to package com.commonsware.android.syssvc.settings (protectionLevel=3 flags=0x44) Attempting to then write to Settings.Secure blows up with the exception Mr. Nanek noted. My guess is that the act of rooting a device, or at least via whatever techniques you used, means you are allowed to install applications that request android.permission.WRITE_SECURE_SETTINGS. If you have a non-rooted device, try it, and let me know if it still works for you. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy _Android Programming Tutorials_ Version 1.0 In Print! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Unable to reference custom class in xml
MagouyaWare wrote: > I am not able to successfully reference an internal subclass of a view > in my xml layout file. > > I followed the example in the Dev Guide and the NotePad example in API > Demos and it is not working. I'm sure it has got to be something > simple that I have overlooked or missed. > > Here is what I have: > > A package named com.magouyaware.appswipe, a class called > ActivityListView that inherits from Activity, and a nested inner > class named RunningTaskGallery that inherits from Gallery. > > According to the Dev Guide, I would reference it in the layout file as > follows: > > > However, this results in: java.lang.NoSuchMethodException: > RunningTaskGallery(Context,AttributeSet). I double-checked just to > make sure, but this constructor does indeed exist. > > Any ideas? Try replacing your $ with a . and see if that works. $ notation is used in things like stack traces, but in Java code, the dot is the separator (think LinearLayout.LayoutParams and Settings.Secure). -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy _Android Programming Tutorials_ Version 1.0 Available! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: auto-enable GPS
martin-g ml wrote: > Sorry Mark, with all my respect I have to disagree with you. > I'm not sure whether this is some deep secret (I guess not, because I > borrowed this code from Settings app): > String allowedProviders = LocationManager.GPS_PROVIDER + "," + > LocationManager.NETWORK_PROVIDER; > Settings.Secure.putString(getContentResolver(), > Settings.Secure.LOCATION_PROVIDERS_ALLOWED, allowedProviders); > > This will enable both GPS and Network providers (at least in 1.5, I > haven't tried 1.6 yet). As Mr. Nanek pointed out, your code only should work if you somehow hold the android.permission.WRITE_SETTINGS permission. To quote from the documentation for Settings.Secure: "Secure system settings, containing system preferences that applications can read but are not allowed to write. These are for preferences that the user must explicitly modify through the system UI or specialized APIs for those values, not modified directly by applications. " http://developer.android.com/reference/android/provider/Settings.Secure.html Certainly, whenever I try to set a Settings.Secure permission, it fails. I demonstrate this at least once a month in my training classes. Admittedly, I demonstrate it with INSTALL_NON_MARKET_APPS and not LOCATION_PROVIDERS_ALLOWED. All that being said...any idea how your code is working for you, when by rights it shouldn't? I haven't rooted any devices, so I don't know if what you are seeing is expected behavior for a rooted device or not. > I also searched in the forums and mailing lists to find how to do that > and I read some explanations like "doing it automatically without user's > knowledge is _forbidden_ because this effects the battery life". Actually, I was under the impression that it as much, if not more, an issue of privacy as it was battery. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy _Android Programming Tutorials_ Version 1.0 Available! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: auto-enable GPS
niksbin wrote: > Hi Everyone, > > I was doing some research on the web. I found this program that helps > if the Android-phone is lost or stolen. However, the description > indicates that automatically enabling GPS is not possible within/via > the app? Here is the URL for the app I found: > > http://www.androlib.com/android.application.org-ajeje-locservice15-zxw.aspx > > Can you tell me if this is true? Yes. > If so, is there a work-around to > this as a feature for a GPS app? No. > I was actually thinking of creating > a location-based app, but am surprised to see this. If the user disables GPS, that is the user's right. If the user has GPS enabled, the GPS radio is still normally off, for battery reasons, but it will automatically turn on once you request location updates or something. Similarly, the radio will automatically turn off once you stop using it. -- 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 Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: SecurityException for Browser activity in TabWidget
jotobjects wrote: > If the tab navigates to another activity with a new window that might > not be too strange. To each their own. I'd find it unusual to click a tab only to have the whole tab set vanish, but that's just me. > In any case, starting another Activity is not one of the built-in > content choices for TabActivity tabs (either views or intents). No, but you can add a listener to find out when tabs are selected. > It > would take some kind of trick to call startActivity() when the tab is > clicked. Try setOnTabChangedListener() on TabHost. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android 1.5 Programming Books: http://commonsware.com/books.html --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: SecurityException for Browser activity in TabWidget
jotobjects wrote: > What I thought I was trying to accomplish was to get some other > activity to display in the frame under the tabs. Is there a way to do > that? If it is your activity, you can put it in a tab. If it is an activity from another application, you cannot, nor can you integrate its UI into your UI in any other way. > If that is not possible, would it be possible to at least call > startActivity() when the tab is pressed? Sure, but that will start the activity, which will then use the screen. It will not put that activity in a tab, and it will result in a rather strange user experience. > What can you do with an Intent other than call startActivity()? You can broadcast it. You can find activities that support it via PackageManager. You can start services with it. And so on. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Looking for Android opportunities? http://wiki.andmob.org/hado --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: SecurityException for Browser activity in TabWidget
jotobjects wrote: > Not sure how the system knows who wrote an activity :-) By the package for the application that contains the activity. > In another experiment I tried invoking another activity (that I did > write) that is in a different application (that I did write) and got > the same exception. Sorry, I was a bit glib in my earlier response. Generally, it is based on application. It is possible that via sharedUserId tricks you could get Application A to have Application B's activities in its tabs, but I'm not sure if that works. > So it appears that in a tab widget perhaps(?) you cannot invoke > activities in another application even if you can invoke those > activities directly with startActivity(). Correct. > That is an observation - > not sure if that is documented. I wish it were. > What is the principle (about tasks or permissions) about why that is the case? Security. You cannot have Application B's code running in Application A's process space without security issues. That's why the sharedUserId trick *might* work, since that allows A and B to run as the same user. This is also the reason why there is the whole RemoteViews framework to allow applications to define lightweight UIs that serve as app widgets -- that UI has to be run in the home screen's process. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Need help for your Android OSS project? http://wiki.andmob.org/hado --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: SecurityException for Browser activity in TabWidget
jotobjects wrote: > Here is a SecurityException I don't understand. The following code is > in onCreate() for a TabActivity object. There is a TabWidget in the > layout file. The code works for tabs with Views and ViewGroups, but > when I put an Intent as the content in a tab I get this error. > > The same intent works find if I call startActivity() directly. I do > have android.permission.INTERNET set in AndroidManifest. > > Are there limitations on the kind of activity intent that can be used > in a tab? It has to be one you wrote. You cannot embed third party activities into your tabs. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Looking for Android opportunities? http://wiki.andmob.org/hado --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Analog clock
android learner wrote: > I read on another forum that android does not allow > one to create custom classes for home screen widgets. Is that true? Yes, that is true. You are limited to the handful of classes that RemoteViews supports. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Looking for Android opportunities? http://wiki.andmob.org/hado --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: launch app from an app
Abhi wrote: > Thanks Mark. > > Can you give an example for launching the Youtube app from within my > app? I have tried startActivity() to open up Gallery this way: > > Intent intent2 = new Intent(); > intent2.setClassName("com.android.camera", > "com.android.camera.GalleryPicker"); > intent2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); > startActivity(intent2) > > Couldn't understand how to do it with other apps. You will need to use methods on PackageManager to determine an appropriate activity to use for that package. getLaunchIntentForPackage() is probably worth trying. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android 1.5 Programming Books: http://commonsware.com/books.html --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: launch app from an app
Abhi wrote: > I am making an app which when running may need to open another app > thats installed on my phone. The other app(s) are the ones not > developed by me and I would only like to launch these apps if/when > needed. > > Any help around making this work will be appreciated. Call startActivity() to open up whatever activity you want from the other app(s). -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android 1.5 Programming Books: http://commonsware.com/books.html --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: onStop / onPause / onDestroy with Threads
Ives wrote: > i uses the combination of Handler and Threads to fetch images for my > app. > > I wanted to know if I had create a inline thread: > > class > { > public someMethods() > { > > final Handler h = ; > > Thread thread1 = new Thread() > { > @Override > public void run() > { > // use Handler h to notify when complete > } > }; > thread1.start(); > > } > } > > what happens if each of these method was called by the system: > onPause, onStop, onDestroy > > Am I correct to assume for onDestroy, a RuntimeException will be > thrown as the object Handler h and whatever the Handler tries to > access has already been cleared by the system. Generally speaking, that is not correct. The Handler and its underlying Activity are not "cleared by the system", because you still hold references to them. The Activity will not be on the screen, and so whatever you do will not be visible. And, it is conceivable that you will do something that will cause a disconnected Activity to fail with an Exception, but you should not be relying upon that behavior. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy _The Busy Coder's Guide to *Advanced* Android Development_ Version 1.1 Available! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Arayadapter only shows text when highlighted
Android_n00b wrote: > For example, if I start typing the characters of January, I should see > the word January appear below the textbox (like how google suggest > works). So my program seems to be working, but when I start typing Jan > for example, a box appears below with the word January in it, but I > can only see the text when it is highlighted. So for some reason, the > text is the same colour as the background box(white in this case). > Anyone know why this is happening? What layout are you using for the ArrayAdapter used for the AutoCompleteTextView? http://developer.android.com/guide/tutorials/views/hello-autocomplete.html ArrayAdapter adapter = new ArrayAdapter(this, android.R.layout.simple_dropdown_item_1line, COUNTRIES); If you do not wish to use android.R.layout.simple_dropdown_item_1line, that is fine, but you will need to then adjust your own custom layout to have the right color scheme for drop-down lists. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy _The Busy Coder's Guide to *Advanced* Android Development_ Version 1.1 Available! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Unknown host www.google.com (was Re: debug.keystore is missing)
> after changing the SDK directory back and forth, the SDK was reloaded > and the debug.keystore was created. now i'm back to the unknown host > exception for google, > > 09-17 11:16:07.003: INFO/InetAddress(756): Unknown host www.google.com, > throwing UnknownHostException Forgive me if any of this was covered earlier in the previous thread... -- Do you have the INTERNET permission in your manifest? -- Can you get to www.google.com from the built-in Browser application? -- Does the built-in Maps application work? If the latter two are "no", this is probably a networking issue, perhaps due to a proxy server or firewall. If you can get to www.google.com from your emulator, but you do not have the INTERNET permission in your app, add it -- you need that for Maps to work. If you can get to www.google.com from your emulator *and* you have the INTERNET permission...ummm...I got nuthin'. -- 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 Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Terminate call programmatically
Chris Stratton wrote: > On Sep 17, 7:12 am, Mark Murphy wrote: > >> 2. You cannot "hangup/terminate call programmatically" from an SDK >> application. > > Can you turn off the radio / enter airplane mode? Or will that only > pop up a dialog for the user? I think you can programmatically enter airplane mode through Settings.System, though I have not tried it. However, to hang up a phone call, going into airplane mode is a bit aggressive -- you take out WiFi, Bluetooth, and perhaps GPS (not sure if airplane mode affects that). In terms of turning off just the GSM/CDMA radio...there might be a way, but I don't know how. -- 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 Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Development Phone
AngelOD wrote: > On Sep 16, 1:31 pm, Mark Murphy wrote: >> I have seen no evidence that HTC makes firmware upgrades available >> directly. They always handle that through whoever distributed the device >> (e.g., T-Mobile for the T-Mobile myTouch3G version of the Magic). So, if >> you got your device from your carrier, I would expect the carrier will >> say when and how to upgrade it, assuming they support such an upgrade. > > Erm.. Normally you definitely know what you're talking about, but in > this case, I'll have to say you really don't. Sorry. :) > > HTC released an update to the Hero firmware less than a week ago. It's > not the 1.6 release, obviously, but it -does- goes to show that they - > do- make upgrades, instead of relying on the carriers to do that. > Proof would be here.. > > Europe: http://www.htc.com/europe/SupportViewNews.aspx?dl_id=671&news_id=254 > Nordic: http://www.htc.com/dk/SupportViewNews.aspx?dl_id=671&news_id=254 IIRC, this thread originated with inquiring about upgrading Android versions, and I see no upgrades on HTC's site that would do that. For example, AFAIK, the HTC Dream was sold in Europe before Android 1.5 shipped, but the only download for it is an HTC Sync Upgrade, which does not sound like Android 1.5. So, you are correct that I made a broader-than-necessary claim in the above-quoted passage. I apologize to anyone I confused. If you can find evidence that HTC ships ROM upgrades that include Android version upgrades (e.g., 1.5), let me know! > From what I can see there's no such upgrade for the Hero in the US... > I dunno, maybe the carriers have made different rules for their > phones? I suspect that is the case. US mobile carriers, at least, seem to play by different rules than European carriers, for better and for worse. > Btw, love your books! ^^ Thanks! -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android Development Wiki: http://wiki.andmob.org --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Development Phone
pro wrote: > First google seems to ran out of stock for dev phone, and if I recall > the site instruction does not quite explain - rooting or whatever > needed, third for some of us are already buried down to bargain > basement so ebay or other sites seems to be logical alternatives :) Yes, this is a problem. I'd build a phone myself, but I do not have nearly enough LEGO bricks. > Is there any pointer for "rooting" technique? Google "android rooting" and you get a million or so hits. That being said, you should also read: http://androidandme.com/2009/09/hacks/why-not-everyone-should-root-their-android-phones/ > For the emulator, then there must be a way to tell the canvas sizes > ( i.e 360x480 or something )??? http://developer.android.com/guide/developing/tools/avd.html You can try using the -s - option, but I do not know how well it will work if you are using unsupported sizes. That's a better topic for the [android-porting] list, anyway. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android Training in Germany, 18-22 January 2010: http://bignerdranch.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Terminate call programmatically
Ajaz Ahmed wrote: > Hi, > > Can any one tell me how can i hangup/terminate call programmatically? > With the help of intent. 1. Please do not cross-post. Post to a single list only, and only post to another list if you do not get a response in a reasonable period of time (e.g., 1 day). 2. You cannot "hangup/terminate call programmatically" from an SDK application. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy _Android Programming Tutorials_ Version 1.0 In Print! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Manifest file
senrooy wrote: > I am new to android. I am using SDK and eclipse with ADT plug-ins for > the first time. I want to know what is the significance of the > AndroidManifest.xml file which is created automatically when we create > an android project. There is a Web page in the Android documentation that covers this: http://developer.android.com/guide/topics/manifest/manifest-intro.html > Can we modify this file for any reason? You can modify it when you need to. If you are using Eclipse, it may make some modifications for you, but other changes you may need to make yourself. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy _Android Programming Tutorials_ Version 1.0 In Print! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: How to change the Typeface of ListView and Spinner
andu wrote: > How are you all! > > I am developing android application. currently I am creating a user > interface in my language, Amharic. I can change the font for Textview, > button and other controls. But I can change the font for ListView and > Spinner control. When I search the internet I found out that Listview > and spinner has their own textview to keep the text. But I don't know > how to access the textview component of this controls. > > 1. How can I change the typeface of Listview and Spinner? or > 2. How can I access the built-in textview of these component so that I > can change the typeface for the textview? You will need to take control over what goes into the ListView and Spinner. I have not experimented with these techniques on Spinner, but on ListView, you will need to override getView() (on ArrayAdapter) or newView() and bindView() (on CursorAdapter). Here is a free excerpt from one of my books that demonstrates the technique: http://commonsware.com/Android/excerpt.pdf In your case, you would use your Typeface object to update the font used by the TextView widgets in your rows. In principle, you could do this via a wrapping adapter -- this would be more reusable but a bit slower. I have an AdapterWrapper base class here: http://github.com/commonsguy/cwac-adapter and some projects that use it here: http://github.com/commonsguy/cwac-endless http://github.com/commonsguy/cwac-thumbnail -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy _Android Programming Tutorials_ Version 1.0 In Print! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Development Phone
pro wrote: > > I'm also very new to Android. And I would like to have the following - > > 1) I want to add and / or del any apps I want to - For this just any > phone would do it? Or I need an unlocked one? All existing Android devices allow you to install third party applications and remove those third party applications. > 2) I would also like to craft part of OS and / or base framework - For > this, Is it enough to have an unlocked phone ? I'm getting a T mobile > G1 unlocked, is it fine for (2)? You can either get an actual developer phone (ADP1 or Google Ion) that allows for firmware flashing, or you can get a consumer phone and use the various "rooting" techniques. > 3) I think the emulator should allow us to test out various form > factors, since it might not be possible to buy and test all available > phones out there... It does, for the form factors that are officially supported by Android. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Need help for your Android OSS project? http://wiki.andmob.org/hado --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Hierarchy Viewer
manigault wrote: > I try to use Hierarchy Viewer tool and for the simulator it works fine > but for the real phone it doesn't. When i started the real device is > listed in the section with the devices but when i press "start server" > the server doesn't start, no logs on the console also. Unfortunately, hierarchyviewer does not work on actual production Android devices. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Need help for your Android OSS project? http://wiki.andmob.org/hado --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Math functions in Android - HELP
GlennovitS wrote: > Hey > > I'm about to make an app with some different math functions.. > > How can I make a TAN, COS, and SIN function in andriod?. I dont know > how to start on this.. > > Please help me.. Look at the Math class: http://developer.android.com/reference/java/lang/Math.html This is standard Java, nothing unique to Android. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Need Android talent? Ask on HADO! http://wiki.andmob.org/hado --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Screen orientation
Neilz wrote: > How do I test screen orientation on the emulator please? Can I tell it > to switch orientation just like you would on the real device? Windows/Linux: - Mac with numeric keypad: <5> on the numeric keypad -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy _Android Programming Tutorials_ Version 1.0 In Print! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Development Phone
Rafa Perfeito wrote: > No T-Mobile for me. TMN from Portugal... Oops. Sorry. Too early for me to be writing emails, apparently. This does not bode well for the blog post I am working on... > But that means that the carrier itself enables the update? I have seen no evidence that HTC makes firmware upgrades available directly. They always handle that through whoever distributed the device (e.g., T-Mobile for the T-Mobile myTouch3G version of the Magic). So, if you got your device from your carrier, I would expect the carrier will say when and how to upgrade it, assuming they support such an upgrade. This is one of the many, many reasons why I hope Android spawns a robust market for devices not tied to a carrier, where you get the device from a device manufacturer and use it with a mobile carrier. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Need Android talent? Ask on HADO! http://wiki.andmob.org/hado --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Development Phone
Rafa Perfeito wrote: > I have an HTC Magic from a carrier. Can i update to > 1.6? How? Through the carrier? T-Mobile has not yet announced plans for Android 1.6 for any of their devices. At some point, in all likelihood, they will make such an announcement. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Need Android talent? Ask on HADO! http://wiki.andmob.org/hado --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: how to change text in a Button
cellurl wrote: > Heres my code. > I don't see a .setText for View. Button is a subclass of View. >private void findViews > // Set up click listeners for all the buttons > View aboutButton25 = findViewById(R.id.about_button25); Button aboutButton25=(Button)findViewById(R.id.about_button25); -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android Development Wiki: http://wiki.andmob.org --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: For a project demonstration, any way to clone device screen on a monitor?
Kevin Grant wrote: > Using android / G1 as a platform in a game development class I'm > taking. We need to be able to do project presentations, and was > wondering if there was any way to clone the device screen onto a > monitor with the USB cable somehow. I would just load the game into > the emulator and run it from there, but the game itself uses motion > control, which would be difficult not only to set up, but also in > trying to demonstrate game play. You can give DroidEx a shot: http://www.androidguys.com/2009/01/30/projecting-android-on-the-big-screen/ I use it all the time when I deliver Android application development training, for the reasons you seek. I need to do more with it (better UI, handle screen rotations, allow recording, etc.), which I hopefully will get to before year's end. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy _Beginning Android_ from Apress Now Available! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Views right of long SingeLine Textviews disappear
> I'd like to position an ImageView right of a TextView which has > SingeLine set to "true". What happens is that if the string in the > TextView is too long, the ImageView gets pushed out of the screen and > gets not displayed! Does anyone have an idea how to prevent that? Don't use a LinearLayout and android:layout_width="wrap_content" for the TextView. Either of the following should work: 1. Use android:layout_width="0px" and android:layout_weight="1" for the TextView. This says "use all space not used by the rest of this row". 2. Use RelativeLayout instead of LinearLayout and make the TextView use android:layout_toLeftOf="...", where ... is the ID of your ImageView. -- 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 Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Basic App -- not working
Felix Oghina wrote: > I went through the NotePad tutorials and got the minimum hang of it. > Unfortunately, when I tried creating my own application, I failed. > Here's my main class file: > > package com.tastekid.TasteKid; > > import android.app.Activity; > import android.os.Bundle; > > public class TasteKid extends Activity { > > @Override > public void onCreate(Bundle savedInstanceState) { > super.onCreate(savedInstanceState); > setContentView(R.layout.main); > } > } > > Here's main.xml: > > > http://schemas.android.com/apk/res/ > android" > android:orientation="vertical" > android:layout_width="fill_parent" > android:layout_height="fill_parent" > > > android:id="@+id/search_input" > /> > > > When I try to start the app on the emulator I get an "The application > TasteKid (process com.tastekid.TasteKid) has stopped unexpectedly. > Please try again." with a "Force close" button. I have absolutely no > idea what I am doing wrong :-( Look at the Java stack trace via adb logcat, DDMS, or the DDMS perspective in Eclipse. It should give you some clues. For example, it may be that you did not register your activity class in your application's AndroidManifest.xml file. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android Training in Germany, 18-22 January 2010: http://bignerdranch.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: New to android
senrooy wrote: > I am studying the basic concepts of android for last one week. I am > from C/C++ (linux) background. Do I need java knowledge to handle > android applications? Generally speaking, yes. While there is the Native Development Kit (NDK), it is designed to create extension (JNI) libraries for Java applications. The Android SDK, for creating such applications, requires Java (and, to an extent, XML). -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android Training in Germany, 18-22 January 2010: http://bignerdranch.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: alarm manager confusion
Jeffrey Blattman wrote: > mark, "perhaps some sort of service" is a little vague. Generally speaking, if your manifest-registered BroadcastReceiver will be doing things that are short (say, under a second), you won't need one -- just do all your work in the BroadcastReceiver. If you are going to do things that may take longer than that, such as uploading something via the Internet, you'll need to delegate that work to a service that can do things in a background thread (e.g., IntentService). A manifest-registered BroadcastReceiver cannot fork a thread, and it is called on the "UI thread", which does not support time-consuming operations. > the AM schedules an alarm that calls a receiver that does three things, > > 1. updates some data that is shared with the activity You don't indicate where, but I'm going to assume the data is on the device, not the Internet. > 2. sends notifications > 3. broadcasts back to another receiver that updates the activity, if > it's running (the activity registers / unregisters the receiver in > onResume(), onPause(), so it doesn't get called if it's paused or stopped). > > i *could* have the scheduled BR call a service like in your example, but > why can't i just have the scheduled BR do the work? Assuming #1 above is not too time-consuming, you can. > why would that make > a difference as to whether the BR is being called or not, which is the > root of my problem? In my first reply, I wrote: "You could encounter that behavior if you registered your BroadcastReceiver via Java, instead of via the manifest." You never stated, in any of your messages, how your code sets up your BroadcastReceiver. And, since the only way to really use AlarmManager effectively is to use a BroadcastReceiver registered via the manifest, I have been trying to steer you in that direction. If I am correct, and presently your alarm-catching BroadcastReceiver is registered via registerReceiver() in some Java code, then that will only respond to alarms so long as whatever contains it (e.g., activity) is running. In this case, change your application logic to have the BroadcastReceiver be its own standalone public class (vs. an inner class of something else), dump the registerReceiver() and unregisterReceiver() calls for it, put it in the manifest via a element, and see if that improves your results. The example I have been pointing you to demonstrates receivers registered this way. There are a few other examples of this technique in the SystemEvents set of projects. If you *do* have your BroadcastReceiver registered via the manifest, though, and you're not getting the alarms, then something else is afoot. -- 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 Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: alarm manager confusion
Jeffrey Blattman wrote: > as i noted i'm using alarm mgr + broadcast receiver. my activity > schedules the alarm. if the activity is destroyed (off the stack, not > just in the background), i don't get the alarms. Correct. As I wrote: "If you have a running activity, but you want scheduled alarms to trigger code even if the activity is not running, you need a BroadcastReceiver and perhaps some form of service, as per the example I pointed to." -- 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 Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: alarm manager confusion
Mark Murphy wrote: > There is no reason to use AlarmManager for an activity, and I would not > expect AlarmManager to behave very well for an activity. To clarify: if you have a running activity, and you want the activity to do things on a periodic basis, either use Timer/TimerTask (like an ordinary Java application), or use View#postDelayed(). If you have a running activity, but you want scheduled alarms to trigger code even if the activity is not running, you need a BroadcastReceiver and perhaps some form of service, as per the example I pointed to. -- 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 Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: alarm manager confusion
Jeffrey Blattman wrote: > as far as i can tell, scheduled alarms are only executed if the app that > scheduled them is active. That is not true. The code I gave you demonstrates that. > in your example, you start a service that never quits obviously. Sure it does. My service inherits from IntentService: http://developer.android.com/reference/android/app/IntentService.html "The Service will automatically be stopped when the last enqueued Intent is handled." > i don't have a service, i'm starting the alarm manager from an activity. There is no reason to use AlarmManager for an activity, and I would not expect AlarmManager to behave very well for an activity. > services can be ejected > from memory, and often are as people drive their phones hard as they > will. If services are ejected from memory due to low-memory conditions, either an activity or a service is misbehaving. That being said, services aren't supposed to be in memory all the time: http://www.androidguys.com/2009/09/09/diamonds-are-forever-services-are-not/ > everything works fine on the emulator when you're running one > thing at a time. in the real world, when i debug on my device, i see > "low memory, no more background processes" scrolling by in the log quite > often. See above. > still looking for an answer. I gave you one. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Looking for Android opportunities? http://wiki.andmob.org/hado --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: alarm manager confusion
Jeffrey Blattman wrote: > i want to schedule a repeating task. i start my app, and register with > alarm manager (repeating). all is fine, as long as my app is in memory. > if i for example press back to remove my app from the stack, i no longer > receive alarms. same thing if i manually kill the app. > > is this correct? my understanding is that once the alarm is scheduled, > it repeats regardless of the state of the app. You could encounter that behavior if you registered your BroadcastReceiver via Java, instead of via the manifest. Here is some sample code from one of my books that demonstrates the use of AlarmManager and putting the alarm's BroadcastReceiver in the manifest: http://github.com/commonsguy/cw-advandroid/tree/master/SystemServices/Alarm That example is somewhat more elaborate, as it demonstrates WakeLock management and delegating long-running work to an IntentService, capabilities your app may or may not need. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Looking for Android opportunities? http://wiki.andmob.org/hado --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: onSaveInstanceState question
jason wrote: > Is there a way for an (sub-)activity to pass values to the previous > activity on the stack (when Back key is pressed) without resorting to > persistence storage or static varables in the app? Use startActivityForResult() rather than startActivity() to start it, use setResult() to set the result, and use onActivityResult() to retrieve the result. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android Development Wiki: http://wiki.andmob.org --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: onSaveInstanceState question
jason wrote: > Is there a > way to trap Back key within an application and prevent/control this > behavior? Implement onKeyDown() in your activity and watch for KeyEvent.KEYCODE_BACK. Please bear in mind that your users will get irritated if you make it difficult for them to navigate your application, so make sure if you override the BACK button, it is for a good reason, not just because you do not like the BACK button. For example, with the built-in Browser application, the BACK button is used for going back in the browsing history. While this is fairly natural, I still get frustrated at times because I try to use the BACK button to exit the Browser and merely go back a page. When the vast majority of apps use the BACK button to exit the current activity, it is sometimes difficult for users to adjust to applications that choose to handle this differently. Or, possibly, I'm just a moron. > For sub-activity screens, does the Back key have the same behavior > (killing the app/activity) or does it go back to the parent activity > in the stack? If you are referring to activities started by one of your activities via startActivity(), then, yes, the BACK button behaves the same. The BACK button's job is to destroy the current activity and return control to the previous activity on the stack. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android Development Wiki: http://wiki.andmob.org --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: onSaveInstanceState question
Mark Murphy wrote: > If you wish to save something when the activity is being destroyed, > implement onDestroy() and save it. Where you save it (flat file, > SharedPreferences, database, the Internet) is up to you. > > Bear in mind that onDestroy() may also be called in the case of a screen > rotation or other configuration change, since, by default, the current > activity is destroyed and started in that case. Actually, I should point out that more common places to save this sort of stuff are onPause() and onStop(), since your process may be terminated by Android to rapidly free memory without onDestroy() being called. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android Training in Germany, 18-22 January 2010: http://bignerdranch.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: onSaveInstanceState question
jason wrote: > How does one then save and restore the application state when > the Back key is pressed and then the application is brought to > foreground? When the BACK button is pressed, the currently-running activity is destroyed, not put in the background. If you wish to save something when the activity is being destroyed, implement onDestroy() and save it. Where you save it (flat file, SharedPreferences, database, the Internet) is up to you. Bear in mind that onDestroy() may also be called in the case of a screen rotation or other configuration change, since, by default, the current activity is destroyed and started in that case. > The Bundle value in onCreate is null (perhaps because > onSaveInstanceState was not called when Back was clicked. More accurately, the Bundle is null because the application is starting from scratch. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android Training in Germany, 18-22 January 2010: http://bignerdranch.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: preventing Activity from destroying
Jason wrote: > The service is picking up GPS locations; and sending to the server. > Hence it needs to stay awake -- the server is tracking locations of the > user on the web. Keeping the service alive all the time is very bad for the battery. I provide an analysis of this here: http://groups.google.com/group/android-developers/msg/36bf61dfb78ef4cc In your case, it will be substantially worse, as you are keeping the GPS radio on all the time. If a G1 lasts 8 hours in that state, I'd be impressed. I also cover the fallacy of keeping services alive all the time in a recent blog post: http://www.androidguys.com/2009/09/09/diamonds-are-forever-services-are-not/ -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Need Android talent? Ask on HADO! http://wiki.andmob.org/hado --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: findViewById bug or documentation problem
jotobjects wrote: > ERROR IN DOCUMENTATION - see > > > http://developer.android.com/guide/topics/resources/available-resources.html > > --- quote -- > When declaring an ID value for an XML tag, use this syntax. Example: > , and refer to it this way in Java: > findViewById(R.id.nameTextbox) > -- end quote -- > > The above example is WRONG. It should be this way -- android:id="@+id/nameTextbox"/> Way back in the spring of 2008, you did not need the android: prefix on android:id. They changed that, but apparently missed this reference in the documentation. Most of the documentation is correct, AFAICT. You may wish to post this to http://b.android.com if it is not already there. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android Training in Germany, 18-22 January 2010: http://bignerdranch.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Call to activity problem
kapnk...@gmail.com wrote: > ok i tried it like u said but it crashing here it is how i tried please > check n tell me how to correct it > > > class someactivity extends extends Activity > { > > *public* *void* onCreate(Bundle savedInstanceState) { > > //... > > call(); > > > } > > public void call() > { > > > SmsReceiver _b_ = > > *new* SmsReceiver(getBaseContext()); > > // or i tried > > SmsReceiver _b_ =*new* SmsReceiver(getApplicationContext()) > > } > } > > > > // now in class SmsReceiver > > * > > public > > * *class* SmsReceiver *extends* BroadcastReceiver > > { > > *static* Context /mContext/=*null*; > > *public* SmsReceiver(Context baseContext) > > { > > /mContext/ = baseContext; > > } > > @Override > > *public* *void* onReceive(Context context, Intent intent) > > { > > //. > > Intent i = > > *new* Intent(/mContext/, neww.*class*); > > i.setFlags(Intent. > > /FLAG_ACTIVITY_NEW_TASK/); > > //startActivity(i); cant be used directally so used > > > > Activity nn = new Activity(); > > nn.startActivity(i); > > //or > > context.startActivity(i); > > } > } > > > but application crashesh as soon as it receives the sms.so please guys > help me sort out this.thank you Look at your Java stack trace for the exception (via adb logcat, DDMS, or the DDMS perspective in Eclipse), and it will probably indicate where things are going wrong. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy _Android Programming Tutorials_ Version 1.0 Available! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: How Can I Block Unwanted Calls.
Roman ( T-Mobile USA) wrote: > There are several similar threads about this on the forum. It seems > like you can block incoming calls using what is available on SDK/NDK > level. For example the application Panda firewall gives you the > functionality to block an incoming call. I have not had time yet to > find out how they are doing this. No idea whether they are using the > unofficial way ... Mark, tell us the secret :-) If I'm the "Mark" in question, I don't know the secret. Again, AFAIK, there is no officially supported way to do this. Every now and then, I'll talk about undocumented approaches, but I try to limit that to things that are non-critical (e.g., how to change the looks of tabs in TabWidget). Blocking incoming phone calls...even if I knew how to do it, I would not be discussing it on an open list like this. After all, malware might exploit this capability to block all incoming calls, or random incoming calls, or something. -- 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 Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: how to read sms from inbox
kapnk...@gmail.com wrote: > Does it also mean that there is knowway to do this? I am not aware of a documented and supported way to access the SMS inbox. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android Development Wiki: http://wiki.andmob.org --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Empty list
manigault wrote: > id="@id/android:empty" works for ListActivity but when i use it for a > listview which is in a regular activity it doesn't. How to show text > when the list is empty for a listview. For an empty list, just make the ListView be invisible (setVisibility(View.INVISIBLE)) and make an associated TextView be visible. Use FrameLayout (or RelativeLayout) so they can take up the same space in the GUI, just one or the other being visible. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Need Android talent? Ask on HADO! http://wiki.andmob.org/hado --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: how to read sms from inbox
eaindra nilar wrote: > Hi, > You can use this code for reading sms inbox > I already tried it > public class SmsApp extends Activity { > /** Called when the activity is first created. */ > @Override > public void onCreate(Bundle savedInstanceState) { > super.onCreate(savedInstanceState); > setContentView(R.layout.main); > String strUri="content://sms/inbox"; > Uri urisms=Uri.parse(strUri); > //try{ > Cursor c=this.getContentResolver().query(urisms, null, null, > null, null); > while(c.moveToNext()) AFAIK, this technique is undocumented and unsupported. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Need Android talent? Ask on HADO! http://wiki.andmob.org/hado --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: preventing Activity from destroying
Jason wrote: > I have a UI > activity that gets destroyed each time I click the Home, phone etc. keys > on the phone. By default, Android will not destroy your activity when you "click the Home, phone etc. keys on the phone". There are only two ways I can think of for your described scenario to occur: 1. You are destroying it yourself via finish(). 2. You are leaking memory at a tremendous rate and Android needs to close it to reclaim memory. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Looking for Android opportunities? http://wiki.andmob.org/hado --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: How to open application program AlarmClock in Eclipse IDE
anantha.jav...@wipro.com wrote: > I downloaded the AlarmClock app program from source.android.com. I would > like to know how I can open this in Eclipse IDE on a Windows > environment. You cannot modify firmware applications like AlarmClock as independent SDK applications. They rely on internal APIs not available in the SDK. You can download the whole firmware and there are ways to get all of its code available in Eclipse, though I am not familiar with the specifics. -- 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 Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: extracting service values from activity?
jason wrote: > I have an activity class that has started a service (within same > application). How do I extract the values set in the service class? Call a method on it. You can either: -- put the service object in a static data member on the service class and call into it that way, or -- create a binding in the service and use bindService() to get a handle to the binding, and use that to get your hands on the service object -- 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 Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: JSON help
Alok wrote: > Some way to put the myClassObj in JSONObject and send it to server. JSON works with arrays and "objects" (roughly a HashMap), not custom classes. So, if you want to put stuff in a JSONObject, you have to do it yourself via put() method calls. > On retreival i should be able to assign JSONObject to MyClass object > and all values such as code , message should be automatically > retrievable Use get() on the JSONObject. > I have seen some dot net examples whering serialization / > deserialization has been done to objects . How can i do it here? This has nothing to do with Android and everything to do with the JSON.org third-party library integrated in by Android. A quick Google search for: java jsonobject turned up: http://java-x.blogspot.com/2007/04/using-json-from-java.html http://stackoverflow.com/questions/944285/how-to-create-a-json-object-in-action-class-of-java -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy _The Busy Coders' Guide to *Advanced* Android Development_ In Print! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: directions intent?
Jeffrey Blattman wrote: > i'm fairly certain the answer to this is no, but i was wondering if > there's an intent to open up the google maps "get directions" activity. > that sure would be useful. something like, > > geo:lat,long?dest=lat,long There is not one documented, at least. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy _The Busy Coders' Guide to *Advanced* Android Development_ In Print! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: listview orientation
> How to orient listview items horizontal. ListView does not work horizontally. You may be able to use HorizontalScrollView with something else (e.g., a horizontal LinearLayout) and some extra code to achieve a similar look. -- 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 Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: How Can I Block Unwanted Calls.
> Can any one tell me how i can block unwanted calls through my application? There is no officially supported way to do this. -- 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 Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: How to Call Browser Activity
Smelly Eddie wrote: > I am reading through the SDK on Android .com and I am having trouble > just finding an example using an intent to invoke a browser activity. > > I want to send the user to a specific URL. > > String authUrl = "http://domain.com/login";; > > > // bring the user to authUrl, e.g. open a web browser and > note the PIN code > // ... > Intent webLogin = new Intent(this,NetApi.class); > startActivityForResult(webLogin,ACTION_VIEW); startActivity(new Intent(ACTION_VIEW, Uri.parse(authUrl))); -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Need Android talent? Ask on HADO! http://wiki.andmob.org/hado --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Application to intercept a dialed number an call another number instead
> Completely new to Android. I do not know where to start to make a type > "Console" application that will redirect a call to another number. That is not possible except via changes to the firmware. -- 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 Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: remove apllication from emulator prob
> that is fine but why this default commands are not > finding my packages? I do not understand the question. > does my applications are on another location how to > get > that is there any command? I do not understand this question either. -- 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 Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: remove apllication from emulator prob
> i want to remove application from emulator > i am useing > adb shell in tool derectory > i got > # > then i used > # cd /data/app > # > > here i am not getting any .apk files on emulator?so is the path is not > same or any other way to remove files You do not remove applications from any Android device or emulator that way. You can use the Settings application to manage applications on the emulator the same way as you do on the device. Or, you can use the adb uninstall command: adb uninstall your.package.name.here -- 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 Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: problems with aidl
Guilherme Melo wrote: > On Sep 1, 1:46 pm, Mark Murphy wrote: >> Guilherme Melo wrote: >>> Hello all, i am creating a service and i am having two big problems >>> with my aidl, first, i cannot import any Java types(Enumeration , >>> Date, etc) that i get an error (couldn't find import for >>> class ... ) >> Correct. Those are not valid AIDL data types: >> >> http://developer.android.com/guide/developing/tools/aidl.html#aidlsyntax > > acording to the link "These parameters and return values can be of any > type" i thought that , even though it seems counter intuitive because > they do not implement parceble ... > i though i could , for instance use Date in passing a parameter You need to read further in the section I linked to above. Date is not a valid parameter type. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy _Android Programming Tutorials_ Version 1.0 In Print! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: problems with aidl
Guilherme Melo wrote: > Hello all, i am creating a service and i am having two big problems > with my aidl, first, i cannot import any Java types(Enumeration , > Date, etc) that i get an error (couldn't find import for > class ... ) Correct. Those are not valid AIDL data types: http://developer.android.com/guide/developing/tools/aidl.html#aidlsyntax > the second is that apparently i cannot have two methods with different > parameters, such as as get(in String par) and get (in String par, in > String part2) What happens when you try those sorts of declarations in your AIDL? -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy _The Busy Coders' Guide to *Advanced* Android Development_ In Print! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: ListView Add an image as well as 2 line text to a single list item
Alok Kulkarni wrote: > Thanks Mark, the PDF seems great, One question more .I donno if the > pdf answers this but how can i reduce the height of an item in a > listview. I googled for it , some answers came up but not much > convincing. The height of an item in a ListView is controlled by the item. If you have a 200px high image, the row will be 200px high at minimum. If you want shorter rows, design shorter row layouts, and use them per the PDF I linked to. -- 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 Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Progress bar for upload / doenload
jbrohan wrote: > Hello > I've been having some difficulties with the progress bar. I built a > separate test harness and now I start to see things more clearly. The > code below seems to work correctly, but updates the progress bar only > when it finishes. I want it to update as the progress is made! > > package com.example.progressbartest; > > > public class ProgressBarTest extends Activity { > static int i; > /** Called when the activity is first created. */ > @Override > public void onCreate(Bundle savedInstanceState) { > super.onCreate(savedInstanceState); > // Request the progress bar to be shown in the title > requestWindowFeature(Window.FEATURE_PROGRESS); > setContentView(R.layout.main); > setProgressBarVisibility(true); > > final ProgressBar progressHorizontal = (ProgressBar) > findViewById(R.id.progress_horizontal); > while (i<1000){ > setProgress(i++); > Log.e("John","in loop"+Integer.toString(i)); > } > } >} setProgress() does not set the progress on the screen. setProgress() puts a message on a message queue that the UI thread uses. When the UI thread eventually pops that message off of the message queue, the UI thread will set the progress on the screen. However, you are not letting the UI thread do that. Instead, you are busy-looping 1000 times, calling setProgress() every time. The UI thread cannot process messages on the queue until after that 1000-count loop is done. If you want Android to draw things, you have to let the UI thread go (e.g., return from onCreate()). -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Need help for your Android OSS project? http://wiki.andmob.org/hado --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: ListView Add an image as well as 2 line text to a single list item
Alok wrote: > Hi guys, I want to have a listview of songs where on the left of each > list item i can have a musical image or image of album and then the > actual song name on the right. The song name , with some other details > fits in two lines on the right side. I hv gone through the Android sdk > example where i can have a Contact name and number ,on two lines of > single list item. I want to add image as well.. Please help me out! You can find instructions here: http://commonsware.com/Android/excerpt.pdf -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Need help for your Android OSS project? http://wiki.andmob.org/hado --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Installed Application Version
Sean Hodges wrote: > As far as I'm aware of, there isn't a way to check the version number > of an app from the base Android interface. Sure there is! PackageManager has getPackageInfo(), and PackageInfo has versionCode and versionName, as encoded in the manifest. You need to know the package name for which you want the version information, but it's all right there. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Need help for your Android OSS project? http://wiki.andmob.org/hado --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Very simple question about the HTC phones with trackballs (like the G1)
Steeler wrote: > And that shows up as DPAD_CENTER? It should. -- 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 Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Very simple question about the HTC phones with trackballs (like the G1)
Steeler wrote: > Can you click the trackball, or is there some other button that > generates DPAD_CENTER key events? You can click the trackball on the G1 and Google Ion (HTC Magic). -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy _The Busy Coder's Guide to *Advanced* Android Development_ Version 1.1 Available! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Add an image over an image
Alok wrote: > I want to add a small image over another image.How can that be done? Use a RelativeLayout or FrameLayout, and have the one to appear "over" the other image be defined later in the XML within that container. Those two container classes support overlapping widgets, and those later in the XML are "higher in the Z axis", meaning they appear to be on top of widgets defined earlier in the XML. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android Training in Germany, 18-22 January 2010: http://bignerdranch.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: TotallyLost
Rc3375 wrote: > After starting a new project in ECLIPSE, no BUILD.xml is generated. Correct. It's not supposed to. You don't need it for Eclipse. This was already answered in your previous thread. If you want a build.xml file, use android create project (instead of Eclipse) or android update project (bearing in mind Eclipse won't try to keep your build.xml file up to date). -- 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 Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Invalid apk file
Ivan wrote: > I renamed the file to .zip, seems that Windows could not open it. > Any idea ? Check out: http://groups.google.com/group/android-beginners/browse_thread/thread/705cc102073c4987 and see if it explains what you are seeing. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android 1.5 Programming Books: http://commonsware.com/books.html --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Invalid apk file
Ivan wrote: > I tried to install the application manually via adb, just run adb > install HelloAndroid.apk in the command line, it said > D:\Android\android-sdk-windows-1.5_r3\tools>adb install > HelloAndroid.apk > EOCD not found, not Zip > file 'HelloAndroid.apk' is not a valid zip file > > So does it mean that the file is corrupted ? Probably. Try renaming it to HelloAndroid.zip and see if Windows can open it, or if it too complains. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Need help for your Android OSS project? http://wiki.andmob.org/hado --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Playing multiple sounds at once?
Steeler wrote: > I tried using multiple MediaPlayer objects, but they block each other > out. Is there any way to play more than one sound at the same time? Use SoundPool. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android Development Wiki: http://wiki.andmob.org --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Android / SQLite and Java Serialization
Greg Hedin wrote: > Is it possible to pass a serializable object to SQLite using the ole > 'android.content.ContentValues' class? I am making a to-do-list > application and I rather than writing a 'put' line for each member of > my task object, I want to send the whole object to sqlite and move > on... this makes things more manageable later on when I decide I > designed my app poorly and need to change my class around. :P Serialization usually makes this worse, not better, IMHO. > I have found Java Serialization to mySQL examples, but no sqlite > examples. I am new to the concept of Serialization in Java and I've > heard that you can get your object to be represented as a double, this > may be a solution for me. Serialization does not get your object to be represented as a double. It gets written to a stream, which typically writes to a local file: http://developer.android.com/reference/java/io/ObjectOutputStream.html You can probably arrange a way to have the stream dump to a byte[] and store that in a BLOB column. Or, don't use SQLite -- I seem to recall there is at least one object database for Android available. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android Development Wiki: http://wiki.andmob.org --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Mediaplay Problem
Nick Burton wrote: > Howdy all, this is a problem faced by an Android Australia group > member. Since we're just starting out I've reposted here to get him a > solution. Any help would be appreciated. Kind regards, Nick. > > -- Forwarded message -- > > hey guys, > > i got a bit a code in a resource utility class: > static public void playSound(Context ctx, int resId) { > > try { > MediaPlayer mp = MediaPlayer.create(ctx, > resId); > mp.setOnErrorListener(mediaErrorListener); > mp.start(); > } catch (Exception e) { > Log.e(LOG_TAG, "unable to play sound", e); > } > } > > static public class MediaErrorListener implements > MediaPlayer.OnErrorListener { > @Override > public boolean onError(MediaPlayer mp, int what, int > extra) { > Log.e(LOG_TAG, "unable to play sound what:(" + > what + ") extra:(" + > extra + ")"); > return false; > } > } > > its been working fine. but i just tried it on a long instructional mp3 > file (10min) & 7MB and it stops after 20sec. Can you define "stops"? In other words, does it bring up an error dialog? If so, what does adb logcat (or DDMS or the DDMS perspective in Eclipse) show you for a stack trace? You might want to check out logcat anyway, even if it does not display a dialog -- OpenCORE (the multimedia engine) seems to have a tendency to log errors at warning level and not raise them all the way up to where we in Java code can catch them. If you see "PV..." messages around the time it stops, those are probably related. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android Development Wiki: http://wiki.andmob.org --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: The server does not accept apks signed with the debug certificate.
cellurl wrote: > I am trying to upload an app to the ADC-2. > > http://market.android.com/adc/Home#EDIT_APPLICATION: > > It says my .adk is wrong. > > "The server does not accept apks signed with the debug certificate. > Create a new certificate that is valid for at least 50 years. > The server requires that the certificate used to sign the apk be valid > until at least October 22, 2033. Create a new certificate." > > > Q: How do I fix this? I know how to run in eclipse in regular or > debug, but I can't figure out how to make eclipse build a "release" > version. > > FYI, I created my .apk using eclipse->Export button. http://developer.android.com/guide/publishing/app-signing.html#ExportWizard "To create a signed .apk, right-click the project in the Package Explorer and select Android Tools > Export Signed Application Package." I don't use Eclipse personally, so I cannot get much deeper into the explanation than the public docs. As the section preceding the linked-to one points out, you can test an APK to see what key it was signed with via: jarsigner -verify -verbose -certs my_application.apk If it has CN=Android Debug, it was signed with the debug key. If the CN is your firm, it was probably signed with your production key. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android Development Wiki: http://wiki.andmob.org --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: access resource strings from non-android classes?
Jeffrey Blattman wrote: > to access resource strings from android code, i can call > getResources().getString(R.string). however, what if i am in a class > that doesn't extend Context? i suppose i can pass the Context in, but > i'd rather not pollute the non-andoid classes. > > is there a static accessor for resource strings? Not that I am aware of. You need the Context to know where the resources live, AFAIK. You can pass in the Resources object from getResources() if you don't want to pass in the Context for some reason. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android 1.5 Programming Books: http://commonsware.com/books.html --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: zip files in resources
> i need to place a zip file in my resources (it is about 400k). i > understand i can get a handle to the stream, to load the zip via > ZipInputStream from that location, but in order to be memory conscious i > really need to get a handle to a ZipFile. what are my options? > > i understand i can read the zip, then write it out to /data/... and > create a ZipFile based on the file in /data/... however, then i'm using > 400k extra internal memory for my app. so, i can either, > > 1. load the data from a ZipInputStream and keep it all in memory (about > 1.7MB in text form) > 2. read the stream and write it out to /data/... (a ~400k zip file) and > then create a ZipFile based on the file in /data/... > > ? any other possibilities? The APK file *is* a ZIP file, so if your goal is merely compression, perhaps consider not storing it as a ZIP in the APK, but just store the original data in the APK. -- 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 Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: LocationManager.getLastKnownLocation("gps") returns null instead of location object
> locationmanger = (LocationManager)getSystemService > (Context.LOCATION_SERVICE); > location =locationmanager.getLastKnownLocation("gps"); > Log.v(TAG,"location obj"+location); > > The Log shows null instead of location object Correct. > I am using emulator to test my code ,I have written appropriate > permissions,i am using android1.5 , > I could not figure out the reason At the time you made the call to getLastKnownLocation(), there was no GPS fix (real or simulated). > In eclipse after switching to DDMS mode , Emulator Controls tabs shows > Location Controls. From here, we can view longitude/latitude > coordinates to the device.Is there any way to bring down those data > into my activity . Is this only way to get longitude and latitude when > test with emulator. Use requestLocationUpdates() to turn the GPS radio (or emulated equivalent) on. Then, some time later, use DDMS to send a longitude/latitude to the emulator. Your LocationListener's onLocationChange() method will be called with the Location corresponding to your fix. Be sure to eventually call removeUpdates() to turn off the location update calls. -- 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 Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Triggering options list
> I want to trigger the options list in Android phone when somebody > calls my cell number > ie to say different kinds of options we hear when we call t-mobile > customer service. > > "Press 1 to pay bill" > "Press 2 for Representative" > "Press 3 for Exit" > etc etc > > Based on these options I need to trigger different operations. > Any pointers, links, examples on how it can be done AFAIK, that cannot be done without modifying the firmware. -- 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 Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Receiving text from a remote source and pasting into the current application
> My concern is that the > user should be able to "paste" the text into any program he runs on > Android. This is not possible for security reasons, as you suggest later in your message. You can offer this feature for your own applications, or make a JAR or remote service available that other applications can use to fetch the text (though they would need to "paste" it themselves). -- 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 Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Equivalent of MS Windows PostMessage?
> What is the accepted/common practice for code to post messages between > objects in the Android environment? Um, there is not really an analogue of PostMessage() in Java. View has post() and postDelayed(), but those are designed to simply arrange for a Runnable to be executed on the UI thread. Can we back up a step or two and discuss what your actual objective is? PostMessage() is a means to an end -- if you can describe the end, we may be better able to give you an Android-flavored means. -- 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 Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Detect "running in" Android and access to Command Line parameters
> 1) How can I tell if my Java code is running in the Android > environment? I have some code that is shared by Android and non- > Android applications and I want to be able to adjust to either > environment dynamically. One possibility would be to use reflection to look up a class in an android.* namespace. > 2) Is there a way to get access to the Command Line arguments that > were used to launch the application my Activity (or Service, etc.) is > running under? AFAIK, there are no command line arguments, because there is no command line. Even if there are, you should not use them, let alone rely upon them, as they are undocumented and subject to change in future Android releases. -- 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 Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: backgroundservice
> i want to develop an application which checks periodically for new > data on a server over a http-connection. > Should i do this in a Thread or is it better to do this in a service? Both. Use a service that does the work in an AsyncTask or other form of background thread. > The checking should also continue when the user is going back to the > Android-Main-Menu, that means the user is exiting the Activity, and > when he starts the Activity again it can work with the collected data. > As far as i read, is this feature only possible with remote-Services, > so that i must use Inter-Process-Communication? No. Have your activity call startService() to start up the service to do the HTTP operation. Then, when the service is done with the HTTP, have it call stopSelf() to shut itself down. -- 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 Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: ListView item stay selected
> I have a listview and i want when i select a row to stay selected The core Android team does not recommend this. > The problem is that if i change some attribute ( for example > v.setBackgroundColor(Color.BLACK) ) the selected view no longer stays > selected. That is because "selected" is one of the background colors. A widget background is usually some form of ColorStateList. You can supply a simple color to setBackgroundColor(), but that only works if you do not intend to allow the item to be selected, for example. -- 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 Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: confusion about bluetooth
> The current Android release offers: > "Stereo Bluetooth support (A2DP and AVCRP profiles) " > (http://developer.android.com/sdk/android-1.5-highlights.html) > > However, it has also been stated in the developers forum: > "There is no Bluetooth API in the SDK at this time". > http://groups.google.com/group/android-developers/browse_thread/thread/b65f1a04ec7228b0/4aedd6927fb34a86#4aedd6927fb34a86 > > So how are the Bluetooth A2DP or AVCRP profiles used if there are no > Bluetooth API's? There are no Bluetooth APIs available in the SDK for Java applications. Applications and features built into the firmware have access to bluez. -- 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 Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: SQLite without Context?
> > I must access a SQLite Database from within a Service, but > SQLiteOpenHelper requires an Activity Context object which won't be > there when the Activity which spawned the Service is closed! Use your Service. Service is a subclass of Context. -- 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 Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---