Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8107259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:42:28+00:00 2026-06-06T00:42:28+00:00

public class WeeklyInspection : Activity { WebView view = (WebView) FindViewById(Resource.Id.inspectionWV); view.Settings.JavaScriptEnabled = true;

  • 0
public class WeeklyInspection : Activity
{
  WebView view = (WebView) FindViewById(Resource.Id.inspectionWV);
  view.Settings.JavaScriptEnabled = true;
  view.Settings.CacheMode = CacheModes.CacheElseNetwork;
  view.SetWebChromeClient(new CustomWebChromeClient(this));
  view.SetWebViewClient(new CustomWebViewClient(this));
  view.LoadUrl("http://myurl.com");
}

private class CustomWebChromeClient: WebChromeClient
{
   public override void OnConsoleMessage(string message, int lineNumber, string sourceID)
    {
       if (message.StartsWith("Submit")
          //do all my submit stuff here
          //if without error, I want to go back to the Main Activity.  Have tried:
          Intent intent = new Intent(BaseContext, typeof(Main));
          StartActivity(intent); //Both BaseContext and StartActivity throw "Cannot access non-static method in static context"
          //tried:
          Finish(); //Same thing
          //tried:
          OnBackPressed(); //Same thing
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T00:42:31+00:00Added an answer on June 6, 2026 at 12:42 am

    As the compiler error message you encountered states, StartActivity is an instance method of Context, not a static method, and therefore cannot be called like that.

    You didn’t include it in the code sample, but in the activity you pass “this” (the activity) into the constructor to CustomWebChromeClient, so I’m assuming CustomWebChromeClient is keeping a reference to it. You can use that reference to call the instance methods you need on the activity, whether it be StartActivity, Finish, or whatever else you need. For example:

    private class CustomWebChromeClient: WebChromeClient
    {
        private readonly Activity _context;
    
        public CustomWebChromeClient(Activity context) 
        {
            _context = context;
        }
    
        public override void OnConsoleMessage(string message, int lineNumber, string sourceID)
        {
            if (message.StartsWith("Submit"))
            {
                _context.Finish();
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

public class Browser1Activity extends Activity { TextView url; WebView ourBrow; @Override protected void onCreate(Bundle
public class HomeActivity extends Activity{ // public ArrayList<User> users1 = new ArrayList<User>(); @Override public
public class Boards : TabActivity { protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Tab);
public class GenericDao <T, PK extends Serializable> { private final Class<T> type; @Resource(name =
public class upload extends Activity { private static final int CAMERA_REQUEST = 1888; private
public class master extends Activity { ProgressDialog progressDialog; EditText tahmini_kelime; EditText girilen_sayi ; EditText
public class SaveData extends Activity implements OnClickListener { private DataManipulator dh; static final int
public class MCQSample extends Activity implements OnClickListener{ TextView title; String gotBread; RadioGroup AnswerRG; int
public class Offer_Popup extends Activity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.offer_popup); //newly
public class AllViewModel { private List<Settings> SettingsList; public ViewAgendaAllViewModel() { client.SupplierListWithSettings(GetSupplierListWithSettings_Completed) } public void

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.