leonardo
leonardo

Reputation: 41

no activity to handle intent

so I'm trying to start another activity by using this:

public void onClick(View v) {
            // TODO Auto-generated method stub
            Intent openMap = new Intent("com.highapps.bicineta.MAPVIAS");
            startActivity(openMap);             
        }
    });

my android manifest looks like this:

<activity
        android:name=".MapVias"
        android:label="@string/app_name"
        android:exported="false" >
        <intent-filter>
            <action android:name="com.highapps.bicineta.MAPVIAS" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>

and im getting this error: "No activity to handle intent"

the funny thing is that i have the same code block to start another activity and it works just fine.. What am I doing wrong?

Upvotes: 0

Views: 178

Answers (4)

Dhrumil Shah - dhuma1981
Dhrumil Shah - dhuma1981

Reputation: 15809

Some quick checks

  1. Have you extended Activity/ActionBarActivity/FragmentActivity to MapVias activity?
  2. MapVias activity is in the default package which is mention in the AndroidManifest.xml? if not then specify absolute name when declaring it in the manifest.

Try to implement this way.

AndroidManifest.xml

<activity android:name="com.highapps.bicineta.MapVias"></activity>

OnClick()

    public void onClick(View v) {
            Intent openMap=new Intent(currentActivity.this,MapVias.class);
            startActivity(openMap);
        }
    });

Upvotes: 0

Ahmad
Ahmad

Reputation: 72673

Just do this:

Intent i = new Intent(CurrentActivity.this, MapVias.class);
startActivity(i);

Replace CurrentActivity with your current Activity(well, this is obvious :D )

Upvotes: 0

Rod Michael Coronel
Rod Michael Coronel

Reputation: 592

Try using

Intent openMap = new Intent("com.highapps.bicineta.MapVias");

since MapVias is the name of your Activity.

According the the Android developer site: "The name of the component that should handle the intent. This field is a ComponentName object — a combination of the fully qualified class name of the target component (for example "com.example.project.app.FreneticActivity") and the package name set in the manifest file of the application where the component resides (for example, "com.example.project")."

Upvotes: 0

Sebastian Breit
Sebastian Breit

Reputation: 6159

Intent myIntent = new Intent(CurrentActivity.this, NextActivity.class);
CurrentActivity.this.startActivity(myIntent);

Upvotes: 2

Related Questions