0

Sorry if this question is a duplicate. i searched the web but didn't get anywhere. And i don't know how to ask this question. Here's the Question.

public class CrimeActivity extends SingleFragmentActivity {
public static final String EXTRA_CRIME_ID =
        "com.bignerdranch.android.criminalintent.crime_id";
public static Intent newIntent(Context packageContext, UUID crimeId) {
    Intent intent = new Intent(packageContext, CrimeActivity.class);
    intent.putExtra(EXTRA_CRIME_ID, crimeId);
    return intent;
}

@Override
protected Fragment createFragment() {
    return new CrimeFragment();
}

In this code when intent is initialized the 2nd argument is CrimeActivity.class . What is CrimeActivity.class, how is it used.? Can someone please help. Any help would be appreciated. Thanx.

  • 1
    You searched and didn't find it? Know Android documentation? https://developer.android.com/reference/android/content/Intent.html#Intent(android.content.Context,%20java.lang.Class%3C?%3E) – Rohit5k2 Jun 21 '16 at 21:05
  • 2
    On SO here it is http://stackoverflow.com/questions/6578051/what-is-intent-in-android – Rohit5k2 Jun 21 '16 at 21:07

1 Answers1

1

When using intents, the second parameter, which is in your case, the CrimeActivity.class, should be the java activity class that will be fired up when you call startActivity(intent);

Let's just say you're running your application. By default, the first activity to be fired up is the MainActivity.class. Somewhere within that class, if you'll declare that intent and call startActivity(intent), then it will fire up another page.

fmpsagara
  • 485
  • 5
  • 17