title: Who (and how) create an instance of AppWidgetProvider?
body: <p>upd2. The problem has gone after a sort of black magic routine (uninstall, clean Eclipse project, reboot Android device, rebuild, install, run). It is not solved, it has gone. Could anyone please explain what has happened?</p>
  
  <p>upd. Seems, no Java code running at all in my Android widget project modeled after Hello Widget tutorial (ref. comments). Is there any way to run some code to make my widget useful? I believe it is possible because there are a lot of do-something widgets. How they make it?</p>
  
  <p>I modeled a simple Android widget after Hello Widget tutorial: <a href="http://nm-blog.sanid.com/2009/07/android-hellowidget-tutorial/" rel="nofollow">http://nm-blog.sanid.com/2009/07/android-hellowidget-tutorial/</a></p>
  
  <p>Running it I can see that it's not working at all - the text view is not altered.</p>
  
  <p>Here's some code:</p>
  
  <p>Manifest:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.pell.hellowidget"
      android:versionCode="1"
      android:versionName="1.0" &gt;
      &lt;uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" /&gt;
      &lt;application
          android:allowBackup="true"
          android:icon="@drawable/ic_launcher"
          android:label="@string/app_name"
          android:theme="@style/AppTheme" &gt;        
          &lt;receiver android:name="HelloWidgetProvider" android:label="@string/app_name"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.appwidget.action.APPWIDGET_UPDATE" /&gt;
              &lt;/intent-filter&gt;
              &lt;meta-data android:name="android.appwidget.provider"
                  android:resource="@xml/hello_widget_provider" /&gt;
          &lt;/receiver&gt;                
      &lt;/application&gt;
  &lt;/manifest&gt;
  </code></pre>
  
  <p>res/xml/hello_widget_provider.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
    android:minWidth="280dp"
    android:minHeight="180dp"
    android:updatePeriodMillis="10000"
    android:initialLayout="@layout/hello_widget_layout"
    android:resizeMode="vertical" /&gt;
  </code></pre>
  
  <p>res/layout/hello_widget_layout.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:gravity="center_vertical|center_horizontal"
      android:orientation="vertical" &gt;
      &lt;TextView
          android:id="@+id/textView1"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="Large Text"
          android:textAppearance="?android:attr/textAppearanceLarge" /&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>src/com/pell/hellowidget/HelloWidgetProvider.java:</p>
  
  <pre><code>package com.pell.hellowidget;
  
  import java.text.DateFormat;
  import java.text.SimpleDateFormat;
  import java.util.Date;
  import java.util.Locale;
  import java.util.Timer;
  import java.util.TimerTask;
  
  import android.appwidget.AppWidgetManager;
  import android.appwidget.AppWidgetProvider;
  import android.content.ComponentName;
  import android.content.Context;
  import android.widget.RemoteViews;
  
  public class HelloWidgetProvider extends AppWidgetProvider {
      @Override
      public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
          Timer timer = new Timer();
          timer.scheduleAtFixedRate(new MyTime(context, appWidgetManager), 1,
                  1000);
  
          super.onUpdate(context, appWidgetManager, appWidgetIds);
      }
  
      private Date currentTime;
  
      private class MyTime extends TimerTask {
          RemoteViews remoteViews;
          AppWidgetManager appWidgetManager;
          ComponentName thisWidget;
          DateFormat format = SimpleDateFormat.getTimeInstance(
                  SimpleDateFormat.MEDIUM, Locale.getDefault());
  
          public MyTime(Context context, AppWidgetManager appWidgetManager) {
              this.appWidgetManager = appWidgetManager;
              remoteViews = new RemoteViews(context.getPackageName(),
                      R.layout.hello_widget_layout);
              thisWidget = new ComponentName(context, HelloWidgetProvider.class);
          }
  
          @Override
          public void run() {
              currentTime = new Date();
              remoteViews.setTextViewText(R.id.textView1,
                      format.format(currentTime));
              appWidgetManager.updateAppWidget(thisWidget, remoteViews);
          }
      }
  }
  </code></pre>
  
  <p>As far as I understand it is not working due to nobody instantiates com.pell.hellowidget.HelloWidgetProvider object. What is Java/Android Widget/etc analog for the entry point (int main(int argc, char * argv[]), WinMain, etc)? Who (and how) instantiates AppWidgetProvider object?</p>