我正在开发一个eclipse插件,我想要Android Project源代码中使用的所有方法(存在于Android API中)的名称。有谁知道我应该如何解析代码?
假设我的源代码是:
package com.example.androidsample;
import android.content.Context;
import android.location.Location;
import android.location.LocationManager;
import android.telephony.SmsManager;
public class MockLocationProvider {
String providerName;
Context ctx;
public MockLocationProvider(String name, Context ctx) {
this.providerName = name;
this.ctx = ctx;
LocationManager lm = (LocationManager) ctx.getSystemService(
Context.LOCATION_SERVICE);
lm.addTestProvider(providerName, false, false, false, false, false, true, true, 0, 5);
SmsManager smsManager = SmsManager.getDefault();
smsManager.sendTextMessage("Phone Number", null, "Message", null, null);
lm.setTestProviderEnabled(providerName, true);
}
public void pushLocation(double lat, double lon) {
LocationManager lm = (LocationManager) ctx.getSystemService(
Context.LOCATION_SERVICE);
Location mockLocation = new Location(providerName);
mockLocation.setLatitude(lat);
mockLocation.setLongitude(lon);
mockLocation.setAltitude(0);
mockLocation.setTime(System.currentTimeMillis());
lm.setTestProviderLocation(providerName, mockLocation);
}
public void shutdown() {
LocationManager lm = (LocationManager) ctx.getSystemService(
Context.LOCATION_SERVICE);
lm.removeTestProvider(providerName);
}
}
然后我要求的清单就像:
[
getSystemService,
addTestProvider,
getDefault,
sendTextMessage,
setTestProviderEnabled,
setLatitude,
setLongitude,
setAltitude,
setTime,
setTestProviderLocation,
removeTestProvider
]
对此方向的任何帮助表示赞赏。