我在Shopping.this
上收到以下错误:
非静态变量,不能从静态上下文引用。
除了将getShipping()
更改为非静态外,我应该如何更改代码?
public class Shopping extends Activity {
public static final String total_weights = "weight";
public static double getShipping(double total_weight) {
String weight = Double.toString(total_weight);
System.out.println(weight);
Intent intent = new Intent(Shopping.this,shopping1.class);
intent.putExtra(total_weights, weight);
Shopping.this.startActivity(intent);
}
}