Open Activity from OverlayItem

2019-07-28 03:03发布

How can I open an Activity from a OverlayItem: Here is my code now:

@Override
protected boolean onBalloonTap(int index) {

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

This code works well to open a new Activity but I want to add this code to the code above:

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

How can I do this. Sorry for that stupid question, I´m a beginner

1条回答
【Aperson】
2楼-- · 2019-07-28 03:24
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); 
                  }
        }
查看更多
登录 后发表回答