4

I am having an issue with something and I don't really know where to look or how to search for this, so I am asking here. Basically, I am starting a new activity from my main activity using this bit of code:

Intent intent = new Intent(v.getContext(), AlarmViewer.class);
startActivity(intent);

And start my AlarmViewer class with a normal onCreate, that looks like this:

public void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.main);
}

So, I am trying trying to figure out how to access the intent I used to start the activity to get some extras that I put on it. Anyone have any idea how I can do that? If this has been asked before I'm sorry, wasn't really sure how to search for this.

serv-inc
  • 35,772
  • 9
  • 166
  • 188
WWaldo
  • 167
  • 3
  • 14

1 Answers1

7

To get the intent, use getIntent().

To get your information, you use getIntent().getExtras() which returns an object of type Bundle. From that object, you can call the different get* methods depending on the type you have passed it from the calling activity

You can have a look at this thread for an example

Community
  • 1
  • 1
ccheneson
  • 49,072
  • 8
  • 63
  • 68