android Programming Glossary: don't
Sending and Receiving SMS and MMS in Android (pre Kit Kat Android 4.4) http://stackoverflow.com/questions/14452808/sending-and-receiving-sms-and-mms-in-android-pre-kit-kat-android-4-4 use mobile data to perform operations like sending MMS and don't know the default APN setting present in the device android..
Sending Email in Android using JavaMail API without using the default/built-in app http://stackoverflow.com/questions/2020088/sending-email-in-android-using-javamail-api-without-using-the-default-built-in-a mail account for the mail. Cheers Hope this helps And don't forget that you cannot do network operation from the any UI..
Quitting an application - is that frowned upon? http://stackoverflow.com/questions/2033914/quitting-an-application-is-that-frowned-upon week has been somewhat of a turnoff for me... I hope I don't have to abandon Android but it doesn't look very good right.. closes up the application as needed. Those users simply don't think about terminating the Android app any more than they think.. lists with tasks that always should be there etc . I don't know what lists with tasks that always should be there means..
“Conversion to Dalvik format failed with error 1” on external JAR http://stackoverflow.com/questions/2680827/conversion-to-dalvik-format-failed-with-error-1-on-external-jar It does not show up under the Package Explorer so you don't notice it but it does get counted twice causing the dreaded..
How to call SOAP web service in Android http://stackoverflow.com/questions/297586/how-to-call-soap-web-service-in-android
Download a file with Android, and showing the progress in a ProgressDialog http://stackoverflow.com/questions/3028306/download-a-file-with-android-and-showing-the-progress-in-a-progressdialog connection.connect expect HTTP 200 OK so we don't mistakenly save error report instead of the file if connection.getResponseCode..
What is the simplest and most robust way to get the user's current location in Android? http://stackoverflow.com/questions/3145089/what-is-the-simplest-and-most-robust-way-to-get-the-users-current-location-in-a I use the provided value. I stop listeners and timer. If I don't get any updates and timer elapses I have to use last known values... LocationManager.NETWORK_PROVIDER catch Exception ex don't start listeners if no provider is enabled if gps_enabled network_enabled.. logic. For example if you get update from Network provider don't stop listeners but continue waiting. GPS gives more accurate..
Android - basic gesture detection http://stackoverflow.com/questions/937313/android-basic-gesture-detection span views If my activity implements OnGestureListener I don't know how to set that as the gesture listener for the Grid or.. custom View like GestureImageView that extends ImageView I don't know how to tell the activity that a fling has occurred from.. velocityX float velocityY int dx int e2.getX e1.getX don't accept the fling if it's too short as it may conflict with a..
Android - what's the difference between the various methods to get a Context? http://stackoverflow.com/questions/1026973/android-whats-the-difference-between-the-various-methods-to-get-a-context one of the Google engineers working on the Android SDK Don't use getBaseContext just use the Context you have. That was from..
How to read pdf in my android application? [closed] http://stackoverflow.com/questions/10299839/how-to-read-pdf-in-my-android-application R.id.pagenum_edit Hope this helps you lot. Try this. Don't forgot to add your Second.java in your manifest. Add some drawables..
Android NDK linking http://stackoverflow.com/questions/10593987/android-ndk-linking root include I my project specific stuff # Option 1 Don't link the lib in at all opt android toolchain bin arm linux androideabi..
What kind of OCR Java library should I use in Android? [closed] http://stackoverflow.com/questions/1062578/what-kind-of-ocr-java-library-should-i-use-in-android I use java android ocr share improve this question Don't know how good it is it definitely needs to be trained first..
How to disable orientation change in Android? http://stackoverflow.com/questions/1512045/how-to-disable-orientation-change-in-android restart share improve this question Update April 2013 Don't do this. It wasn't a good idea in 2009 when I first answered..
Eclipse giving error, missing R.java file after recent update http://stackoverflow.com/questions/16608524/eclipse-giving-error-missing-r-java-file-after-recent-update android.R but it is showing as unused import stating Don't include android.R here use a fully qualified name for each usage..
Failed to load map. Error contacting Google servers. This is probably an authentication issue http://stackoverflow.com/questions/17667935/failed-to-load-map-error-contacting-google-servers-this-is-probably-an-authent Must Uninstall The Application before installing it Note Don't Re install unless you Completely Uninstall the Application in..
How should I validate an e-mail address on Android? http://stackoverflow.com/questions/1819142/how-should-i-validate-an-e-mail-address-on-android android email validation share improve this question Don't use a reg ex. Apparently the following is a reg ex that correctly..
How to close Android application? http://stackoverflow.com/questions/2092951/how-to-close-android-application the HOME key pressed in the onStop method of the activity. Don't forget to handle the HOME key for any menus and in the activities..
Declaring a custom android UI element using XML http://stackoverflow.com/questions/2695646/declaring-a-custom-android-ui-element-using-xml test a.getString R.styleable.MyCustomView_extraInformation Don't forget this a.recycle R.styleable.MyCustomView is an autogenerated..
What is the simplest and most robust way to get the user's current location in Android? http://stackoverflow.com/questions/3145089/what-is-the-simplest-and-most-robust-way-to-get-the-users-current-location-in-a by the time I need it in Activity X it will be available. Don't particularly care about accuracy or frequency of update. Just..
Android: Temporarily disable orientation changes in an Activity http://stackoverflow.com/questions/3611457/android-temporarily-disable-orientation-changes-in-an-activity really works like charm... on real devices Don't think that it's broken when testing on the emulator the ctrl..
Android - Using Custom Font http://stackoverflow.com/questions/3651086/android-using-custom-font android share improve this question benvd is right. Don't use a fonts subdirectory. On Mobiletuts there is very good tutorial..
Android read text raw resource file http://stackoverflow.com/questions/4087674/android-read-text-raw-resource-file String line reader.readLine while line null ... Don't forget that readLine skips the new lines share improve this..
How to start new activity on button click http://stackoverflow.com/questions/4186021/how-to-start-new-activity-on-button-click key if it's a string you stored. added Don't forget to add your new activity in the AndroidManifest.xml activity..
Image in Canvas with touch events http://stackoverflow.com/questions/5743328/image-in-canvas-with-touch-events detector mScaleFactor detector.getScaleFactor Don't let the object get too small or too large. mScaleFactor Math.max..
Android create shortcuts on the home screen http://stackoverflow.com/questions/6337431/android-create-shortcuts-on-the-home-screen on all phones and may break in future Android releases. Don't do it. The correct way is to listen for a shortcut request from..
Getting an issue while checking the dynamically generated checkbox through list view http://stackoverflow.com/questions/7738527/getting-an-issue-while-checking-the-dynamically-generated-checkbox-through-list a checkbox you should persists the state somewhere else. Don't rely on the UI state for that because it will be recycled ...
NoClassDefFoundError for code in an Java library on Android http://stackoverflow.com/questions/8678630/noclassdeffounderror-for-code-in-an-java-library-on-android project that both my free and pro version are using. Don't know if it is relevant. See the stack trace below. Any thoughts..
Using NanoHTTPD in Android http://stackoverflow.com/questions/14309256/using-nanohttpd-in-android could not start. Log.w Httpd Web server initialized. DON'T FORGET to stop the server @Override public void onDestroy super.onDestroy..
Project has no default.properties file! Edit the project properties to set one http://stackoverflow.com/questions/3857576/project-has-no-default-properties-file-edit-the-project-properties-to-set-one under Project the project regenerating the R.java file. So DON'T try to remove R.java because Eclipse will regenerate it as soon..
how can i display a listview on the top of another activity in Android http://stackoverflow.com/questions/4547511/how-can-i-display-a-listview-on-the-top-of-another-activity-in-android savedInstanceState NO NEED TO CALL BELOW METHOD IF YOU DON'T WANT BLUR getWindow .setFlags WindowManager.LayoutParams.FLAG_BLUR_BEHIND..
Android: ItemizedOverlay onTouchEvent and onTap overlapping http://stackoverflow.com/questions/4971749/android-itemizedoverlay-ontouchevent-and-ontap-overlapping you hit an item else do what you want to do when you DON'T hit an item return true Return true in order to say that the..
How to fill ListPreference dynamically when onPreferenceClick is triggered? http://stackoverflow.com/questions/6474707/how-to-fill-listpreference-dynamically-when-onpreferenceclick-is-triggered findPreference language THIS IS REQUIRED IF YOU DON'T HAVE 'entries' and 'entryValues' in your XML setListPreferenceData..
Adding Overlay to OSMDROID http://stackoverflow.com/questions/6496366/adding-overlay-to-osmdroid on the screen viewportRect.set projection.getScreenRect DON'T set offset with either of below viewportRect.offset mWorldSize_2..
How to display a Dialog from a Service http://stackoverflow.com/questions/7918571/how-to-display-a-dialog-from-a-service this question I highly highly HIGHLY recommend that you DON'T do this it goes against Android design and UI guidelines . Notifications..
Android : Multi touch and TYPE_SYSTEM_OVERLAY http://stackoverflow.com/questions/8073803/android-multi-touch-and-type-system-overlay To create an overlay view when setting up the LayoutParams DON'T set the type to TYPE_SYSTEM_OVERLAY . Instead set it to TYPE_PHONE..
listening to LocationManager.GPS_PROVIDER doesn't fire any LocationListener events [duplicate] http://stackoverflow.com/questions/8732565/listening-to-locationmanager-gps-provider-doesnt-fire-any-locationlistener-even and listen to LocationManager.GPS_PROVIDER I DON'T get any events but if I listen to LocationManager.NETWORK_PROVIDER..
Sending and Receiving SMS and MMS in Android (pre Kit Kat Android 4.4) http://stackoverflow.com/questions/14452808/sending-and-receiving-sms-and-mms-in-android-pre-kit-kat-android-4-4 What is the alternative for all those applications which use mobile data to perform operations like sending MMS and don't know the default APN setting present in the device android sms broadcastreceiver android manifest mms share improve this..
Sending Email in Android using JavaMail API without using the default/built-in app http://stackoverflow.com/questions/2020088/sending-email-in-android-using-javamail-api-without-using-the-default-built-in-a to add External Jars Run the project and check your recipient mail account for the mail. Cheers Hope this helps And don't forget that you cannot do network operation from the any UI activity in android. So follow this answer if you have any network..
Quitting an application - is that frowned upon? http://stackoverflow.com/questions/2033914/quitting-an-application-is-that-frowned-upon issues that exist in Windows Mobile and .NET. However the last week has been somewhat of a turnoff for me... I hope I don't have to abandon Android but it doesn't look very good right now Is there a way for me to really quit the application android.. are perfectly happy with the model where the environment closes up the application as needed. Those users simply don't think about terminating the Android app any more than they think about terminating a Web page or terminating a thermostat... lot of things going on in my app data being PUSHed to the device lists with tasks that always should be there etc . I don't know what lists with tasks that always should be there means but the data being PUSHed to the device is a pleasant fiction..
“Conversion to Dalvik format failed with error 1” on external JAR http://stackoverflow.com/questions/2680827/conversion-to-dalvik-format-failed-with-error-1-on-external-jar into my src folder and THEN added it as a Java Path Library. It does not show up under the Package Explorer so you don't notice it but it does get counted twice causing the dreaded Dalvik error 1. Another possible reason could be package name..
How to call SOAP web service in Android http://stackoverflow.com/questions/297586/how-to-call-soap-web-service-in-android
Download a file with Android, and showing the progress in a ProgressDialog http://stackoverflow.com/questions/3028306/download-a-file-with-android-and-showing-the-progress-in-a-progressdialog URL url new URL sUrl 0 connection HttpURLConnection url.openConnection connection.connect expect HTTP 200 OK so we don't mistakenly save error report instead of the file if connection.getResponseCode HttpURLConnection.HTTP_OK return Server..
What is the simplest and most robust way to get the user's current location in Android? http://stackoverflow.com/questions/3145089/what-is-the-simplest-and-most-robust-way-to-get-the-users-current-location-in-a you can enlarge it. If I get update from location listener I use the provided value. I stop listeners and timer. If I don't get any updates and timer elapses I have to use last known values. I grab last known values from available providers and.. catch Exception ex try network_enabled lm.isProviderEnabled LocationManager.NETWORK_PROVIDER catch Exception ex don't start listeners if no provider is enabled if gps_enabled network_enabled return false if gps_enabled lm.requestLocationUpdates.. Location location Somebody may also want to modify my logic. For example if you get update from Network provider don't stop listeners but continue waiting. GPS gives more accurate data so it's worth waiting for it. If timer elapses and you've..
Android - basic gesture detection http://stackoverflow.com/questions/937313/android-basic-gesture-detection that recognizes a fling. I presume this is because it may span views If my activity implements OnGestureListener I don't know how to set that as the gesture listener for the Grid or the Image views that I add. public class SelectFilterActivity.. View.OnClickListener OnTouchListener ... If I make a custom View like GestureImageView that extends ImageView I don't know how to tell the activity that a fling has occurred from the view. In any case I tried this and the methods weren't.. public boolean onFling MotionEvent e1 MotionEvent e2 float velocityX float velocityY int dx int e2.getX e1.getX don't accept the fling if it's too short as it may conflict with a button push if Math.abs dx MAJOR_MOVE Math.abs velocityX Math.absvelocityY..
Android - what's the difference between the various methods to get a Context? http://stackoverflow.com/questions/1026973/android-whats-the-difference-between-the-various-methods-to-get-a-context to use getBaseContext other than a post from Dianne Hackborn one of the Google engineers working on the Android SDK Don't use getBaseContext just use the Context you have. That was from a post on the android developers newsgroup you may want..
How to read pdf in my android application? [closed] http://stackoverflow.com/questions/10299839/how-to-read-pdf-in-my-android-application return R.id.btExit public int getPdfPageNumberEditField return R.id.pagenum_edit Hope this helps you lot. Try this. Don't forgot to add your Second.java in your manifest. Add some drawables whatever it requires in second.java with your drawables...
Android NDK linking http://stackoverflow.com/questions/10593987/android-ndk-linking fpic c Client_Events.cpp Client Wrapper.cpp jni.cpp I opt android root include I my project specific stuff # Option 1 Don't link the lib in at all opt android toolchain bin arm linux androideabi g shared Wl soname libmy_lib.so o libmy_lib.so jni.o..
What kind of OCR Java library should I use in Android? [closed] http://stackoverflow.com/questions/1062578/what-kind-of-ocr-java-library-should-i-use-in-android a picture extracting text from it . What Java library should I use java android ocr share improve this question Don't know how good it is it definitely needs to be trained first but there is Ron Cemer's Java OCR library . share improve this..
How to disable orientation change in Android? http://stackoverflow.com/questions/1512045/how-to-disable-orientation-change-in-android how I can prevent that android orientation android activity restart share improve this question Update April 2013 Don't do this. It wasn't a good idea in 2009 when I first answered the question and it really isn't a good idea now. See this..
Eclipse giving error, missing R.java file after recent update http://stackoverflow.com/questions/16608524/eclipse-giving-error-missing-r-java-file-after-recent-update R cannot be resolved to a variable . I have imported import android.R but it is showing as unused import stating Don't include android.R here use a fully qualified name for each usage instead . Same thing is happening with Mac OS also with..
Failed to load map. Error contacting Google servers. This is probably an authentication issue http://stackoverflow.com/questions/17667935/failed-to-load-map-error-contacting-google-servers-this-is-probably-an-authent Manager Select Your Application Click on Clear Data Or Must Uninstall The Application before installing it Note Don't Re install unless you Completely Uninstall the Application in order to clear its Data completely share improve this answer..
How should I validate an e-mail address on Android? http://stackoverflow.com/questions/1819142/how-should-i-validate-an-e-mail-address-on-android in Android already or would I have to use RegExp java android email validation share improve this question Don't use a reg ex. Apparently the following is a reg ex that correctly validates most e mails addresses that conform to RFC 2822..
How to close Android application? http://stackoverflow.com/questions/2092951/how-to-close-android-application the HOME key was not pressed and then checking to see of the HOME key pressed in the onStop method of the activity. Don't forget to handle the HOME key for any menus and in the activities that are started by the menus. The same goes for the SEARCH..
Declaring a custom android UI element using XML http://stackoverflow.com/questions/2695646/declaring-a-custom-android-ui-element-using-xml Color.BLACK Log.i test a.getString R.styleable.MyCustomView_extraInformation Don't forget this a.recycle R.styleable.MyCustomView is an autogenerated int resource where each element is the ID of an attribute...
What is the simplest and most robust way to get the user's current location in Android? http://stackoverflow.com/questions/3145089/what-is-the-simplest-and-most-robust-way-to-get-the-users-current-location-in-a of nearby locations. Preload the user's location so that by the time I need it in Activity X it will be available. Don't particularly care about accuracy or frequency of update. Just grabbing one location is sufficient as long as it's not way..
Android: Temporarily disable orientation changes in an Activity http://stackoverflow.com/questions/3611457/android-temporarily-disable-orientation-changes-in-an-activity and then setRequestedOrientation ActivityInfo.SCREEN_ORIENTATION_SENSOR really works like charm... on real devices Don't think that it's broken when testing on the emulator the ctrl F11 shortcut ALWAYS change the screen orientation without emulating..
Android - Using Custom Font http://stackoverflow.com/questions/3651086/android-using-custom-font myTypeface Can anyone please get me out of this issue android share improve this question benvd is right. Don't use a fonts subdirectory. On Mobiletuts there is very good tutorial on Text formatting for Android. Quick Tip Customize..
Android read text raw resource file http://stackoverflow.com/questions/4087674/android-read-text-raw-resource-file
How to start new activity on button click http://stackoverflow.com/questions/4186021/how-to-start-new-activity-on-button-click savedInstanceState Intent intent getIntent String value intent.getStringExtra key if it's a string you stored. added Don't forget to add your new activity in the AndroidManifest.xml activity android label @string app_name android name NextActivity..
Image in Canvas with touch events http://stackoverflow.com/questions/5743328/image-in-canvas-with-touch-events @Override public boolean onScale ScaleGestureDetector detector mScaleFactor detector.getScaleFactor Don't let the object get too small or too large. mScaleFactor Math.max 0.1f Math.min mScaleFactor 10.0f invalidate return true..
Android create shortcuts on the home screen http://stackoverflow.com/questions/6337431/android-create-shortcuts-on-the-home-screen to install a shortcut. As someone told you this may not work on all phones and may break in future Android releases. Don't do it. The correct way is to listen for a shortcut request from the home screen with an intent filter like so in your manifest..
Getting an issue while checking the dynamically generated checkbox through list view http://stackoverflow.com/questions/7738527/getting-an-issue-while-checking-the-dynamically-generated-checkbox-through-list recycled view will keep the actual position. When you click a checkbox you should persists the state somewhere else. Don't rely on the UI state for that because it will be recycled . So call viewHolder.checkbox.setChecked persistedState before..
NoClassDefFoundError for code in an Java library on Android http://stackoverflow.com/questions/8678630/noclassdeffounderror-for-code-in-an-java-library-on-android out why. The architecture of the app is that there is a common project that both my free and pro version are using. Don't know if it is relevant. See the stack trace below. Any thoughts java.lang.NoClassDefFoundError com.android.common.MainActivity..
Using NanoHTTPD in Android http://stackoverflow.com/questions/14309256/using-nanohttpd-in-android try server.start catch IOException ioe Log.w Httpd The server could not start. Log.w Httpd Web server initialized. DON'T FORGET to stop the server @Override public void onDestroy super.onDestroy if server null server.stop private class WebServer..
Project has no default.properties file! Edit the project properties to set one http://stackoverflow.com/questions/3857576/project-has-no-default-properties-file-edit-the-project-properties-to-set-one as a reason to automatically rebuild see the options under Project the project regenerating the R.java file. So DON'T try to remove R.java because Eclipse will regenerate it as soon as you rebuild the project which will result in a match..
how can i display a listview on the top of another activity in Android http://stackoverflow.com/questions/4547511/how-can-i-display-a-listview-on-the-top-of-another-activity-in-android void onCreate Bundle savedInstanceState super.onCreate savedInstanceState NO NEED TO CALL BELOW METHOD IF YOU DON'T WANT BLUR getWindow .setFlags WindowManager.LayoutParams.FLAG_BLUR_BEHIND WindowManager.LayoutParams.FLAG_BLUR_BEHIND setContentView..
Android: ItemizedOverlay onTouchEvent and onTap overlapping http://stackoverflow.com/questions/4971749/android-itemizedoverlay-ontouchevent-and-ontap-overlapping super.onTap p mapView if tapped do what you want to do when you hit an item else do what you want to do when you DON'T hit an item return true Return true in order to say that the listener has correctly taken the event into account @Override..
How to fill ListPreference dynamically when onPreferenceClick is triggered? http://stackoverflow.com/questions/6474707/how-to-fill-listpreference-dynamically-when-onpreferenceclick-is-triggered catch Exception e final ListPreference listPreference ListPreference findPreference language THIS IS REQUIRED IF YOU DON'T HAVE 'entries' and 'entryValues' in your XML setListPreferenceData listPreference listPreference.setOnPreferenceClickListener..
Adding Overlay to OSMDROID http://stackoverflow.com/questions/6496366/adding-overlay-to-osmdroid zoomLevel 2 Save the Mercator coordinates of what is on the screen viewportRect.set projection.getScreenRect DON'T set offset with either of below viewportRect.offset mWorldSize_2 mWorldSize_2 viewportRect.offset mWorldSize_2 mWorldSize_2..
How to display a Dialog from a Service http://stackoverflow.com/questions/7918571/how-to-display-a-dialog-from-a-service Thank you Filip android service dialog share improve this question I highly highly HIGHLY recommend that you DON'T do this it goes against Android design and UI guidelines . Notifications are the preferred way to accomplish what you are..
Android : Multi touch and TYPE_SYSTEM_OVERLAY http://stackoverflow.com/questions/8073803/android-multi-touch-and-type-system-overlay the entire example project. Update for Android 4.0 1 3 2013 To create an overlay view when setting up the LayoutParams DON'T set the type to TYPE_SYSTEM_OVERLAY . Instead set it to TYPE_PHONE . Use the following flags FLAG_NOT_TOUCH_MODAL FLAG_WATCH_OUTSIDE_TOUCH..
listening to LocationManager.GPS_PROVIDER doesn't fire any LocationListener events [duplicate] http://stackoverflow.com/questions/8732565/listening-to-locationmanager-gps-provider-doesnt-fire-any-locationlistener-even LocationManager in Android It seems that when I requestLocationUpdates and listen to LocationManager.GPS_PROVIDER I DON'T get any events but if I listen to LocationManager.NETWORK_PROVIDER I DO get updates So this one with NETWORK_PROVIDER works...
|