UPGRAYEDD
UPGRAYEDD

Reputation: 435

Can you start an activity as an instance of itself?

I have a splash screen that creates a new main Activity. during the Splash screen onCreate method, I am creating a variable as a new Main Activity and a variable as a new instance of my location services.

 mMainActivity = new MainActivity();
 mLocationServices = new GooglePlayLocationServicesBC(mMainActivity);

Then I init my location services on the splash screen

mLocationServices.isGooglePlayAvailable();
mLocationServices.enableLocationUpdates();

which sets my Accuracy, Altitude, Bearing, Latitude,Longitude and speed in my Locations BC class. I then want to start my main activity and allow my map to use this data.

Can I use

startActivity(mMainActivity);

Upvotes: 0

Views: 95

Answers (1)

Larry Schiefer
Larry Schiefer

Reputation: 15775

No, you cannot call new for an Activity. The only way that they can be created is by calling Context.startActivity() or Context.startActivityForResult().

Upvotes: 1

Related Questions