MessageBox or AlertDialog in Android Java
- Category: AndroidOS
- Hits: 13356
A quick article on how to display a OK/Cancel popup which I use as a message to the user for debug purposes.
Why?
It's similar to javascript's message box or confirm box, only Android let's you redesign the dialog. For my purposes I have used an XML as the layout.
How?
This displays a standard Ok/cancel message popup which you attach to some event
Android Background Image Resolutions
- Category: AndroidOS
- Hits: 13862
A reference to what size an image background should be set to for various screen sizes.
Why?
A background image I was using was unedited at 1600x2133 (364kb) and was not displaying on smaller devices. Configuring drawables for each layout seemed to be the only solution.
res/drawable-ldpi 240x320 res/drawable-mdpi 320x480 res/drawable-hdpi 480x800 res/drawable-xhdpi 640x960 res/drawable-xxhdpi 960x1440 res/drawable-xxxhdpi // for launcher only 640dpi res/drawable-tvdpi 1.33*mdpi // not needed as mdpi or hdpi is used
Android: Function to let user take photo or choose existing
- Category: AndroidOS
- Hits: 11443
A quick article on a function to allow the user to take a photo using their built-in camera or to choose an existing photo from their gallery.
Why?
I wanted both options to be available to the user and for it to replace a displayed image in an ImageView.
How?
Android: Replace return key with done, go, send...
- Category: AndroidOS
- Hits: 14695
A quick article on how to replace the return key on a soft keyboard (software based) on a touch-device.
Why?
I have an editText where a user can enter any text value but if they typed a return character, the app would crash because it didn't understand the data. I tried replacing the new lines but just stopping the return key or trying to catch it is an obsolete method.
How?
Two icons created on Android
- Category: AndroidOS
- Hits: 15335
If you're installing an app and it creates two icons:
Why?
I don't think I'll forget this one but I was stumped for a bit until I found it on the a forum: Stack Overflow: Android App Development.
How?
Basically don't have the following declared more than once in the AndroidManifest.xml
<intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter>
Page 3 of 3
Credit where Credit is Due:
Feel free to copy, redistribute and share this information. All that we ask is that you attribute credit and possibly even a link back to this website as it really helps in our search engine rankings.
Disclaimer: Please note that the information provided on this website is intended for informational purposes only and does not represent a warranty. The opinions expressed are those of the author only. We recommend testing any solutions in a development environment before implementing them in production. The articles are based on our good faith efforts and were current at the time of writing, reflecting our practical experience in a commercial setting.
Thank you for visiting and, as always, we hope this website was of some use to you!
Kind Regards,
Joel Lipman
www.joellipman.com