0

@Override public void onClick(View v) {

    int i = v.getId();

    if (i==R.id.cars){

        Intent open_adapter_class = new Intent(this,ItemsAdapter.class);

        startActivity(open_adapter_class );

}

}

//this is the error I get

android.content.ActivityNotFoundException: Unable to find explicit activity class

{com.dikolobe.salesagent/com.dikolobe.salesagent.ItemsAdapter}; have you declared this activity in your

AndroidManifest.xml?

I know that am getting this error because adapter is not an activity so I just want to get help on how to

open this adapter class if there is a way to do so

Pman
  • 1
  • 1
  • What does "open this adapter class" mean? Usually, an adapter is for some small piece of UI, such as a row in a list. – CommonsWare Mar 07 '21 at 21:56

1 Answers1

0

From Android documentation:

An intent is an abstract description of an operation to be performed. It can be used with startActivity to launch an Activity, broadcastIntent to send it to any interested BroadcastReceiver components, and Context.startService(Intent)

So, ItemsAdapter has to be an activity, (eg ...extends AppCompatActivity) so you change from one activity to another.

But what you can do is pass an object from that class to another activity

Intent open_adapter_class = new Intent(this,ItemsAdapter.class);
javdromero
  • 1,850
  • 2
  • 11
  • 19