1

如何从 OverlayItem 打开 Activity:这是我的代码:

@Override
protected boolean onBalloonTap(int index) {

    if (index == 0) {
        c.startActivity(new Intent (c.getApplicationContext(),
                QuoteDetail.class));

此代码可以很好地打开一个新活动,但我想将此代码添加到上面的代码中:

public void onClick(View view) {
                 Intent i = new Intent(Test.this, QuoteDetail.class);
                 i.putExtra("position", 1);
                 startActivity(i);

我怎样才能做到这一点。对不起这个愚蠢的问题,我是初学者

4

1 回答 1

1
private Context c;    
@Override
    protected boolean onBalloonTap(int index) {

        if (index == 0) { 
    Intent intent = new Intent(c, QuoteDetail.class);
                    intent.putExtra("position", 1);
                    c.startActivity(intent); 
                  }
        }
于 2012-08-05T11:03:06.707 回答