Help me in creating a extension?

i just confused in super container.

actually i am trying to make a new extension.
i just confused how to add this code

@Override  
    protected void onCreate(Bundle savedInstanceState) {  
        super.onCreate(savedInstanceState);  

into this code

public Palindrome(ComponentContainer container) {
        super(container.$form());
            this.container = container;
    }

please help me

Why do you need to do that? Component constructors are called in onCreate, but you don't get access to the bundle state. If you only are calling through to super, Form already does that.

i just only want to add both in java file . how can i do ??

You don't, that's why I said "you don't get access to the bundle state". Your component is not an activity, don't try treating as such.

1 Like

Hey can you help in removing this error

here is my code

package aryan.gupta.ad;  
 
import com.google.appinventor.components.annotations.*;
import com.google.appinventor.components.runtime.*;
import com.google.appinventor.components.common.*;

import com.google.appinventor.components.annotations.UsesLibraries;
import com.google.appinventor.components.annotations.UsesPermissions;
 
import android.support.v7.app.AppCompatActivity;  
import android.os.Bundle;  
  
import com.google.android.gms.ads.AdListener;  
import com.google.android.gms.ads.AdRequest;  
import com.google.android.gms.ads.InterstitialAd;  
  
@DesignerComponent(version = 1, // Update version here, You must do for each new release to upgrade your extension
description = " my first extension",
category = ComponentCategory.EXTENSION,
nonVisible = true,
iconName = "images/extension.png") // Change your extension's icon from here; can be a direct url
@SimpleObject(external = true)
@UsesPermission(permissionNames = "android.permission.INTERNET", "android.permission.ACCESS_NETWORK_STATE")
@UsesLibraries(libraries = "play-services-ads-15.0.0.jar")
public class InterstitialAd extends AndroidNonvisibleComponent {

    private String Unitid;
    private InterstitialAd mInterstitialAd;  
    private ComponentContainer container;

    public InterstitialAd(ComponentContainer container) {
        super(container.$form());
            this.container = container;
    }
    @Override  
    protected void onCreate(Bundle savedInstanceState) {  
        super.onCreate(savedInstanceState);   
       
  
  @SimpleFunction(description = "Enter Something to check the value is Palindrome ")
  public String Enter(String Value) {
  this.Unitid = Value;  
  
        // set the ad unit ID  
        mInterstitialAd.setAdUnitId(getString(this.Unitid));  
  }
        AdRequest adRequest = new AdRequest.Builder().build();  
  
        // Load ads into Interstitial Ads
        @SimpleFunction  
        public void Load() {
        mInterstitialAd.loadAd(adRequest);  
        
        mInterstitialAd.setAdListener(new AdListener() {  
            public void onAdLoaded() {  
                showInterstitial();  
            }  
        });  
    }  
    @SimpleFunction
    private void showInterstitial() {  
        if (mInterstitialAd.isLoaded()) {  
            mInterstitialAd.show();  
        }  
    }  
  
  
}

Please help me

here is the error log

AndroidRuntime:
    [mkdir] Created dir: C:\Users\dhana\appinventor-sources\appinventor\components\build\classes\AndroidRuntime
    [javac] Compiling 284 source files to C:\Users\dhana\appinventor-sources\appinventor\components\build\classes\AndroidRuntime
    [javac] warning: [options] bootstrap class path not set in conjunction with -source 1.7
    [javac] C:\Users\dhana\appinventor-sources\appinventor\components\src\aryan\gupta\ad\InterstitialAd.java:41: error: ';' expected
    [javac]   public String Enter(String Value) {
    [javac]                      ^
    [javac] C:\Users\dhana\appinventor-sources\appinventor\components\src\aryan\gupta\ad\InterstitialAd.java:41: error: ';' expected
    [javac]   public String Enter(String Value) {
    [javac]                                   ^
    [javac] C:\Users\dhana\appinventor-sources\appinventor\components\src\aryan\gupta\ad\InterstitialAd.java:51: error: ';' expected
    [javac]         public void Load() {
    [javac]                         ^
    [javac] C:\Users\dhana\appinventor-sources\appinventor\components\src\aryan\gupta\ad\InterstitialAd.java:61: error: ';' expected
    [javac]     private void showInterstitial() {
    [javac]                                  ^
    [javac] C:\Users\dhana\appinventor-sources\appinventor\components\src\aryan\gupta\ad\InterstitialAd.java:68: error: reached end of file while parsing
    [javac] }
    [javac]  ^
    [javac] 5 errors
    [javac] 1 warning

BUILD FAILED

please @ewpatton help me