masesgroup / netdroid

Android suite for .NET
https://netdroid.masesgroup.com/
Apache License 2.0
2 stars 1 forks source link

Some classes need to be extended in some cases, however currently it is not possible #75

Open masesdevelopers opened 1 month ago

masesdevelopers commented 1 month ago

The following code https://github.com/masesgroup/netdroid/blob/84d980756a94c0350b6bbb787d530be6d98d27bf/src/net/Netdroid/Generated/Android/App/Activity.cs#L1516 must be like a callback and cannot be managed like an invocable method. A classic snippet is like:

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState, PersistableBundle pers) {
        super.onCreate(savedInstanceState, pers);
        setContentView(R.layout.activity_main);
    }
}

The previous overrides onCreate and executes some extra code. So, from the point of view of .NET code in Netdroid, the 'OnCreate' shall be managed like an event of a listener. In this way the .NET code can react and execute the needed code like https://github.com/masesgroup/netdroid/blob/84d980756a94c0350b6bbb787d530be6d98d27bf/src/net/Netdroid/Generated/Android/App/Activity.cs#L1957 that shall be an invocable method.

masesdevelopers commented 1 month ago

From the point of view of .NET code in Netdroid, the 'OnCreate' shall be managed like an event of a listener. In this way the .NET code can react and execute the needed code like

https://github.com/masesgroup/netdroid/blob/84d980756a94c0350b6bbb787d530be6d98d27bf/src/net/Netdroid/Generated/Android/App/Activity.cs#L1957 that shall be an invocable method.

There are two possible alternatives to create some classes that needs the behavior requested:

masesdevelopers commented 18 hours ago

To use latest version of JNetReflector (see #82) a new class from JNet shall be introduced, so it is important to close #76