在我的应用程序中,我需要将位置存储到 firebase,因此我使用两个位置类作为应用程序,因为我需要存储两个不同实体的位置
第一应用类
public class FirstApplicationClass extends MultiDexApplication implements GoogleApiClient.ConnectionCallbacks,
GoogleApiClient.OnConnectionFailedListener,
LocationListener{
}
第二应用类
public class SecondApplicationClass extends FirstApplicationClass implements GoogleApiClient.ConnectionCallbacks,
GoogleApiClient.OnConnectionFailedListener,
LocationListener {
}
下面是 manifest.xml 代码
<application
android:name=".location.SecondApplicationClass"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
我需要使用 this.getApplicationContext(); 在这两种情况下,在我使用第二个应用程序类的第二种情况下,我可以使用 this.getApplicationContext(); 从具体的活动,即
mSecondApplicationClass = (SecondApplicationClass) this.getApplicationContext();
并能够存储位置。我不知道如何使用 this.getApplicationContext(); 与第一个应用程序类,即
mFirstApplicationClass = (FirstApplicationClass) this.getApplicationContext();
我无法做到这一点