如何从OverlayItem打开一个Activity: 这是我现在的代码:
@Override
protected boolean onBalloonTap(int index) {
if (index == 0) {
c.startActivity(new Intent (c.getApplicationContext(),
QuoteDetail.class));
此代码适用于打开新的Activity,但我想将此代码添加到上面的代码中:
public void onClick(View view) {
Intent i = new Intent(Test.this, QuoteDetail.class);
i.putExtra("position", 1);
startActivity(i);
我该怎么做?抱歉这个愚蠢的问题,我是初学者
答案 0 :(得分: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);
}
}