tags:

views:

60

answers:

2

I have a class that extends ItemizedOverlay.

In it, I have:

@Override
protected boolean onTap(int index) {
  OverlayItem item = mOverlays.get(index);
  /*// working below code, just replace */
    AlertDialog.Builder dialog = new
  AlertDialog.Builder(mContext);
  dialog.setTitle(item.getTitle());
  dialog.setMessage(item.getSnippet());
  dialog.setPositiveButton("Details",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {


 }
  });

When I click the "Details" button, I want to start an Activity or setContentView, but those methods do not exist.

Any ideas?

Thanks

A: 

I'm new to Android but I think you should create Intent to start a new activity (and pass it to Context.startActivity()) .

kuba
That worked... I did not pass it to the context. my bad..
motti10
A: 

You have to create an intent.

Intent i = new Intent(this /*context*/, ExampleActivityClass.class /*Your new Activity Class*/);
i.setAction("android.intent.action.VIEW");
startActivity(i);

and you should add an intent-filter to your android manifest:

<activity android:name=".ExampleActivityClass">
    <intent-filter>
        <action android:name="android.intent.action.VIEW />
    </intent-filter>    
</activity>

For further information see and read this

Esentian

Esentian
Esentian, That makes sense, but the class does not extend Activity, but ItemizedOverlay.
motti10