question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Improve getting the current context

See original GitHub issue

Summary

Getting the current activity is not done quite correctly.

public static partial class Platform
{
    static Activity currentActivity;

    internal static Activity AppActivity
         => currentActivity
        ?? throw ExeptionHelper.ActivityNotDetected;
}

Permalink

Maybe we could replace this with a IActivityLifecycleCallbacks or the Android.App.Application.Context

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
dimonovddcommented, Jun 16, 2021
var page = Forms.Application.Current.MainPage;

@pictos @ahoefling Hi. Thanks. I would not like to add a dependency on Xamarin.Forms to the plugin I could use a Android.Content.Context but then I won’t be able to call StartActivityForResult method

I have one idea, I will try to do it soon. I’ll be happy if you watch it.

2reactions
SkyeHoeflingcommented, Jun 10, 2021

That won’t work because this does not take a dependency on Xamarin.Forms. I am going to try and submit a PR for you all to look at that might solve this problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

android - How to get the current context?
It just doesn't seem fine that the subactivity is aware of its creator, not to mention interact with it.
Read more >
Use Context Filters
To create a context filter, select Add to Context from the context menu of an existing categorical filter. The context is computed once...
Read more >
CONTEXT() - AppSheet Help
Returns contextual information about the running app based on the keyword option specified. Get started. Watch this video to get started using CONTEXT()...
Read more >
Understanding Current Context
The current context determines which buffer fields can be contextually referenced from PeopleCode, and which row of data is the current row on...
Read more >
Context in DAX Formulas
Context enables you to perform dynamic analysis, in which the results of a formula can change to reflect the current row or cell...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found