在 Android 中,是否有一种更优雅的方式来检索内部类中的应用程序上下文,而不是将上下文作为参数传递?
public class MainActivity extends Activity {
class SeekBarChangeListener implements SeekBar.OnSeekBarChangeListener
{
private Context context;
private TextView distanceTextView;
public SeekBarChangeListener(Context context, TextView distanceTextView) {
this.context = context;
this.distanceTextView = distanceTextView;
}
}
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
}