'Is it possible to implement a view using native code in android?
I'm trying to make an app which has a view that uses a lot of native modules, and it would be better if I organized my code so that the code for that view is all native. I know you can build native activities but I don't need to do that. Just implementing this one view in native code (so that its code lives inside a shared library) will be enough. Are there any resources/code examples that demonstrate what I want?
Solution 1:[1]
To create a view, all you need to do is derive a class from View, and implement the 2 main constructors- MyView(Context), MyView(Context, AttributeSet), and MyView(Context, AttributeSet, int). If you want to control how it draws, override onDraw(Canvas). Beyond that it depends on what you want to do in it.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Gabe Sechan |
