android Programming Glossary: you'd
Android Open and Save files to/from Google Drive SDK http://stackoverflow.com/questions/12164024/android-open-and-save-files-to-from-google-drive-sdk new FileContent text plain an ordinary java.io.File you'd like to upload. Make it using a FileWriter or something that's.. in if it ever reaches this spot. Handle it here however you'd like. THE ANDROID CODE Updating Two quick notes on updating.. need WRITE_EXTERNAL_STORAGE as well depending on where you'd like to store the local copies of your files. YOUR BUILD TARGET..
Saving Activity state in Android http://stackoverflow.com/questions/151777/saving-activity-state-in-android in to onCreate and also onRestoreInstanceState where you'd extract the values like this @Override public void onRestoreInstanceState..
What is the best IDE to develop Android apps in? [closed] http://stackoverflow.com/questions/1715697/what-is-the-best-ide-to-develop-android-apps-in productive with a specific environment I don't see why you'd have to learn a new one. Not worth it in my opinion. Plus I'm..
Custom title with image http://stackoverflow.com/questions/2086989/custom-title-with-image android windowTitleSize 40dip item style resources Then you'd need to set the theme for your Activity or Application if you..
Voice recognition on android with recorded sound clip? http://stackoverflow.com/questions/2319735/voice-recognition-on-android-with-recorded-sound-clip you to provide your own sound data. If this is something you'd like to see file a feature request at http b.android.com . This..
How do I load a contact Photo? http://stackoverflow.com/questions/2383580/how-do-i-load-a-contact-photo for example if you are rendering a message timeline you'd want to re use the same bitmap object for every badge instance..
Android - shadow on text? http://stackoverflow.com/questions/2486936/android-shadow-on-text p ringdroid Edit2 To set this style programmatically you'd do something like this modified from this example to match ringdroid's..
What should I use Android AccountManager for? [closed] http://stackoverflow.com/questions/2720315/what-should-i-use-android-accountmanager-for type of Accounts this is suitable for Would this be where you'd put your user's account information for a general web service..
Launch custom android application from android browser http://stackoverflow.com/questions/2958701/launch-custom-android-application-from-android-browser element. For example to handle all links to twitter.com you'd put this inside your activity in your AndroidManifest.xml intent..
Android: Is application running in background? http://stackoverflow.com/questions/3667022/android-is-application-running-in-background there are also a few variations of this solution if you'd like to check activity visibility from the service . Example.. you may create a common ancestor for your Activities if you'd like to but if your activity is already extended from MapActivity..
How to change color of ListView items on focus and on click http://stackoverflow.com/questions/4247385/how-to-change-color-of-listview-items-on-focus-and-on-click messy Java code necessary. See this SO post . Specifically you'd set the textColor of your textViews to an XML resource like..
Multi-gradient shapes http://stackoverflow.com/questions/4381033/multi-gradient-shapes as the second layer offset from the top by 50dp. Obviously you'd want this number to always be half of whatever your view size..
Android Fragments and animation http://stackoverflow.com/questions/4817900/android-fragments-and-animation achieve the same thing with hiding or showing a fragment you'd simply call ft.show or ft.hide passing in the Fragment you wish..
How to parse XML using the SAX parser http://stackoverflow.com/questions/4827344/how-to-parse-xml-using-the-sax-parser repeating tags in different levels becomes tricky. There you'd have to either use Enums for example to set your current state..
How can I get a working vertical SeekBar in Android? http://stackoverflow.com/questions/4892179/how-can-i-get-a-working-vertical-seekbar-in-android with max 1000 . Obviously it uses the same code so you'd assume the same behavior. I'm only able to achieve a progress..
iOS / Android cross platform development [duplicate] http://stackoverflow.com/questions/6171128/ios-android-cross-platform-development them know what you like what you don't like and features you'd like to see. You have a real opportunity to influence what goes..
Android Paint: .measureText() vs .getTextBounds() http://stackoverflow.com/questions/7549182/android-paint-measuretext-vs-gettextbounds which are native methods implemented in C . So you'd continue to study Paint.cpp which implements both. native_measureText..
Override Power button just like Home button http://stackoverflow.com/questions/10077905/override-power-button-just-like-home-button turned off provided the host implements this correctly. You'd now like to go the extra mile by rendering this action unnecessary..
How can I catch SIGSEGV (segmentation fault) and get a stack trace under JNI on Android? http://stackoverflow.com/questions/1083154/how-can-i-catch-sigsegv-segmentation-fault-and-get-a-stack-trace-under-jni-on a non Android situation some of this would be different. You'd need to gather your own native trace see this other question.. other question depending on what sort of libc you have. You'd need to handle dumping that trace launching your separate crash..
setBackground vs setBackgroundDrawable (Android) http://stackoverflow.com/questions/11947603/setbackground-vs-setbackgrounddrawable-android to be completly correct just for the completeness of it... You'd do something like following int sdk android.os.Build.VERSION.SDK_INT..
How to take a screenshot of other app programmatically without root permission, like Screenshot UX Trial? http://stackoverflow.com/questions/12462944/how-to-take-a-screenshot-of-other-app-programmatically-without-root-permission call the captureScreen member of ISurfaceComposer 2 . You'd need to write some native code to access this function using..
Saving Activity state in Android http://stackoverflow.com/questions/151777/saving-activity-state-in-android String myString savedInstanceState.getString MyString You'd usually use this technique to store instance values for your..
Pausing/stopping and starting/resuming Java TimerTask continuously? http://stackoverflow.com/questions/2098642/pausing-stopping-and-starting-resuming-java-timertask-continuously not run again. So once cancelled it won't ever run again. You'd be better off instead using the more modern ScheduledExecutorService..
How do I vertically align an item within a list using relative layout? http://stackoverflow.com/questions/2451744/how-do-i-vertically-align-an-item-within-a-list-using-relative-layout to make itself no taller than the height of the picture. You'd have to specify a height e.g. 80dp and then set the ImageView..
Android: How to create a Dialog without a title? http://stackoverflow.com/questions/2644134/android-how-to-create-a-dialog-without-a-title it gives it some basic text and icon then creates it. You'd show it then with alertDialog.show . AlertDialog.Builder builder..
Is it possible to display inline images from html in an Android TextView? http://stackoverflow.com/questions/2865452/is-it-possible-to-display-inline-images-from-html-in-an-android-textview 0 0 d.getIntrinsicWidth d.getIntrinsicHeight return d You'd probably want to figure out something smarter for mapping source..
Convert a Bitmap to GrayScale in Android http://stackoverflow.com/questions/3373860/convert-a-bitmap-to-grayscale-in-android grayscale bitmap and do whatever you want to do with it. You'd need to tweak the sample a bit it's using hard coded sizes you..
Android — How to I get a list of all available intent filters? http://stackoverflow.com/questions/4094109/android-how-to-i-get-a-list-of-all-available-intent-filters find that. Intent filters are defined by the application. You'd have to look at the documentation for the paritcular application..
Face Detection in Android? http://stackoverflow.com/questions/4125821/face-detection-in-android rectangles which works in Android 2.2. OpenCV in Android You'd better try this on Linux I've tried it on Windows but failed..
Multi-gradient shapes http://stackoverflow.com/questions/4381033/multi-gradient-shapes android layout_height wrap_content android text Press Me You'd then put something like this in your onCreate method Button..
Android: Want to set custom fonts for whole application not runtime http://stackoverflow.com/questions/4395309/android-want-to-set-custom-fonts-for-whole-application-not-runtime creates the typeface once then runs setTypeface for each. You'd just have to update it each time you add a new item to a layout...
Android - Adding Subitem to a listview http://stackoverflow.com/questions/4587301/android-adding-subitem-to-a-listview taxiList _ __ _ _END EDIT_ _ __ _ __ You'd probably be better off using a database for something like this..
How can I manipulate the camera preview? http://stackoverflow.com/questions/6478375/how-can-i-manipulate-the-camera-preview off of the camera. It's returned as a YUV byte array. You'd need to draw it manually onto a surface in order to be able..
Android 3.1 USB-Host - BroadcastReceiver does not receive USB_DEVICE_ATTACHED http://stackoverflow.com/questions/6981736/android-3-1-usb-host-broadcastreceiver-does-not-receive-usb-device-attached action usbConnected false You'd have this inside of onCreate listen for new devices IntentFilter..
Android Paint: .measureText() vs .getTextBounds() http://stackoverflow.com/questions/7549182/android-paint-measuretext-vs-gettextbounds source see both measureText and getTextBounds methods. You'd learn that measureText calls native_measureText and getTextBounds..
android- multi onClick listener in one button http://stackoverflow.com/questions/7587299/android-multi-onclick-listener-in-one-button in the Android API that allows multiple onClick listeners. You'd need some custom class that handles a single onClick and pass..
Android Open and Save files to/from Google Drive SDK http://stackoverflow.com/questions/12164024/android-open-and-save-files-to-from-google-drive-sdk File body.setMimeType text plain final FileContent mediaContent new FileContent text plain an ordinary java.io.File you'd like to upload. Make it using a FileWriter or something that's really outside the scope of this answer. new Thread new Runnable.. intents that it fires off besides the one for Drive's log in if it ever reaches this spot. Handle it here however you'd like. THE ANDROID CODE Updating Two quick notes on updating the last modified date of a file on Google Drive You must provide.. MANAGE_ACCOUNTS INTERNET and there's a good chance you'll need WRITE_EXTERNAL_STORAGE as well depending on where you'd like to store the local copies of your files. YOUR BUILD TARGET Right click your project go into it's properties and under..
Saving Activity state in Android http://stackoverflow.com/questions/151777/saving-activity-state-in-android a way of storing a NVP Name Value Pair map and it will get passed in to onCreate and also onRestoreInstanceState where you'd extract the values like this @Override public void onRestoreInstanceState Bundle savedInstanceState super.onRestoreInstanceState..
What is the best IDE to develop Android apps in? [closed] http://stackoverflow.com/questions/1715697/what-is-the-best-ide-to-develop-android-apps-in work on Android with any text editor I use Vim . If you're more productive with a specific environment I don't see why you'd have to learn a new one. Not worth it in my opinion. Plus I'm a big IntelliJ fan. The IntelliJ plugin lets you make apk..
Custom title with image http://stackoverflow.com/questions/2086989/custom-title-with-image values XML file resources style name LargeTitleTheme item name android windowTitleSize 40dip item style resources Then you'd need to set the theme for your Activity or Application if you want the entire application to have this custom title bar..
Voice recognition on android with recorded sound clip? http://stackoverflow.com/questions/2319735/voice-recognition-on-android-with-recorded-sound-clip service is the RecognizerIntent which doesn't allow you to provide your own sound data. If this is something you'd like to see file a feature request at http b.android.com . This is also tangentially related to existing issue 4541 . share..
How do I load a contact Photo? http://stackoverflow.com/questions/2383580/how-do-i-load-a-contact-photo phoneNumber .addThumbnail Now there are ways to be more efficient for example if you are rendering a message timeline you'd want to re use the same bitmap object for every badge instance for a given phone number instead of constantly creating new..
Android - shadow on text? http://stackoverflow.com/questions/2486936/android-shadow-on-text Edit the source code can be viewed here http code.google.com p ringdroid Edit2 To set this style programmatically you'd do something like this modified from this example to match ringdroid's resources from above TextView infoTextView TextView..
What should I use Android AccountManager for? [closed] http://stackoverflow.com/questions/2720315/what-should-i-use-android-accountmanager-for AccountManager is and what it buys you Any opinions of what type of Accounts this is suitable for Would this be where you'd put your user's account information for a general web service android accountmanager share improve this question This..
Launch custom android application from android browser http://stackoverflow.com/questions/2958701/launch-custom-android-application-from-android-browser share improve this question Use an intent filter with a data element. For example to handle all links to twitter.com you'd put this inside your activity in your AndroidManifest.xml intent filter data android scheme http android host twitter.com..
Android: Is application running in background? http://stackoverflow.com/questions/3667022/android-is-application-running-in-background are your own implementation of the Application or a Service there are also a few variations of this solution if you'd like to check activity visibility from the service . Example Implement custom Application class note the isActivityVisible.. Add onPause and onResume to every Activity in the project you may create a common ancestor for your Activities if you'd like to but if your activity is already extended from MapActivity ListActivity etc. you still need to write the following..
How to change color of ListView items on focus and on click http://stackoverflow.com/questions/4247385/how-to-change-color-of-listview-items-on-focus-and-on-click drawable color list on the views you want to change no messy Java code necessary. See this SO post . Specifically you'd set the textColor of your textViews to an XML resource like this one xml version 1.0 encoding utf 8 selector xmlns android..
Multi-gradient shapes http://stackoverflow.com/questions/4381033/multi-gradient-shapes gradient as the bottom layer then put the half overlay as the second layer offset from the top by 50dp. Obviously you'd want this number to always be half of whatever your view size is though and not a fixed 50dp. I don't think you can use..
Android Fragments and animation http://stackoverflow.com/questions/4817900/android-fragments-and-animation detailFragment Start the animated transition. ft.commit To achieve the same thing with hiding or showing a fragment you'd simply call ft.show or ft.hide passing in the Fragment you wish to show or hide respectively. For reference the XML animation..
How to parse XML using the SAX parser http://stackoverflow.com/questions/4827344/how-to-parse-xml-using-the-sax-parser manage that but having to parse a more complex structure with repeating tags in different levels becomes tricky. There you'd have to either use Enums for example to set your current state and a lot of switch case statemenets to check where you are..
How can I get a working vertical SeekBar in Android? http://stackoverflow.com/questions/4892179/how-can-i-get-a-working-vertical-seekbar-in-android has max 20 . However I tried implementing another VerticalSeekBar with max 1000 . Obviously it uses the same code so you'd assume the same behavior. I'm only able to achieve a progress of 0~35 even as my finger slides beyond the SeekBar and eventually..
iOS / Android cross platform development [duplicate] http://stackoverflow.com/questions/6171128/ios-android-cross-platform-development find a framework you like by all means send feedback and let them know what you like what you don't like and features you'd like to see. You have a real opportunity to influence what goes into the next versions of these tools. Hope this helps...
Android Paint: .measureText() vs .getTextBounds() http://stackoverflow.com/questions/7549182/android-paint-measuretext-vs-gettextbounds calls native_measureText and getTextBounds calls nativeGetStringBounds which are native methods implemented in C . So you'd continue to study Paint.cpp which implements both. native_measureText SkPaintGlue measureText_CII nativeGetStringBounds..
Override Power button just like Home button http://stackoverflow.com/questions/10077905/override-power-button-just-like-home-button an ACTION_SCREEN_ON kicking the screen back to life when it's turned off provided the host implements this correctly. You'd now like to go the extra mile by rendering this action unnecessary if and only if you are able to catch and handle ACTION_SCREEN_OFF..
How can I catch SIGSEGV (segmentation fault) and get a stack trace under JNI on Android? http://stackoverflow.com/questions/1083154/how-can-i-catch-sigsegv-segmentation-fault-and-get-a-stack-trace-under-jni-on state and hangs. CrashHandler.java 70 strings.xml 51 In a non Android situation some of this would be different. You'd need to gather your own native trace see this other question depending on what sort of libc you have. You'd need to handle.. different. You'd need to gather your own native trace see this other question depending on what sort of libc you have. You'd need to handle dumping that trace launching your separate crash handler process and sending the email in some appropriate..
setBackground vs setBackgroundDrawable (Android) http://stackoverflow.com/questions/11947603/setbackground-vs-setbackgrounddrawable-android it still works so you could just use it. But if you want to be completly correct just for the completeness of it... You'd do something like following int sdk android.os.Build.VERSION.SDK_INT if sdk android.os.Build.VERSION_CODES.JELLY_BEAN setBackgroundDrawable..
How to take a screenshot of other app programmatically without root permission, like Screenshot UX Trial? http://stackoverflow.com/questions/12462944/how-to-take-a-screenshot-of-other-app-programmatically-without-root-permission level to this day. If you had this permission however you could call the captureScreen member of ISurfaceComposer 2 . You'd need to write some native code to access this function using the Android NDK and also some undocumented APIs. However it's..
Saving Activity state in Android http://stackoverflow.com/questions/151777/saving-activity-state-in-android myDouble int myInt savedInstanceState.getInt MyInt String myString savedInstanceState.getString MyString You'd usually use this technique to store instance values for your application selections unsaved text etc. . share improve this..
Pausing/stopping and starting/resuming Java TimerTask continuously? http://stackoverflow.com/questions/2098642/pausing-stopping-and-starting-resuming-java-timertask-continuously timer task absolutely guarantees that the timer task will not run again. So once cancelled it won't ever run again. You'd be better off instead using the more modern ScheduledExecutorService from Java 5 . Edit The basic construct is ScheduledExecutorService..
How do I vertically align an item within a list using relative layout? http://stackoverflow.com/questions/2451744/how-do-i-vertically-align-an-item-within-a-list-using-relative-layout be on android layout_height wrap_content because it's trying to make itself no taller than the height of the picture. You'd have to specify a height e.g. 80dp and then set the ImageView to a fixed height like 60dp with android scaleType fitXY to..
Android: How to create a Dialog without a title? http://stackoverflow.com/questions/2644134/android-how-to-create-a-dialog-without-a-title the official website. That takes a custom layot file inflates it gives it some basic text and icon then creates it. You'd show it then with alertDialog.show . AlertDialog.Builder builder AlertDialog alertDialog Context mContext getApplicationContext..
Is it possible to display inline images from html in an Android TextView? http://stackoverflow.com/questions/2865452/is-it-possible-to-display-inline-images-from-html-in-an-android-textview null Drawable d getResources .getDrawable id d.setBounds 0 0 d.getIntrinsicWidth d.getIntrinsicHeight return d You'd probably want to figure out something smarter for mapping source strings to resource IDs though. share improve this answer..
Convert a Bitmap to GrayScale in Android http://stackoverflow.com/questions/3373860/convert-a-bitmap-to-grayscale-in-android grayscale. From that point on you can use bm as an actual grayscale bitmap and do whatever you want to do with it. You'd need to tweak the sample a bit it's using hard coded sizes you may want to just clone the size of the original bitmap but..
Android — How to I get a list of all available intent filters? http://stackoverflow.com/questions/4094109/android-how-to-i-get-a-list-of-all-available-intent-filters
Face Detection in Android? http://stackoverflow.com/questions/4125821/face-detection-in-android face detection sample using FaceDetector and OpenGL draws rectangles which works in Android 2.2. OpenCV in Android You'd better try this on Linux I've tried it on Windows but failed . JavaCV strongly recommended There is a sample code of realtime..
Multi-gradient shapes http://stackoverflow.com/questions/4381033/multi-gradient-shapes android id @ id thebutton android layout_width wrap_content android layout_height wrap_content android text Press Me You'd then put something like this in your onCreate method Button theButton Button findViewById R.id.thebutton ShapeDrawable.ShaderFactory..
Android: Want to set custom fonts for whole application not runtime http://stackoverflow.com/questions/4395309/android-want-to-set-custom-fonts-for-whole-application-not-runtime in code. You could always have a setLayoutFont method that creates the typeface once then runs setTypeface for each. You'd just have to update it each time you add a new item to a layout. Something like below public void setLayoutFont Typeface..
Android - Adding Subitem to a listview http://stackoverflow.com/questions/4587301/android-adding-subitem-to-a-listview i taxiAddresses i setListAdapter new TaxiAdapter this R.layout.taxi_list_item taxiList _ __ _ _END EDIT_ _ __ _ __ You'd probably be better off using a database for something like this to keep the records tied together. If you're set on using..
How can I manipulate the camera preview? http://stackoverflow.com/questions/6478375/how-can-i-manipulate-the-camera-preview Here's what I found. It's pretty easy to get the raw data coming off of the camera. It's returned as a YUV byte array. You'd need to draw it manually onto a surface in order to be able to modify it. To do that you'd need to have a SurfaceView that..
Android 3.1 USB-Host - BroadcastReceiver does not receive USB_DEVICE_ATTACHED http://stackoverflow.com/questions/6981736/android-3-1-usb-host-broadcastreceiver-does-not-receive-usb-device-attached intent String action intent.getAction if UsbManager.ACTION_USB_DEVICE_DETACHED.equals action usbConnected false You'd have this inside of onCreate listen for new devices IntentFilter filter new IntentFilter filter.addAction UsbManager.ACTION_USB_DEVICE_DETACHED..
Android Paint: .measureText() vs .getTextBounds() http://stackoverflow.com/questions/7549182/android-paint-measuretext-vs-gettextbounds to inspect such problem Study Android source code Paint.java source see both measureText and getTextBounds methods. You'd learn that measureText calls native_measureText and getTextBounds calls nativeGetStringBounds which are native methods implemented..
android- multi onClick listener in one button http://stackoverflow.com/questions/7587299/android-multi-onclick-listener-in-one-button share improve this question I don't think there's an API in the Android API that allows multiple onClick listeners. You'd need some custom class that handles a single onClick and pass in handlers for it to call. Something like this private class..
|