Creating an Android Activity with no UI

How do you create an Activity based applications with no UI?

The answer is that you need to set the activity theme in the manifest, for RosieUtility I use:

android:theme="@android:style/Theme.Translucent.NoTitleBar"

Like this in AndroidManifest.xml:

<activity android:name=".MainActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

If you just want to kick off something quick, you’ll also want to call “finish();” after firing the intent in onCreate of Activity

The latest set of activity themes are defined in /res/values/themes.xml in the Android source here.

Note I’m not using the theme ‘NoDisplay’ as I do actually show notifications on the screen as the Activity is going about its business.

Source

How To Use SandCastle To Generate Help Files From Code

1) Generate XML Documentation For SandCastle To consume

To generate an XML documentation file for a Visual C# project

  1. With a project selected in Solution Explorer, on the Project menu, click Properties.
  2. Click the Build tab.
  3. On the Build page, select XML documentation file. By default, the file is created under the specified output path, for example, “bin\Debug\Projectname.XML”.

http://msdn.microsoft.com/en-us/library/x4sa0ak0.aspx

2) Download and install SandCastle – http://sandcastle.codeplex.com/

3) Download and install SandCastle Help File Builder: http://www.codeplex.com/wikipage?ProjectName=SHFB

4) Load up SandCastle and create a new project choosing the .sln for your application. Click Documentation menuitem then Build.

More good info here:  http://grantpalin.com/2010/01/10/net-projects-generating-documentation-with-sandcastle/

More Verbose Application_Error() handling in global.asx

Extracting exception specifics like line number, class, method, etc:

   /// <summary>
        /// Handles the Error event of the Application control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Application_Error(object sender, EventArgs e)
        {     
            try
            {  
                Logging logging = new Logging();

                Exception ex = Server.GetLastError().GetBaseException();

                StackTrace trace = new StackTrace(ex, true);                

                string sourceFile = trace.GetFrame(0).GetFileName();
                int sourceLine = trace.GetFrame(0).GetFileLineNumber();
                string sourceMethod = trace.GetFrame(0).GetMethod().Name;            
                string sourceClass = trace.GetFrame(0).GetMethod().DeclaringType.ToString();
                string sourceMessage = ex.Message.ToString();
                string sourceThreadID = AppDomain.GetCurrentThreadId().ToString();

                string currentUser = (SessionWrapper.CurrentLoggedInUser != null) ? SessionWrapper.CurrentLoggedInUser.UserId : "";

                logging.insertLog(sourceClass, DateTime.Now,
                    trace.ToString(), currentUser, "FATAL",
                    sourceLine.ToString(), sourceMessage, sourceMethod, sourceThreadID, 0, 0, currentUser, "EHAP");

            }
            catch (Exception)
            {
                // If logging to database fails, log to file system
                log.Fatal("EHAP Site Application_Error", Server.GetLastError());

            }
          

            Response.Redirect("/SiteException.aspx", false);
            System.Web.HttpContext.Current.ApplicationInstance.CompleteRequest();
            Server.ClearError();

        }