Skip to content Skip to sidebar Skip to footer

The Type Getintent() Is Undefined For Adapter

I am getting a byteArray from another activity via Intent like this: if (view == null) { view = new ImageView(mContext); } Bundle extras = getIntent().getEx

Solution 1:

Pass your Activity context to the Adapter constructor

there you can access your intent like this

((Activity)mContext).getIntent()

Solution 2:

getIntent() is used to get the Intent used to start an Activity. Since you aren't in an Activity then there is no Intent to "get" and getIntent(), as it says, is not a function of the Adapter class.

Use that code in the Activity that calls the Adapter class and pass the data needed to that class

Solution 3:

Here we go:

Intentintent= ((Activity) context).getIntent();
 intvalue= intent.getIntExtra("myvalue", 0);

Post a Comment for "The Type Getintent() Is Undefined For Adapter"