我一直試圖從一個類中的方法傳遞一個字符串到另一個類中的方法,但似乎無法做到這一點。在類和方法之間傳遞字符串
我一直在嘗試了幾件事情像
String location = Latitude + "," + Longitude;
AccelOrientExample GPSstring = new AccelOrientExample();
GPSstring.onSensorChanged(location);
其中location是我想傳遞給類AccelOrientExample,在那裏我有與位置的arguement方法的字符串。
請幫幫忙,謝謝
無法實例類型AccelOrientExample是第一個錯誤,我得到這是對新的一面。而SensorEventListener類型中的onSensorChanged(SensorEvent)方法不適用於第二行的參數(字符串)。
public void onSensorChanged(SensorEvent sensorEvent, String location)
是在AccelOrientExample
你會得到什麼錯誤? *如何*這不起作用? – 2012-11-09 09:55:10
你面臨的問題是什麼? –
'似乎無法做到這一點'然後發生了什麼? –