Thursday, November 18, 2010

Threads in Android - ProgressDialog showing up all late

If you need to display a progress bar and its not showing up and your code done executing, then you need to learn threads. You have to execute your long running code in a sperate thread (downloading data, saving user perferences, i.e., any long running process). However, you cannot update the UI in your new thread. You will have to create a 'Handler' and post messages from your new thread. The handler will hand the message off to the UI/calling thread. I learned all of this from here: simple progress bar dialog in android with thread

Tuesday, October 12, 2010

Android emulator reports unknown virtual device name

Android emulator reports unknown virtual device


Are you getting the following error:
emulator: ERROR: unknown virtual device name: 'Android21Device'
emulator: could not find virtual device named 'Android21Device'
----------

Well the emulator is C app and the android tool is a Java app so they
have slightly different ways to get your user profile directly.

Out of curiosity, if you do a "set" under a command-prompt, what is
your USERPROFILE variable?

Your best solution is to define a global environement variable ANDROID_SDK_HOME.

To do that: Start > Control Panel > System > Advanced System Settings

> Environment Variables. Create a new user one called

"ANDROID_SDK_HOME" and set it to the path where you want .android to
be created, e.g. maybe "d:\"

-----
Sources:
Google Groups
Stack Overflow

Saturday, July 31, 2010

Receiving 'Validation of viewstate MAC failed' for sites migrated form .NET 1.1 to 3.5 IIS7

The below saved me a lot of time!!

-----------------------------------

Validation of viewstate MAC failed after installing .NET 3.5 SP1
Tess Ferrandez 14 Apr 2009 8:04 AM
Comments 42
After installing .NET 3.5 SP1 you may get Validation of viewstate MAC failed exceptions when doing post backs on ASP.NET pages

Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.
Stack Trace:


[HttpException (0x80004005): Unable to validate data.]
System.Web.Configuration.MachineKeySection.GetDecodedData(Byte[] buf, Byte[] modifier, Int32 start, Int32 length, Int32& dataLength) +289
System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +140

[ViewStateException: Invalid viewstate.
Client IP: 127.0.0.1
Port: 34562
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.2; WOW64; .NET CLR 2.0.50727; .NET CLR 1.1.4322; InfoPath.2; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.590; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; Zune 3.0; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; MS-RTC LM 8)
ViewState: /wEPDwUKMTc2NzE0NzA0NmRkmWc0SFS8H55FfURfpUekG2KhS8g=
Referer: http://localhost/MySite/Default3.aspx
Path: /MySite/Default.aspx]

[HttpException (0x80004005): Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.]
System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String errorPageMessage, Boolean macValidationError) +106
System.Web.UI.ViewStateException.ThrowMacValidationError(Exception inner, String persistedState) +14
System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +242
System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Deserialize(String serializedState) +4
System.Web.UI.Util.DeserializeWithAssert(IStateFormatter formatter, String serializedState) +37
System.Web.UI.HiddenFieldPageStatePersister.Load() +207
System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +105
System.Web.UI.Page.LoadAllState() +43
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6785
System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +242
System.Web.UI.Page.ProcessRequest() +80
System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +21
System.Web.UI.Page.ProcessRequest(HttpContext context) +49
ASP.default_aspx.ProcessRequest(HttpContext context) +4
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75


Cause:

This will happen if you have specified an action on the forms element, and if the action is different than the page you are browsing to, i.e. in this case the page I am browsing to is Default3.aspx, but the action is set to Default.aspx (as you can see from the Path and Referer in the error message)

'
'



The reason this occurs after installing SP1 for .NET 3.5 is because prior to this service pack, the action attribute was ignored. Now that it is no longer ignored, the post-back will actually post back to the action page, and of course the view state for Default3.aspx will not be valid for Default.aspx.

You’ve heard it before:) this is not a bug, it’s a feature… in this case that’s actually true…



Resolution:

Remove the action attribute in the HTML or generated HTML from the ASPX page, or change it to post to the right page if you want to have viewstate enabled.


Source: http://blogs.msdn.com/b/tess/archive/2009/04/14/validation-of-viewstate-mac-failed-after-installing-net-3-5-sp1.aspx

Tuesday, May 4, 2010

Stock Price Alerts - Applicaiton for Android

Are you the type of person who watch the stock market closely? Then get Stock Price Alerts for Android. Its an awsome app that alerts you when a stock moves up or down.

Tuesday, April 20, 2010

Android Stock Alerting Application - Update Released

A new update has been released for Stock Price Alerts (app for the Android Market). The application now supports news headlines. The latest news headlines can be access from any stock in your stock list. Just "long press" any stock and the "More Actions" menu will appear. Then tap "Get latest news headlines"!

Thursday, April 1, 2010

Code Sign error: Provisioning Profile cannot be found

If you get this crappy message from XCode because you updated your provisioning profile, then do the following.

In XCode, in the "Groups & Files" pane, expand "Targets" and double-click on your app's target.

This will bring up the Info pane for your target. In the "Build" section, check the "code signing" section for any old profiles. I found that it was building to an old profile there.

Source: http://www.iphonedevsdk.com/forum/iphone-sdk-development/21137-updated-3-0-now-provisioning-profile-cant-found.html

Friday, March 19, 2010

Android Stock Alerting Application

AlienHive Labs just released its first application - Stock Price Alerts.

What is Stick Price Alerts?
Stock Price Alerts is a simple and easy to use application that notifies you when a stock has hit it's configured low or high price. How you ask? After you setup your stock list (ticker, low/high prices, and enable notifications) you can enable the alerting system to automatically update your stock list. The alerting system will run in the background pulling data from the Internet. A notification will be sent once a stock has hits its low or high price.

More information: http://sites.google.com/site/alienhivelabs/

Tuesday, March 2, 2010

Android Indicates whether the specified service is already started

/**
* Indicates whether the specified service is already started.
* This method queries the activity manager for launched services that
* can respond to an binding with an specific service name.
* If no existed service is found, this method returns null.
*
* @param context The context of the activity
* @param className The service full name to check for availability.
*
* @return ComponentName if the service is already existed, NULL otherwise.
*/
public static ComponentName isServiceExisted(Context context, String className)
{
ActivityManager activityManager = (ActivityManager)context.getSystemService(ACTIVITY_SERVICE);
List serviceList =activityManager.getRunningServices(Integer.MAX_VALUE);

if(!(serviceList.size() > 0))
{
return null;
}

for(int i = 0; i < serviceList.size(); i++)
{
RunningServiceInfo serviceInfo = serviceList.get(i);
ComponentName serviceName = serviceInfo.service;

if(serviceName.getClassName().equals(className))
{
return serviceName;
}
}

return null;
}

Tuesday, February 16, 2010

Android Notification Crashes App

If you want to have a notification vibrate then you must add a permission in the manifest file.