1
在我發佈我的問題之前,我已經做了一些研究,但沒有一個幫助。奇怪的部分是,它昨晚工作,我相信什麼都沒有改變。但是,我不能讓現在的工作,因爲findViewByID無故findViewByID突然返回null
public class ShowInMap extends MapActivity{
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.mapview);
MapView mapView = (MapView) this.findViewById(R.id.mapview);
if(mapView == null)
{
Log.i("test", "test");
}
}
}
返回null,這是我的MapView XML
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.maps.MapView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mapview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true"
android:apiKey="Map Key"
/>
我想,也許我的調試密鑰已過期,但如果是這樣的,我應該從Eclipse中得到一些錯誤,說我的密鑰已過期或者什麼?我不應該嗎?這有點令人沮喪,任何評論將不勝感激。謝謝
我不認爲有一個關鍵的問題。如果有,它會去地圖,但會顯示白色的瓷磚。 –