title: How to call widget on the Activity (Widget calling from Activity)
body: <p>I am new to android widget.I did sample application , that want to show time .How to call widget from activity: </p>
  
  <p>I tried like this but It say <strong>Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.weather/com.weather.CurrentCity}; have you declared this activity in your AndroidManifest.xml?</strong></p>
  
  <pre><code>   &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.weather"
    android:versionCode="1"
    android:versionName="1.0"&gt;
  &lt;uses-sdk android:minSdkVersion="8" /&gt;
  
  &lt;application android:icon="@drawable/icon" android:label="Weather"&gt;
      &lt;!-- Broadcast Receiver that will process AppWidget updates --&gt;
      &lt;receiver android:name=".CurrentCity" 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;activity android:name=".WeatherActivity"
                android:label="Weather Application"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.MAIN" /&gt;
              &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
          &lt;/intent-filter&gt;
      &lt;/activity&gt;
  
  &lt;/application&gt;
  
  &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
  </code></pre>
  
  <p></p>
  
  <p>and my initail activity :</p>
  
  <pre><code> public class WeatherActivity extends Activity {
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
  
      Intent showContent = new Intent(getApplicationContext(),CurrentCity.class);
      startActivity(showContent);
  }
  </code></pre>
  
  <p>and my widget activity:</p>
  
  <pre><code>  public class CurrentCity extends AppWidgetProvider {
  
  public void onUpdate(Context context, AppWidgetManager appWidgetManager,
          int[] appWidgetIds) {
      Timer timer = new Timer();
      timer.scheduleAtFixedRate(new MyTime(context, appWidgetManager), 1,
              1000);
  
  }
  
  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.current_weather);
          thisWidget = new ComponentName(context, CurrentCity.class);
      }
  
      @Override
      public void run() {
          remoteViews.setTextViewText(R.id.country,"Time = " + format.format(new Date()));
          appWidgetManager.updateAppWidget(thisWidget, remoteViews);
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>and I have created main.xml &amp; current_weather.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" &gt;
  
  &lt;TextView android:id="@+id/country" 
            android:text="TextView" 
            android:layout_height="wrap_content" 
            android:layout_width="wrap_content" 
            android:layout_margin="10dp"
            android:textColor="@color/solid_yellow"
      &gt;&lt;/TextView&gt;
  
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>and I created hello_widget_provider.xml.xml in the 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="146dip"
  android:minHeight="72dip"
  android:updatePeriodMillis="10000"
  android:initialLayout="@layout/main"
    /&gt;
  </code></pre>
  
  <p>Please help me</p>
  
  <p>Thanks in advance</p>