4

I followed the Xamarin tutorial to open another activity but I receive an error message saying: the type or namespace name"Intent" could not be found(are you missing a using directive or an assembly reference?) enter image description here

May I know if there is anything missing or wrong in my code? Thank you

2 Answers 2

7

Make sure you have referenced using Android.Content; on top of your activity

3
  • Thank you, you are right. I just tried adding the referenced and the error has been removed!
    – cg1991
    Commented May 9, 2017 at 4:23
  • @cg1991 good that now is sorted, can you mark this as the accepted answer if it helped you?
    – iamIcarus
    Commented May 9, 2017 at 10:48
  • What do you need if using Xamarin Forms? Which NuGet package should you download and which namespace should you be using?
    – s3c
    Commented Jan 7, 2020 at 15:31
-1

You Need code something like this ...

 home.setOnClickListener(new View.OnClickListener() {   //here home is a button 
        @Override
        public void onClick(View v) {
            Intent intent=new Intent(LoginOption.this,HomeActivity.class);
            startActivity(intent);
        }
    });

You Must need two activity first where your butoon exist, to open another activity Intent intent=new Intent(LoginOption.this,HomeActivity.class); here first activity is loginoption activity where my button is exist and another home activity which will be open after clicking event.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.