dotnet / dotnet/android

Why is Android.Runtime.JavaObject internal?

Open
#10,157 6 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
C#
Stars
2.1k
Forks
579
Avg merge
1d 21h
Merged PRs (30d)
257

Description

### Android framework version

net9.0-android

### Affected platform version

VS 2022

### Description

So I get an item from `AdapterView` using `GetItemAtPosition` and I get a `JavaObject` with an instance field in there that I need but I cannot access unless with Reflection as per some Stackoverflow posts on how to get the C# instance object out of a JavaObject. Why is this not available to us? Could someone make it available? :)

### Steps to Reproduce

1. Make new Android Project
2. Use `ListView`
3. Have an `ArrayAdapter` (for example)
4. Use a class that is not `Java.Lang.Object` for the items in `ArrayAdapter`.
5. Add an Item Click
6. Try using `AdapterView` to `GetItemAtPosition` and be surprised that you can only get a `Java.Lang.Object` without being able to access the instance.

### Did you find any workaround?

_No response_

### Relevant log output

```shell

```

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.