godotengine / godotengine/godot-docs

Need to document `onMainCreateView()` Android functionality

Open
#3,190 0 comments 0 reactions 0 assignees View on GitHub
area:manual enhancement
Dominant language
reStructuredText
Stars
5.7k
Forks
3.8k
Avg merge
1d 20h
Merged PRs (30d)
25

Description

Last year, before the release of 3.2, `onMainCreateView()` was added as a replacement for the (now removed) ability to directly access the `layout`.

This has caused issues for at least a couple of plugins which no longer work(ed):

*
*

It would be good to add documentation on how to use this functionality to (presumably?) "[Creating Android plugins](https://docs.godotengine.org/en/3.2/tutorials/plugins/android/android_plugin.html)".

There is some existing text in the source code describing how it works:

* https://github.com/godotengine/godot/pull/32858/files#diff-8d2a37e7e59fd7220a4307f924760edcR194

```
Invoked once during the Godot Android initialization process after creation of the
{@link GodotView} view.

This method should be overridden by descendants of this class that would like to add
their view/layout to the Godot view hierarchy.

@return the view to be included; null if no views should be included.
```

([see also](https://github.com/godotengine/godot/blob/245ecb6684d089940273564fb7a314e5e11ea72e/platform/android/java/lib/src/org/godotengine/godot/Godot.java#L193-L205))

And this is how the first project patched their code:

* https://github.com/Shin-NiL/Godot-Android-Admob-Plugin/commit/9bface03e9b5c578a49b7cca7d751f5bb8056cd5

Here is the issue where the original discussion took place:

* https://github.com/godotengine/godot/issues/32827

*Edit:* Added link to source.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.