Continue to receive these error messages & ldquo; The onCreate (Bundle) method is not defined for the AppWidgetProvider & ldquo;

advertisements

The method onCreate(Bundle) is undefined for the type AppWidgetProvider

public class SupermarioActivity<imageButton1> extends AppWidgetProvider {
public static SupermarioActivity Widget = null;
public static Context context;
public static AppWidgetManager appWidgetManager;
public static int appWidgetIds[];   

@Override
public void onUpdate( Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds )    {
    if (null == context) context = SupermarioActivity.context;
    if (null == appWidgetManager) appWidgetManager = SupermarioActivity.appWidgetManager;
    if (null == appWidgetIds) appWidgetIds = SupermarioActivity.appWidgetIds;

    SupermarioActivity.Widget = this;
    SupermarioActivity.context = context;
    SupermarioActivity.appWidgetManager = appWidgetManager;
    SupermarioActivity.appWidgetIds = appWidgetIds;

    Log.i("PXR", "onUpdate");

    }

static void updateAppWidget(Context context, AppWidgetManager appWidgetManager,
        int appWidgetId) {

    RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.main);
    remoteViews.setImageViewResource(R.id.imageButton1, appWidgetId);

    // Tell the widget manager
    appWidgetManager.updateAppWidget(appWidgetId, remoteViews);
}

  public void onCreate(Bundle savedInstanceState)
  {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);    

    imageButton1 imagebutton1 = (imageButton1) findViewById(R.id.imageButton1);

    imageButton1.setOnClickListener(new OnClickListener()
    {
      public void onClick(View v)
      {
         ImageView iv = (ImageView) findViewById(R.id.imageview1);
         iv.setVisibility(View.VISIBLE);
      }
    });
}

    private void setContentView(int main) {
    // TODO Auto-generated method stub

}
    private imageButton1 findViewById(int imagebutton1) {
    // TODO Auto-generated method stub
    return null;
}

}


You defined an onCreate(Bundle) method for SupermarioActivity<imageButton1> that looks like it belongs in an Activity subclass. But SupermarioActivity extends AppWidgetProvider, not Activity (or any Activity subclass).