我对Android和Java相当陌生,希望你能帮助我解决这个问题。从外部类访问TextView
我有一个嵌套类:
public class MyLocationListener implements LocationListener
{
public void onLocationChanged(Location loc)
{
loc.getLatitude();
loc.getLongitude();
String loTude = "Longitude:" + loc.getLongitude();
String laTude = "Latitude: " + loc.getLatitude();
((TextView) findViewById(R.id.tvLong)).setText(loTude);
((TextView) findViewById(R.id.tvLat)).setText(laTude);
}
如何从我的外部类访问两个字符串loTude和laTude? 我是否需要通过一个对象从方法中返回它们,或者还有其他方法吗?
写在这个类中的方法,该方法会返回字符串2 s通过一个对象,你想要或写的任何类2种方法,将分别返回loTude和laTude :) – rohit 2012-03-09 09:55:12