background preloader

Random Tips

Facebook Twitter

Fragment Transactions & Activity State Loss. The following stack trace and exception message has plagued StackOverflow ever since Honeycomb’s initial release: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState at android.support.v4.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1341) at android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:1352) at android.support.v4.app.BackStackRecord.commitInternal(BackStackRecord.java:595) at android.support.v4.app.BackStackRecord.commit(BackStackRecord.java:574) This post will explain why and when this exception is thrown, and will conclude with several suggestions that will help ensure it never crashes your application again. Why was the exception thrown? The exception was thrown because you attempted to commit a FragmentTransaction after the activity’s state had been saved, resulting in a phenomenon known as Activity state loss.

So why then is the exception thrown? When is the exception thrown? How to avoid the exception? Tous les codes secrets cachés dans Android. Database - What are the best practices for SQLite on Android? Single SQLite connection | Touch Lab Blog. Les codes secrets Android pour accéder à vos informations cachées. Les codes USSD sur Android ne sont pas que des codes secrets qui nous aideront nous les nerds à faire joujou avec nos smartphones, voire les bricker parfois. Ils peuvent être utiles pour accéder à des informations sur votre appareil, pour le développement ou pour effectuer des actions rapidement. Les codes secrets sur Android, qu'est que c'est ?

Les codes USSD On les confond souvent avec les codes secrets sur Android. Tout d'abord, USSD signifie Unstructured Supplementary Service Data, soit en français Service supplémentaire pour données non structurées. C'est un protocole qui permet d'envoyer des informations via les réseaux GSM, 3G ou 4G. L'idée est de pouvoir déclencher des actions à distance, en envoyant un code précis pour chacune. Les options développeurs sont-elles avantageuses sur Android ? Pour les entrer, il suffit de le faire directement depuis le pad de l'application d'appel.

Dans les faits, on l'utilise traditionnellement pour demander des informations à son opérateur mobile. Exploit (& Fix) Android "Master Key" Earlier this year, Bluebox Security announced that they had found a bug in Android that could be used to modify the contents of any application package (including ones distributed as part of the system software) without affecting the attached cryptographic signatures; details to be disclosed at Black Hat USA 2013.

However, enough detail was disclosed in the abstract of the talk that others were able to find this bug. Later, a patch was applied to the popular open-source Android ROM CyanogenMod, making the issue both public and obvious: there are now proof-of-concepts for how this bug might be used in concrete form. In this article, I describe a different approach to the exploitation of bug #8219321 that does not fall prey to the limitations of previous descriptions (specifically, the packages being attacked do not need to have an existing "classes.dex" file inside, which is not actually common on production devices). Background Information Play Store Safety Responsible Disclosure if (! GL11ExtensionPack (BlackBerry JDE 5.0.0 API Reference) (OES_framebuffer_object extension) Attach an image from a texture object to a framebuffer. To render directly into a texture image, a specified image from a texture object can be attached as one of the logical buffers of the currently bound framebuffer object by calling this method.

GL_INVALID_OPERATION is generated if the current value of GL_FRAMEBUFFER_BINDING_OES is zero when glFramebufferTexture2DOES is called. attachment must be one of the attachment points of the framebuffer, either GL_COLOR_ATTACHMENT n_OES (where n is from 0 to GL_MAX_COLOR_ATTACHMENTS_OES - 1), GL_DEPTH_ATTACHMENT_OES, or GL_STENCIL_ATTACHMENT_OES. If texture is zero, then textarget and level are ignored. Level specifies the mipmap level of the texture image to be attached to the framebuffer and must be 0 (indicating the base MIPmap level). Calling glFramebufferTexture2DOES with texture name zero will detach the image identified by attachment, if any, in the framebuffer currently bound to target.

And. Problem with using opengl OES extension. PorterDuff Modes and Android | softwyer. PorterDuff Modes This is an article on the PorterDuff modes for Android. It’s mildly technical… Eh? Not being grounded in Computer Science, the PorterDuff modes are a bit of a mystery to us. Never mind, we’ll look at the Android documentation for PorterDuff.Mode, an example of which is shown below: public static final PorterDuff.Mode SRC_ATOP [Da, Sc * Da + (1 - Sa) * Dc] This must be the most useless piece of Javadoc in Android. A quick Google of Android and PorterDuff doesn’t really show any examples of what each mode does. Wikipedia to the rescue The Wikipedia article for PorterDuff, under Alpha Compositing, does show the effects of each of the modes.

Armed with this information, we applied various modes to our image, but nothing seemed to work as expected. A quick Google search didn’t really reveal anything out there that gave us examples of this on Android. We resigned ourselves to writing a quick example to find out what all the modes were. Android to the rescue Interesting things to note: Java - Buffer Underflow. Android Recipe #3, sliding menu, layers and filters.

This third recipe is a new take on the popular sliding menu. You can find sliding menus in many applications including Path, Evernote, Falcon Pro, Google+, etc. Very often the sliding menu is just that, a simple sliding menu. Some applications go a little farther and add a dimming effect: when you open the menu, the menu is slowly revealed by fading out a black layer. All the implementations I’ve seen, the SlidingMenu library for instance, simply draw a translucent rectangle on top of the menu. Today’s demo uses a different effect. If you cannot (or don’t want to) run the demo application you can see what the effect looks like in motion in this video.

To implement this effect you must first enable hardware layers on your views. When a hardware layer is set on a View, that View is rendered into an OpenGL texture every time it updates. If (layerType ! This piece of code simply enables hardware layers when percentOpen is in the ]0..1[ range. The blending modeThe opacityThe color filter. Displaying huge bitmaps on Android Canvas. Nostra13/Android-Universal-Image-Loader.

Multithreading - Technical details of Android Garbage Collector. Android Performance Case Study. Falcon Pro I recently installed Falcon Pro, a new Twitter client, on my Nexus 4. I really enjoy using this application but I noticed a few hiccups here and there while using it and it seemed that scrolling the main timeline did not yield a perfectly stable framerate. I dug a little bit with some of the tools and techniques I use every day at work and I was able to quickly find some of the reasons why Falcon Pro does not behave as well as it can. My goal in this article is to show you how you can track down and fix performance issues in an application, even if you don’t have its source code.

A word about performance Android 4.1 put focus on performance with Project Butter and it brought new performance analysis tools, such as systrace. Performance analysis is often a complex task that requires a lot of experience and a deep knowledge of one’s tools, hardware, APIs, etc. Confirming my suspicions $ adb shell dumpsys gfxinfo com.jv.falcon.pro Taking a closer look $ . Visualizing overdraw. Android App Development:Threading part 1: Handlers. Multi-Threading concept is essential in most platforms. it provides maximum utilization of the processor. threading is used when the program executes time consuming processes (such as calling a web service) and to give a good user experience by unblocking the UI.

Android provides threading techniques to perform time consuming tasks in a background thread with coordination with the UI thread to update the UI. Android provides the following methods of threading: Handlers.Async. Tasks. When you create an object from the Handler class, it processes Messages and Runnable objects associated with the current thread MessageQueue. the message queue holds the tasks to be executed in FIFO (First In First Out) mannser. you will need only ine Handler per activity where the background thread will communicate with to update the UI. The Handler is associated with the thread from which it’s been created We can communicate with the Handler by two methods: Messages.Runnable objects. Using Messages: AsyncTask in Android 4.0. Add floating point value to android resources/values. How to read contacts on Android 2.0.