我是Android應用程序開發新手,請耐心等待。我正在編寫一個應用程序,可從Google Play服務獲取GPS位置,然後通過藍牙廣播數據。我有一個獲取位置的位置活動,以及廣播數據的廣告活動。錯誤:找不到符號類廣告動態
我的問題是,我很難理解android應用程序中的文件結構,所以我懷疑我缺乏理解是爲什麼我得到錯誤。
這裏是LocationActivity的片段,其中的錯誤是:
@Override
public void onLocationReceived(Location location) {
Intent i = new Intent(LocationActivity.this, AdvertiseActivity.class) //problem is here
.putExtra("latitude", location.getLatitude());
startActivity(i);
}
爲什麼不能編譯器發現AdvertiseActivity.class?我的清單下面有什麼問題?
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:ignore="AllowBackup,GoogleAppIndexingWarning">
<activity android:name="com.android.app.LocationActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.android.app.AdvertiseActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
請幫助。謝謝!
您對這兩項活動都使用了android.intent.action.MAIN,刪除其中的一項,它會正常工作 –