<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2955246950758454841</id><updated>2024-09-24T14:28:21.611+01:00</updated><category term="Windows Phone"/><category term="Android"/><category term="Animation"/><category term="Theme"/><category term="Asynchronous"/><category term="Back Key"/><category term="Edit Mode"/><category term="IDE"/><category term="Navigation"/><category term="SIP"/><category term="Soft Input Panel"/><category term="Storage"/><category term="Thread"/><category term="Virtual Keyboard"/><category term="Asset Files"/><category term="Code Generation"/><category term="Content Files"/><category term="Cross-Platform"/><category term="Emulator"/><category term="Native"/><category term="Screen Saver"/><category term="State"/><category term="Tombstone"/><category term="User Control"/><category term="WPF"/><title type='text'>Developer Goodies</title><subtitle type='html'>Resources for Developers</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://developergoodies.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2955246950758454841/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://developergoodies.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>21</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2955246950758454841.post-5189915517079152913</id><published>2013-01-07T12:33:00.002+00:00</published><updated>2013-02-13T15:30:09.868+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Back Key"/><category scheme="http://www.blogger.com/atom/ns#" term="Navigation"/><category scheme="http://www.blogger.com/atom/ns#" term="Windows Phone"/><title type='text'>Detect (And Cancel) Windows Phone Back Key</title><content type='html'>To detect when the user presses the back key, you just have to override the OnBackKeyPress function.&lt;br /&gt;
&lt;br /&gt;
Just like this:&lt;br /&gt;
&lt;pre name=code&quot; class=&quot;brush:csharp&quot;&gt;protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
{
    // to cancel the event
    e.Cancel = true;
}&lt;/pre&gt;You can optionally cancel the navigation or allow it to occur.&lt;br /&gt;
&lt;br /&gt;
You cancel the navigation by calling the instruction on line four.&lt;br /&gt;
&lt;br /&gt;
Obviously you can code any logic to conditionally cancel the navigation.&lt;br /&gt;
&lt;br /&gt;
Another use is to catch the event just to persist any information and then letting the navigation occur. </content><link rel='replies' type='application/atom+xml' href='http://developergoodies.blogspot.com/feeds/5189915517079152913/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://developergoodies.blogspot.com/2013/01/detect-and-cancel-windows-phone-back-key.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2955246950758454841/posts/default/5189915517079152913'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2955246950758454841/posts/default/5189915517079152913'/><link rel='alternate' type='text/html' href='http://developergoodies.blogspot.com/2013/01/detect-and-cancel-windows-phone-back-key.html' title='Detect (And Cancel) Windows Phone Back Key'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2955246950758454841.post-1094128350600047708</id><published>2013-01-07T12:04:00.000+00:00</published><updated>2013-01-07T12:04:30.018+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="Back Key"/><category scheme="http://www.blogger.com/atom/ns#" term="Navigation"/><title type='text'>Detect (And Cancel) Android Back Key</title><content type='html'>To detect when the user presses the back key, you just have to override the onBackPressed function.&lt;br /&gt;
&lt;br /&gt;
Just like this:&lt;br /&gt;
&lt;pre name=code&quot; class=&quot;brush:java&quot;&gt;@Override
public void onBackPressed() {
    super.onBackPressed();
}&lt;/pre&gt;You can optionally cancel the navigation or allow it to occur.&lt;br /&gt;
&lt;br /&gt;
You cancel the navigation by not calling the instruction on like two.&lt;br /&gt;
&lt;br /&gt;
Obviously you can code any logic to conditionally cancel the navigation.&lt;br /&gt;
&lt;br /&gt;
Another use is to catch the event just to persist any information and then letting the navigation occur. </content><link rel='replies' type='application/atom+xml' href='http://developergoodies.blogspot.com/feeds/1094128350600047708/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://developergoodies.blogspot.com/2013/01/detect-and-cancel-android-back-key.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2955246950758454841/posts/default/1094128350600047708'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2955246950758454841/posts/default/1094128350600047708'/><link rel='alternate' type='text/html' href='http://developergoodies.blogspot.com/2013/01/detect-and-cancel-android-back-key.html' title='Detect (And Cancel) Android Back Key'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2955246950758454841.post-1428103467422287960</id><published>2012-12-22T17:56:00.000+00:00</published><updated>2012-12-22T17:56:02.765+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="User Control"/><title type='text'>Create Android User Control</title><content type='html'>There are several ways for creating reusable UI components in Android.&lt;br /&gt;
&lt;br /&gt;
The one described here is creating a new view made with other views (much like a usercontrol in .Net).&lt;br /&gt;
&lt;br /&gt;
Creating an Android user control requires a layout and a class just like creating an activity.&lt;br /&gt;
&lt;br /&gt;
The layout can be whatever you want and the relevant aspect is the layout root you choose.&lt;br /&gt;
&lt;br /&gt;
In this example, the layout root is a Framelayout (but can be any other):&lt;br /&gt;
&lt;pre name=code&quot; class=&quot;brush:html&quot;&gt;&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;Framelayout
    xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
    android:id=&quot;@+id/layoutroot&quot; &gt;

    &lt;!-- Your user control UI --&gt;
&lt;/FrameLayout&gt;
&lt;/pre&gt;Then, you must create a class to handle the logic of your user control.&lt;br /&gt;
&lt;br /&gt;
The base class must be the same class of the layout root.&lt;br /&gt;
&lt;br /&gt;
In the example, the class extends FrameLayout as it is the layout root of the previous example:&lt;br /&gt;
&lt;pre name=code&quot; class=&quot;brush:java&quot;&gt;package YourPackage;

public class YourUserControl extends FrameLayout {
    public YourUserControl(Context context) {
        super(context);
    }
    public YourUserControl(Context context, AttributeSet attrs) {
        super(context, attrs);

        LayoutInflater inflater = LayoutInflater.from(context);
        inflater.inflate(R.layout.yourusercontrollayoutid, this);

        //more code if needed
    }

    //more code
}
&lt;/pre&gt;You reference your new UI component in xml just like any Android view by referencing the package and class name:&lt;br /&gt;
&lt;pre name=code&quot; class=&quot;brush:text&quot;&gt;&amp;lt;YourPackage.YourUserControl /&amp;gt;
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://developergoodies.blogspot.com/feeds/1428103467422287960/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://developergoodies.blogspot.com/2012/12/create-android-user-control.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2955246950758454841/posts/default/1428103467422287960'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2955246950758454841/posts/default/1428103467422287960'/><link rel='alternate' type='text/html' href='http://developergoodies.blogspot.com/2012/12/create-android-user-control.html' title='Create Android User Control'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2955246950758454841.post-7033985918612737382</id><published>2012-12-19T12:37:00.003+00:00</published><updated>2012-12-19T12:37:39.672+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Screen Saver"/><category scheme="http://www.blogger.com/atom/ns#" term="WPF"/><title type='text'>Prevent Screen Saver In WPF Application</title><content type='html'>Sometimes we want your application to be always visible, preventing the screen saver (or monitor off) to happen.&lt;br /&gt;
&lt;br /&gt;
We can achieve this by calling an API of the OS.&lt;br /&gt;
&lt;br /&gt;
First we have to declare the OS API:&lt;br /&gt;
&lt;pre name=code&quot; class=&quot;brush:csharp&quot;&gt;[DllImport(&quot;kernel32.dll&quot;)]
private static extern uint SetThreadExecutionState(uint esFlags);
private const uint ES_CONTINUOUS = 0x80000000;
private const uint ES_SYSTEM_REQUIRED = 0x00000001;
private const uint ES_DISPLAY_REQUIRED = 0x00000002;
&lt;/pre&gt;&lt;br /&gt;
When the application starts (or any time you want to disable the screen saver):&lt;br /&gt;
&lt;pre name=code&quot; class=&quot;brush:csharp&quot;&gt;SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED | ES_DISPLAY_REQUIRED);
&lt;/pre&gt;&lt;br /&gt;
When the application ends (or any time you want to enable the screen saver):&lt;br /&gt;
&lt;pre name=code&quot; class=&quot;brush:csharp&quot;&gt;SetThreadExecutionState(ES_CONTINUOUS);
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://developergoodies.blogspot.com/feeds/7033985918612737382/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://developergoodies.blogspot.com/2012/12/prevent-screen-saver-in-wpf-application.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2955246950758454841/posts/default/7033985918612737382'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2955246950758454841/posts/default/7033985918612737382'/><link rel='alternate' type='text/html' href='http://developergoodies.blogspot.com/2012/12/prevent-screen-saver-in-wpf-application.html' title='Prevent Screen Saver In WPF Application'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2955246950758454841.post-6087332630943343805</id><published>2012-12-11T10:49:00.000+00:00</published><updated>2012-12-11T10:53:28.946+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Edit Mode"/><category scheme="http://www.blogger.com/atom/ns#" term="IDE"/><category scheme="http://www.blogger.com/atom/ns#" term="Windows Phone"/><title type='text'>Detect Windows Phone Application In Edit Mode</title><content type='html'>Sometimes we have to know when your code is running in the editor.&lt;br /&gt;
&lt;br /&gt;
When authoring a control, it&#39;s common to include code that must run outside the editor, otherwise it would cause an exception in edit mode.&lt;br /&gt;
&lt;br /&gt;
The following code shows how to do it:&lt;br /&gt;
&lt;pre name=code&quot; class=&quot;brush:csharp&quot;&gt;public partial class YourControl: UserControl
{
    public YourControl()
    {
        InitializeComponent();

        if (!DesignerProperties.IsInDesignTool)
        {
            //code to run outside the editor
        }
    }
}
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://developergoodies.blogspot.com/feeds/6087332630943343805/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://developergoodies.blogspot.com/2012/12/detect-windows-phone-application-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2955246950758454841/posts/default/6087332630943343805'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2955246950758454841/posts/default/6087332630943343805'/><link rel='alternate' type='text/html' href='http://developergoodies.blogspot.com/2012/12/detect-windows-phone-application-in.html' title='Detect Windows Phone Application In Edit Mode'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2955246950758454841.post-6882619733445874666</id><published>2012-12-11T10:43:00.000+00:00</published><updated>2012-12-11T10:53:23.886+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="Edit Mode"/><category scheme="http://www.blogger.com/atom/ns#" term="IDE"/><title type='text'>Detect Android Application In Edit Mode</title><content type='html'>Sometimes we have to know when your code is running in the editor.&lt;br /&gt;
&lt;br /&gt;
When authoring a control, it&#39;s common to include code that must run outside the editor, otherwise it would cause an exception in edit mode.&lt;br /&gt;
&lt;br /&gt;
The following code shows how to do it:&lt;br /&gt;
&lt;pre name=code&quot; class=&quot;brush:java&quot;&gt;public class YourControl extends FrameLayout {
    public YourControl (Context context, AttributeSet attrs) {
        super(context, attrs);

        if (!isInEditMode()) {
            //code to run outside the editor
        }
}
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://developergoodies.blogspot.com/feeds/6882619733445874666/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://developergoodies.blogspot.com/2012/12/detect-android-application-in-edit-mode.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2955246950758454841/posts/default/6882619733445874666'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2955246950758454841/posts/default/6882619733445874666'/><link rel='alternate' type='text/html' href='http://developergoodies.blogspot.com/2012/12/detect-android-application-in-edit-mode.html' title='Detect Android Application In Edit Mode'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2955246950758454841.post-1734005727841264705</id><published>2012-12-04T16:57:00.000+00:00</published><updated>2012-12-05T09:57:29.454+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="Emulator"/><title type='text'>Speed Up Android Emulator</title><content type='html'>The android emulator runs an actual ROM of a physical device.&lt;br /&gt;
&lt;br /&gt;
If the device is based on the ARM architecture lots of translation must be done to run it on a x86 system.&lt;br /&gt;
&lt;br /&gt;
However, we can choose an x86 ROM when available.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhyne7NUulDFHDbdmK5-v1GxPAXYLnLRImlSD8bNM-kyqVvXKHDmt7lnGIzf7KPhdm7R6bmHBg1uYGpvFdrK-xmQVFWV4foixvQqyguyqNPeNRn95OvvFewBPX0hejrdIIdJuVV1X-B5cw/s1600/CreateNewAndroidVirtualDevice.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left:1em; margin-right:1em&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;257&quot; width=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhyne7NUulDFHDbdmK5-v1GxPAXYLnLRImlSD8bNM-kyqVvXKHDmt7lnGIzf7KPhdm7R6bmHBg1uYGpvFdrK-xmQVFWV4foixvQqyguyqNPeNRn95OvvFewBPX0hejrdIIdJuVV1X-B5cw/s400/CreateNewAndroidVirtualDevice.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
We don&#39;t have to, but it&#39;s a good option to use the host GPU to speed the rendering.&lt;br /&gt;
&lt;br /&gt;
Don&#39;t activate this option when targeting Intel Atom x86 System Image (Intel Corporation) - API Level 10. In my case this prevents the emulator to open.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSEdfthZRxMEiMszd_2hm2mhDShJDuwQTAGmQznqHGgU1FM-aIUvEZIBvmtPAcuZ89xP_hyphenhyphenn5vbtRoz1rZuDu3jRBxR_Lr6pGyByCjnjVcJC26Amt9dH9om6-uBXf3RiYbYwxhE13Nm8s/s1600/CreateNewAndroidVirtualDevice1.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left:1em; margin-right:1em&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;257&quot; width=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSEdfthZRxMEiMszd_2hm2mhDShJDuwQTAGmQznqHGgU1FM-aIUvEZIBvmtPAcuZ89xP_hyphenhyphenn5vbtRoz1rZuDu3jRBxR_Lr6pGyByCjnjVcJC26Amt9dH9om6-uBXf3RiYbYwxhE13Nm8s/s400/CreateNewAndroidVirtualDevice1.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
In the Android SDK Manager download the Intel x86 Emulator Accelerator (HAXM) package.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiB2neCZY3-pHi0aR-EWPiPz8Iq2auibyzLjIzX9pxB07SvQyrHFENGfLY55rGp3z5KPJKYaJ8jzR-EAT4-3ZaM8YcMVtfC8vvnEsr5avnmN1yY7QtC35wJl9uKeofyehChZWWJTNZl4L0/s1600/CreateNewAndroidVirtualDevice2.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left:1em; margin-right:1em&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;301&quot; width=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiB2neCZY3-pHi0aR-EWPiPz8Iq2auibyzLjIzX9pxB07SvQyrHFENGfLY55rGp3z5KPJKYaJ8jzR-EAT4-3ZaM8YcMVtfC8vvnEsr5avnmN1yY7QtC35wJl9uKeofyehChZWWJTNZl4L0/s400/CreateNewAndroidVirtualDevice2.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
The Android SDK Manager downloads the Intel x86 Emulator Accelerator (HAXM) package but doesn&#39;t run the installation, you must do it yourself.&lt;br /&gt;
&lt;br /&gt;
Failing to do so, you will get the following message when starting a virtual device:&lt;br /&gt;
&lt;pre name=code&quot; class=&quot;brush:html&quot;&gt;emulator: Failed to open the HAX device!
HAX is not working and emulator runs in emulation mode
emulator: Open HAX device failed
&lt;/pre&gt;Locate and run the file IntelHaxm.exe.&lt;br /&gt;
&lt;br /&gt;
In my case it can be found at C:\Program Files (x86)\Android\android-sdk\extras\intel\Hardware_Accelerated_Execution_Manager.</content><link rel='replies' type='application/atom+xml' href='http://developergoodies.blogspot.com/feeds/1734005727841264705/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://developergoodies.blogspot.com/2012/12/speed-up-android-emulator.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2955246950758454841/posts/default/1734005727841264705'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2955246950758454841/posts/default/1734005727841264705'/><link rel='alternate' type='text/html' href='http://developergoodies.blogspot.com/2012/12/speed-up-android-emulator.html' title='Speed Up Android Emulator'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhyne7NUulDFHDbdmK5-v1GxPAXYLnLRImlSD8bNM-kyqVvXKHDmt7lnGIzf7KPhdm7R6bmHBg1uYGpvFdrK-xmQVFWV4foixvQqyguyqNPeNRn95OvvFewBPX0hejrdIIdJuVV1X-B5cw/s72-c/CreateNewAndroidVirtualDevice.jpg" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2955246950758454841.post-6144937229700140999</id><published>2012-11-29T11:38:00.000+00:00</published><updated>2012-11-30T09:49:04.704+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Content Files"/><category scheme="http://www.blogger.com/atom/ns#" term="Storage"/><category scheme="http://www.blogger.com/atom/ns#" term="Windows Phone"/><title type='text'>Copy Windows Phone Content To Isolated Storage</title><content type='html'>Some times a database is deployed with the application as a content file.&lt;br /&gt;
&lt;br /&gt;
However, the database can&#39;t be used directly, it must be copied to the storage first.&lt;br /&gt;
&lt;br /&gt;
In this sample code, the content file is copied to the isolated storage if it isn&#39;t copied yet.&lt;br /&gt;
&lt;pre name=code&quot; class=&quot;brush:csharp&quot;&gt;IsolatedStorageFile ISF = IsolatedStorageFile.GetUserStoreForApplication();
String DBFile = &quot;DB.sqlite&quot;;
if (!ISF.FileExists(DBFile)) CopyFromContentToStorage(ISF, &quot;Database/DB.sqlite&quot;, DBFile);

private void CopyFromContentToStorage(IsolatedStorageFile ISF, String SourceFile, String DestinationFile)
{
    Stream Stream = Application.GetResourceStream(new Uri(SourceFile, UriKind.Relative)).Stream;
    IsolatedStorageFileStream ISFS = new IsolatedStorageFileStream(DestinationFile, System.IO.FileMode.Create, System.IO.FileAccess.Write, ISF);
    CopyStream(Stream, ISFS);
    ISFS.Flush();
    ISFS.Close();
    Stream.Close();
    ISFS.Dispose();
}
private void CopyStream(Stream Input, IsolatedStorageFileStream Output)
{
    Byte[] Buffer = new Byte[5120];
    Int32 ReadCount = Input.Read(Buffer, 0, Buffer.Length);
    while (ReadCount &gt; 0)
    {
        Output.Write(Buffer, 0, ReadCount);
        ReadCount = Input.Read(Buffer, 0, Buffer.Length);
    }
}
&lt;/pre&gt;The code assumes that the file to be copied is named &#39;DB.sqlite&#39; that resides in a folder named &#39;database&#39; and was added to the project as a content file.&lt;br /&gt;
</content><link rel='replies' type='application/atom+xml' href='http://developergoodies.blogspot.com/feeds/6144937229700140999/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://developergoodies.blogspot.com/2012/11/copy-windows-phone-content-to-isolated.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2955246950758454841/posts/default/6144937229700140999'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2955246950758454841/posts/default/6144937229700140999'/><link rel='alternate' type='text/html' href='http://developergoodies.blogspot.com/2012/11/copy-windows-phone-content-to-isolated.html' title='Copy Windows Phone Content To Isolated Storage'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2955246950758454841.post-3543626299301936355</id><published>2012-11-29T11:12:00.002+00:00</published><updated>2012-11-29T16:36:42.544+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="Asset Files"/><category scheme="http://www.blogger.com/atom/ns#" term="Storage"/><title type='text'>Copy Android Asset To Internal Storage</title><content type='html'>Some times a database is deployed with the application as an asset.&lt;br /&gt;
&lt;br /&gt;
However, the database can&#39;t be used directly, it must be copied to the storage first.&lt;br /&gt;
&lt;br /&gt;
In this sample code, the asset is copied to the internal storage if it isn&#39;t copied yet.&lt;br /&gt;
&lt;pre name=code&quot; class=&quot;brush:java&quot;&gt;Context Context = getApplicationContext();
String DestinationFile = Context.getFilesDir().getPath() + File.separator + &quot;DB.sqlite&quot;;
if (!new File(DestinationFile).exists()) {
  try {
    CopyFromAssetsToStorage(Context, &quot;Database/DB.sqlite&quot;, DestinationFile);
  } catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
  }
}

private void CopyFromAssetsToStorage(Context Context, String SourceFile, String DestinationFile) throws IOException {
  InputStream IS = Context.getAssets().open(SourceFile);
  OutputStream OS = new FileOutputStream(DestinationFile);
  CopyStream(IS, OS);
  OS.flush();
  OS.close();
  IS.close();
}
private void CopyStream(InputStream Input, OutputStream Output) throws IOException {
  byte[] buffer = new byte[5120];
  int length = Input.read(buffer);
  while (length &gt; 0) {
    Output.write(buffer, 0, length);
    length = Input.read(buffer);
  }
}&lt;/pre&gt;The code assumes that the file to be copied is named &#39;DB.sqlite&#39; and it resides in a folder named &#39;database&#39; in the assets.</content><link rel='replies' type='application/atom+xml' href='http://developergoodies.blogspot.com/feeds/3543626299301936355/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://developergoodies.blogspot.com/2012/11/copy-android-asset-to-internal-storage.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2955246950758454841/posts/default/3543626299301936355'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2955246950758454841/posts/default/3543626299301936355'/><link rel='alternate' type='text/html' href='http://developergoodies.blogspot.com/2012/11/copy-android-asset-to-internal-storage.html' title='Copy Android Asset To Internal Storage'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2955246950758454841.post-4975871679119840006</id><published>2012-11-28T15:31:00.001+00:00</published><updated>2012-11-28T15:41:26.679+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="Asynchronous"/><category scheme="http://www.blogger.com/atom/ns#" term="Thread"/><title type='text'>Start Thread On Android</title><content type='html'>You can start a new thread by extending the Thread class or implementing the Runnable interface.&lt;br /&gt;
&lt;br /&gt;
Extending the Thread class:&lt;br /&gt;
&lt;pre name=code&quot; class=&quot;brush:java&quot;&gt;Thread T = new NewThread();
T.start();

private class NewThread extends Thread {
  @Override
  public void run() {
    //Your asynchronous code
  }
}
&lt;/pre&gt;Implementing the Runnable interface:&lt;br /&gt;
&lt;pre name=code&quot; class=&quot;brush:java&quot;&gt;Thread T = new Thread(new NewRunnable());
T.start();

private class NewRunnable implements Runnable {
  public void run() {
    //Your asynchronous code
  }
}
&lt;/pre&gt;Your activity may implement the Runnable interface directly.&lt;br /&gt;
In this case, when creating the Thread object you must pass the activity (this) as the parameter.</content><link rel='replies' type='application/atom+xml' href='http://developergoodies.blogspot.com/feeds/4975871679119840006/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://developergoodies.blogspot.com/2012/11/start-thread-on-android.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2955246950758454841/posts/default/4975871679119840006'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2955246950758454841/posts/default/4975871679119840006'/><link rel='alternate' type='text/html' href='http://developergoodies.blogspot.com/2012/11/start-thread-on-android.html' title='Start Thread On Android'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2955246950758454841.post-811638797848648325</id><published>2012-11-21T15:59:00.002+00:00</published><updated>2012-12-24T15:49:41.891+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="SIP"/><category scheme="http://www.blogger.com/atom/ns#" term="Soft Input Panel"/><category scheme="http://www.blogger.com/atom/ns#" term="Virtual Keyboard"/><title type='text'>Prevent Android UI Resize When Keyboard Opens</title><content type='html'>An android activity may be resized when the soft keyboard opens.&lt;br /&gt;
&lt;br /&gt;
Sometimes that&#39;s not the behavior we want.&lt;br /&gt;
&lt;br /&gt;
To disable the resizing, add the following line to the activity declaration on the manifest:&lt;br /&gt;
&lt;pre name=code&quot; class=&quot;brush:xml&quot;&gt;&lt;activity
android:windowSoftInputMode=&quot;adjustPan&quot; /&gt;
&lt;/pre&gt;If the UI contains a ScrollView, then you can also add the following to the view declaration to prevent the resizing:&lt;br /&gt;
&lt;pre name=code&quot; class=&quot;brush:xml&quot;&gt;android:isScrollContainer=&quot;false&quot; 
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://developergoodies.blogspot.com/feeds/811638797848648325/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://developergoodies.blogspot.com/2012/11/prevent-ui-resize-when-keyboard-opens.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2955246950758454841/posts/default/811638797848648325'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2955246950758454841/posts/default/811638797848648325'/><link rel='alternate' type='text/html' href='http://developergoodies.blogspot.com/2012/11/prevent-ui-resize-when-keyboard-opens.html' title='Prevent Android UI Resize When Keyboard Opens'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2955246950758454841.post-4840061396338160228</id><published>2012-11-08T16:09:00.000+00:00</published><updated>2012-11-13T23:06:09.489+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="Asynchronous"/><category scheme="http://www.blogger.com/atom/ns#" term="Thread"/><title type='text'>Update Android UI From Other Threads</title><content type='html'>Asynchronous functions are useful to run code in background so the UI will not freeze.&lt;br /&gt;
&lt;br /&gt;
Those functions can&#39;t access the UI directly because they aren&#39;t running in the UI thread.&lt;br /&gt;
&lt;br /&gt;
If you try to access the UI from those threads you will get the error:&lt;br /&gt;
&quot;Only the original thread that created a view hierarchy can touch its views.&quot;&lt;br /&gt;
&lt;br /&gt;
The solutions is to use Handlers.&lt;br /&gt;
&lt;pre name=code&quot; class=&quot;brush:java&quot;&gt;private Handler YOURHANDLER = new Handler() {
    @Override
    public void handleMessage(Message msg) {
        //do some code in the UI thread
    }
};

public void ASYNCHRONOUSFUNCTION() {
    Message Msg = new Message();
    Msg.obj = &quot;SOME TEXT&quot;; //can be any object
    YOURHANDLER.sendMessage(Msg);
}
&lt;/pre&gt;In the example, the ASYNCHRONOUSFUNCTION function runs in another thread.&lt;br /&gt;
&lt;br /&gt;
The Message object will contain any information in it&#39;s obj property that you want to send to the handler.&lt;br /&gt;
&lt;br /&gt;
Finally, you invoke the sendMessage method of the YOURHANDLER handler.</content><link rel='replies' type='application/atom+xml' href='http://developergoodies.blogspot.com/feeds/4840061396338160228/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://developergoodies.blogspot.com/2012/11/update-android-ui-from-other-threads.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2955246950758454841/posts/default/4840061396338160228'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2955246950758454841/posts/default/4840061396338160228'/><link rel='alternate' type='text/html' href='http://developergoodies.blogspot.com/2012/11/update-android-ui-from-other-threads.html' title='Update Android UI From Other Threads'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2955246950758454841.post-5392591742703290669</id><published>2012-11-08T14:17:00.001+00:00</published><updated>2012-11-19T11:27:47.747+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="SIP"/><category scheme="http://www.blogger.com/atom/ns#" term="Soft Input Panel"/><category scheme="http://www.blogger.com/atom/ns#" term="Virtual Keyboard"/><title type='text'>Programmatically Hide Android SIP</title><content type='html'>Some times we want to programmatically hide the virtual keyboard (SIP, soft input panel).&lt;br /&gt;
&lt;br /&gt;
This is how you do it:&lt;br /&gt;
&lt;pre name=code&quot; class=&quot;brush:java&quot;&gt;InputMethodManager IMM = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); 
IMM.hideSoftInputFromWindow(v.getWindowToken(), 0);
&lt;/pre&gt;In the code, the V variable may represent any view of the activity.</content><link rel='replies' type='application/atom+xml' href='http://developergoodies.blogspot.com/feeds/5392591742703290669/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://developergoodies.blogspot.com/2012/11/programmatically-hide-android-sip.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2955246950758454841/posts/default/5392591742703290669'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2955246950758454841/posts/default/5392591742703290669'/><link rel='alternate' type='text/html' href='http://developergoodies.blogspot.com/2012/11/programmatically-hide-android-sip.html' title='Programmatically Hide Android SIP'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2955246950758454841.post-3400135995704139956</id><published>2012-10-26T13:35:00.001+01:00</published><updated>2012-10-26T14:36:19.789+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Theme"/><category scheme="http://www.blogger.com/atom/ns#" term="Windows Phone"/><title type='text'>Force Windows Phone Theme</title><content type='html'>Windows Phone applications inherits the theme of the OS on launch.&lt;br /&gt;
&lt;br /&gt;
When the UI is designed specially for the dark theme it won&#39;t look well on the light theme, or vice versa.&lt;br /&gt;
&lt;br /&gt;
To prevent this the application can force the default dark or light theme.&lt;br /&gt;
&lt;br /&gt;
In the application class&#39; constructor put this code to force the dark theme:&lt;br /&gt;
&lt;pre name=code&quot; class=&quot;brush:csharp&quot;&gt;if ((Visibility)Application.Current.Resources[&quot;PhoneLightThemeVisibility&quot;] == Visibility.Visible) MergeCustomColors(&quot;/Themes/DarkStyles.xaml&quot;);
&lt;/pre&gt;Or this code to force the light theme:&lt;br /&gt;
&lt;pre name=code&quot; class=&quot;brush:csharp&quot;&gt;if ((Visibility)Application.Current.Resources[&quot;PhoneDarkThemeVisibility&quot;] == Visibility.Visible) MergeCustomColors(&quot;/Themes/LightStyles.xaml&quot;);
&lt;/pre&gt;Anywhere in your project put this method:&lt;br /&gt;
&lt;pre name=code&quot; class=&quot;brush:csharp&quot;&gt;private void MergeCustomColors(String Theme)
{
    ResourceDictionary Dictionaries = new ResourceDictionary();
    String source = String.Format(Theme);
    var themeStyles = new ResourceDictionary { Source = new Uri(source, UriKind.Relative) };
    Dictionaries.MergedDictionaries.Add(themeStyles);
    ResourceDictionary appResources = Current.Resources;
    foreach (DictionaryEntry entry in Dictionaries.MergedDictionaries[0])
    {
        SolidColorBrush ColorBrush = entry.Value as SolidColorBrush;
        SolidColorBrush ExistingBrush = appResources[entry.Key] as SolidColorBrush;
        if (ExistingBrush != null &amp;&amp; ColorBrush != null) { ExistingBrush.Color = ColorBrush.Color; }
    }
}
&lt;/pre&gt;The code assumes that the projects contains the files DarkStyles.xaml and LightStyles.xaml in a folder named Themes.&lt;br /&gt;
&lt;br /&gt;
A demo project can be found &lt;a href=&quot;http://www.mediafire.com/?oc98zcxi5k6miah&quot;&gt;here&lt;/a&gt;.</content><link rel='replies' type='application/atom+xml' href='http://developergoodies.blogspot.com/feeds/3400135995704139956/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://developergoodies.blogspot.com/2012/10/force-windows-phone-theme.html#comment-form' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2955246950758454841/posts/default/3400135995704139956'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2955246950758454841/posts/default/3400135995704139956'/><link rel='alternate' type='text/html' href='http://developergoodies.blogspot.com/2012/10/force-windows-phone-theme.html' title='Force Windows Phone Theme'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2955246950758454841.post-4600911356670713416</id><published>2012-10-26T12:07:00.000+01:00</published><updated>2012-10-26T12:08:14.657+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Theme"/><category scheme="http://www.blogger.com/atom/ns#" term="Windows Phone"/><title type='text'>Get Windows Phone Accent Color</title><content type='html'>Some times an application needs to know which accent color is currently in use on the device so it can adjust it&#39;s UI.&lt;br /&gt;
&lt;br /&gt;
The PhoneAccentColor key indicates the accent color as a Color object.&lt;br /&gt;
The PhoneAccentBrush key indicates the accent color as a Brush object.&lt;br /&gt;
&lt;br /&gt;
In XAML you can do something like:&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;brush:xml&quot;&gt;&amp;ltTextBlock Foreground=&quot;{StaticResource PhoneAccentBrush}&quot; /&gt;
&amp;ltBorder&gt;
  &amp;ltBorder.Background&gt;
    &amp;ltSolidColorBrush Color=&quot;{StaticResource PhoneAccentColor}&quot; /&gt;
  &amp;lt/Border.Background&gt;
&amp;lt/Border&gt;
&lt;/pre&gt;In C#:&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;brush:csharp&quot;&gt;Color AccentColor = (Color)Resources[&quot;PhoneAccentColor&quot;];
Brush AccentBrush = (Brush)Resources[&quot;PhoneAccentBrush&quot;];
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://developergoodies.blogspot.com/feeds/4600911356670713416/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://developergoodies.blogspot.com/2012/10/get-windows-phone-accent-color.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2955246950758454841/posts/default/4600911356670713416'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2955246950758454841/posts/default/4600911356670713416'/><link rel='alternate' type='text/html' href='http://developergoodies.blogspot.com/2012/10/get-windows-phone-accent-color.html' title='Get Windows Phone Accent Color'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2955246950758454841.post-7679814925278563565</id><published>2012-10-26T11:50:00.000+01:00</published><updated>2012-10-26T11:55:48.173+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Theme"/><category scheme="http://www.blogger.com/atom/ns#" term="Windows Phone"/><title type='text'>Detect Windows Phone Theme</title><content type='html'>Some times an application needs to know which theme is currently in use on the device so it can adjust it&#39;s UI.&lt;br /&gt;
&lt;br /&gt;
The PhoneLightThemeVisibility key indicates the visibility of the light theme.&lt;br /&gt;
The PhoneDarkThemeVisibility key indicates the visibility of the dark theme.&lt;br /&gt;
&lt;br /&gt;
In XAML you can do something like:&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;brush:xml&quot;&gt;&amp;ltTextBlock Visibility=&quot;{StaticResource PhoneLightThemeVisibility}&quot; /&gt;
&amp;ltTextBlock Visibility=&quot;{StaticResource PhoneDarkThemeVisibility}&quot; /&gt;
&lt;/pre&gt;You can use a converter to manipulate other properties that are not of type Visibility.&lt;br /&gt;
&lt;br /&gt;
In C#:&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;brush:csharp&quot;&gt;Visibility LightThemeVisibility = (Visibility)Resources[&quot;PhoneLightThemeVisibility&quot;];
Visibility DarkThemeVisibility = (Visibility)Resources[&quot;PhoneDarkThemeVisibility&quot;];
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://developergoodies.blogspot.com/feeds/7679814925278563565/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://developergoodies.blogspot.com/2012/10/detect-windows-phone-lightdark-theme.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2955246950758454841/posts/default/7679814925278563565'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2955246950758454841/posts/default/7679814925278563565'/><link rel='alternate' type='text/html' href='http://developergoodies.blogspot.com/2012/10/detect-windows-phone-lightdark-theme.html' title='Detect Windows Phone Theme'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2955246950758454841.post-2358883139250023545</id><published>2012-10-25T12:25:00.000+01:00</published><updated>2012-10-25T15:31:39.044+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Animation"/><category scheme="http://www.blogger.com/atom/ns#" term="Windows Phone"/><title type='text'>Windows Phone Flip Animation</title><content type='html'>You can use the Projection class to produce the flip animation of a control.&lt;br /&gt;
&lt;br /&gt;
The following XAML ilustrates this:&lt;br /&gt;
&lt;pre class=&quot;brush:xml&quot; name=&quot;code&quot;&gt;&amp;ltUserControl.Resources&gt;
    &amp;ltStoryboard x:FieldModifier=&quot;private&quot; x:Name=&quot;SBStartAnimation&quot;&gt;
        &amp;ltDoubleAnimation Storyboard.TargetName=&quot;SPPanel&quot; Storyboard.TargetProperty=&quot;(UIElement.Projection).(PlaneProjection.RotationX)&quot; From=&quot;-90&quot; To=&quot;0&quot; Duration=&quot;0:0:0.150&quot; /&gt;
    &amp;lt/Storyboard&gt;
&amp;lt/UserControl.Resources&gt;

&amp;ltBorder x:FieldModifier=&quot;private&quot; x:Name=&quot;BShade&quot; Background=&quot;#aa000000&quot;&gt;
    &amp;ltStackPanel x:FieldModifier=&quot;private&quot; x:Name=&quot;SPPanel&quot; VerticalAlignment=&quot;Top&quot; Background=&quot;#222222&quot;&gt;
        &amp;ltStackPanel.Projection&gt; 
            &amp;ltPlaneProjection CenterOfRotationY=&quot;0.5&quot; RotationX=&quot;0&quot; /&gt; 
         &amp;lt/StackPanel.Projection&gt; 
        &amp;ltImage Source=&quot;/Background.png&quot; HorizontalAlignment=&quot;Center&quot; Stretch=&quot;None&quot; /&gt;
        &amp;ltLC:ProgressLine x:FieldModifier=&quot;private&quot; x:Name=&quot;PLProgress&quot; Margin=&quot;0,-5,0,10&quot; /&gt; 
        &amp;ltTextBlock Text=&quot;Working, please wait...&quot; HorizontalAlignment=&quot;Center&quot; Margin=&quot;0,0,0,20&quot; /&gt; 
    &amp;lt/StackPanel&gt;
&amp;lt/Border&gt; 
&lt;/pre&gt;The SPPanel Stackpanel is flipped as defined in the SBStartAnimation Storyboard.</content><link rel='replies' type='application/atom+xml' href='http://developergoodies.blogspot.com/feeds/2358883139250023545/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://developergoodies.blogspot.com/2012/10/you-can-use-projection-class-to-produce.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2955246950758454841/posts/default/2358883139250023545'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2955246950758454841/posts/default/2358883139250023545'/><link rel='alternate' type='text/html' href='http://developergoodies.blogspot.com/2012/10/you-can-use-projection-class-to-produce.html' title='Windows Phone Flip Animation'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2955246950758454841.post-8392463947957412193</id><published>2012-10-25T12:09:00.001+01:00</published><updated>2012-10-25T15:35:00.726+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Animation"/><category scheme="http://www.blogger.com/atom/ns#" term="Windows Phone"/><title type='text'>Windows Phone Backgound Color Animation</title><content type='html'>In Silverlight for Windows Phone you can&#39;t animate a Brush so you can&#39;t animate the Background of a control.&lt;br /&gt;
&lt;br /&gt;
However, you can use the ColorAnimation class to animate the color of a Brush.&lt;br /&gt;
&lt;br /&gt;
The following XAML shows an example:&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;brush:xml&quot;&gt;&amp;ltUserControl.Resources&gt;
    &amp;ltStoryboard x:FieldModifier=&quot;private&quot; x:Name=&quot;SBStartAnimation&quot;&gt; 
        &amp;ltColorAnimation Storyboard.TargetName=&quot;BShade&quot; Storyboard.TargetProperty=&quot;(Border.Background).(SolidColorBrush.Color)&quot; From=&quot;#00000000&quot; To=&quot;#aa000000&quot; Duration=&quot;0:0:0.150&quot; /&gt; 
    &amp;lt/Storyboard&gt; 
&amp;lt/UserControl.Resources&gt;

&amp;ltBorder x:FieldModifier=&quot;private&quot; x:Name=&quot;BShade&quot; Background=&quot;#aa000000&quot; /&gt; 
&lt;/pre&gt;The BShade object must have it&#39;s Background property initialized.</content><link rel='replies' type='application/atom+xml' href='http://developergoodies.blogspot.com/feeds/8392463947957412193/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://developergoodies.blogspot.com/2012/10/windows-phone-backgound-color-animation.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2955246950758454841/posts/default/8392463947957412193'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2955246950758454841/posts/default/8392463947957412193'/><link rel='alternate' type='text/html' href='http://developergoodies.blogspot.com/2012/10/windows-phone-backgound-color-animation.html' title='Windows Phone Backgound Color Animation'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2955246950758454841.post-1820006643692479731</id><published>2012-10-25T11:51:00.000+01:00</published><updated>2012-10-25T17:18:23.377+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Animation"/><category scheme="http://www.blogger.com/atom/ns#" term="Windows Phone"/><title type='text'>Windows Phone Margin Animation</title><content type='html'>In Silverlight for Windows Phone the ThicknessAnimation class isn&#39;t available.&lt;br /&gt;
&lt;br /&gt;
You have two solutions:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Place a transparent object on the left/top and animate it&#39;s Width/Height properties;&lt;/li&gt;
&lt;li&gt;Place the object you want to animate in a Canvas and animate the object Left/Top properties. &lt;/li&gt;
&lt;/ul&gt;If you choose the second options, the XAML can look like this:&lt;br /&gt;
&lt;pre class=&quot;brush:xml&quot; name=&quot;code&quot;&gt;&amp;ltUserControl.Resources&gt;
    &amp;ltStoryboard x:FieldModifier=&quot;private&quot; x:Name=&quot;SBUndeterminedAnimation&quot;&gt;
        &amp;ltDoubleAnimation x:FieldModifier=&quot;private&quot; x:Name=&quot;DAUndeterminedAnimation&quot; AutoReverse=&quot;True&quot; RepeatBehavior=&quot;Forever&quot; Duration=&quot;0:0:2.000&quot; From=&quot;0&quot; Storyboard.TargetName=&quot;BProgress&quot; Storyboard.TargetProperty=&quot;(Canvas.Left)&quot; /&gt;
    &amp;lt/Storyboard&gt;
&amp;lt/UserControl.Resources&gt;

&amp;ltGrid&gt;
    &amp;ltCanvas x:FieldModifier=&quot;private&quot; x:Name=&quot;CTrack&quot; Background=&quot;#19ff0000&quot; Height=&quot;5&quot; HorizontalAlignment=&quot;Stretch&quot;&gt;
        &amp;ltBorder x:FieldModifier=&quot;private&quot; x:Name=&quot;BProgress&quot; Background=&quot;#ffff0000&quot; Height=&quot;5&quot; Width=&quot;50&quot; /&gt;
    &amp;lt/Canvas&gt;
&amp;lt/Grid&gt;
&lt;/pre&gt;This XAML is actually a custom ProgressBar that has both determined and undetermined behavior.&lt;br /&gt;
&lt;br /&gt;
The To property of the DAUndeterminedAnimation DoubleAnimation is set in code-behind.&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://developergoodies.blogspot.com/feeds/1820006643692479731/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://developergoodies.blogspot.com/2012/10/windows-phone-thicknessanimation.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2955246950758454841/posts/default/1820006643692479731'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2955246950758454841/posts/default/1820006643692479731'/><link rel='alternate' type='text/html' href='http://developergoodies.blogspot.com/2012/10/windows-phone-thicknessanimation.html' title='Windows Phone Margin Animation'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2955246950758454841.post-3955311544243532513</id><published>2012-10-21T22:18:00.001+01:00</published><updated>2012-10-21T23:41:36.509+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="Code Generation"/><category scheme="http://www.blogger.com/atom/ns#" term="Cross-Platform"/><category scheme="http://www.blogger.com/atom/ns#" term="Native"/><category scheme="http://www.blogger.com/atom/ns#" term="Windows Phone"/><title type='text'>Cross-Platform Native Code Generator</title><content type='html'>When creating an application for different platforms, you can create an HTML application that will fit every deployment or create a native application for each platform you want to traget.&lt;br /&gt;
&lt;br /&gt;
Creating an HTML application sure means less work, since the code (HTML+JavaScript+CSS) is fairly supported across web browsers.&lt;br /&gt;
&lt;br /&gt;
Of course, the User Interface (UI) will not match every system where the application will be deployed.&lt;br /&gt;
&lt;br /&gt;
Developing the application nativelly will allow the UI to be fully integrated with the OS.&lt;br /&gt;
&lt;br /&gt;
But a native application means a software project for each platform and this can be unmanageable.&lt;br /&gt;
&lt;br /&gt;
There are several solutions to this problem that minimize the coding of logic that is common to all of those software projects (business logic).&lt;br /&gt;
&lt;br /&gt;
One of them is AppDevPoint.&lt;br /&gt;
&lt;br /&gt;
This tool centralizes the business logic so that it&#39;s coded only once in one place.&lt;br /&gt;
&lt;br /&gt;
There must be native project for each platform since the UI is created natively this way being truly integrated with the OS.&lt;br /&gt;
&lt;br /&gt;
This methodology completely separates the UI from code. &lt;br /&gt;
&lt;br /&gt;
If the business logic has to be changed, simply code it in the AppDevPoint, regenerate the builds and all of your native projects will be updated in a single action.&lt;br /&gt;
&lt;br /&gt;
The binaries produced by the native compiler runs directly on the OS as this framework doesn&#39;t requires VMs or additional run-times to be installed.&lt;br /&gt;
&lt;br /&gt;
This tool is free and open-source.&lt;br /&gt;
&lt;br /&gt;
For more details, please visit:&lt;br /&gt;
&lt;a href=&quot;http://appdevpoint.webs.com/&quot;&gt;http://appdevpoint.webs.com&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://appdevpoint.codeplex.com/&quot;&gt;http://appdevpoint.codeplex.com/&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://developergoodies.blogspot.com/feeds/3955311544243532513/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://developergoodies.blogspot.com/2012/10/cross-platform-native-code-generator.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2955246950758454841/posts/default/3955311544243532513'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2955246950758454841/posts/default/3955311544243532513'/><link rel='alternate' type='text/html' href='http://developergoodies.blogspot.com/2012/10/cross-platform-native-code-generator.html' title='Cross-Platform Native Code Generator'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2955246950758454841.post-4741829960455488743</id><published>2012-10-20T17:05:00.000+01:00</published><updated>2012-10-21T22:33:31.309+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="State"/><category scheme="http://www.blogger.com/atom/ns#" term="Tombstone"/><category scheme="http://www.blogger.com/atom/ns#" term="Windows Phone"/><title type='text'> Windows Phone Stateful Framework</title><content type='html'>For an windows phone application to pass the Microsoft certification, it must implement the tombstone state.&lt;br /&gt;
&lt;br /&gt;
In concept this is easy to achieve, but in practice we must be careful.&lt;br /&gt;
&lt;br /&gt;
This framework wraps the OnNavigatedTo and OnNavigatedFrom events of the page, exposing a set of methods one can override.&lt;br /&gt;
&lt;br /&gt;
There are two types of methods: navigation methods and state manipulation methods.&lt;br /&gt;
&lt;br /&gt;
The navigation methods allows the page to react to navigation events for initialization, clean-up, etc.&lt;br /&gt;
&lt;br /&gt;
The state manipulation methods is where the code to persist and restore the state must be implemented.&lt;br /&gt;
&lt;br /&gt;
A special state manipulation method is available for restoring the global state of the application.&lt;br /&gt;
&lt;br /&gt;
The state can be immutable if it doesn’t change throughout the page life-cycle, or changeable if otherwise.&lt;br /&gt;
&lt;br /&gt;
A page can be marked as transient this way optimizing the state manipulation methods.&lt;br /&gt;
&lt;br /&gt;
For source code, please visit &lt;a href=&quot;http://wpstatefulframework.codeplex.com/&quot;&gt;http://wpstatefulframework.codeplex.com/&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://developergoodies.blogspot.com/feeds/4741829960455488743/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://developergoodies.blogspot.com/2012/10/windows-phone-stateful-framework.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2955246950758454841/posts/default/4741829960455488743'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2955246950758454841/posts/default/4741829960455488743'/><link rel='alternate' type='text/html' href='http://developergoodies.blogspot.com/2012/10/windows-phone-stateful-framework.html' title=' Windows Phone Stateful Framework'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>