问题
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:
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);
}
}
来源:https://stackoverflow.com/questions/11815676/open-activity-from-overlayitem