如何在函数中将两个参数从1个类传递给另一个?
16lz
2021-01-22
This is one of the class where i assign data to the item and it return one parameter back to the other class. How should i write it to return two parameter instead? For this case it return final price, how should i write it to return final price and subtotal as well?
这是我将数据分配给项目的类之一,它将一个参数返回给另一个类。我该如何写它来返回两个参数呢?对于这种情况,它返回最终价格,我应该如何写它以返回最终价格和小计?
public static String Final_Price = " ";
public static String subtotal = " ";
protected String doInBackground(String... arg0) {
Final_Price = co.price;
subtotal = co.subtotal;
return Final_Price;
}
@Override
protected void onPostExecute(String result){
String search = Final_Price;
((ReceiptActivity)activity).get_data(search);
}
This is the receipt activity where there is a function to get the data i pass.
这是收据活动,其中有一个函数来获取我传递的数据。
public void get_data (String c)
{
shippingfeeTextView.setText("Shipping fee: " + c);
}
4 个解决方案
#1
1
If you want only two parameters, you can use Pair
. Source: http://developer.android.com/reference/android/util/Pair.html
如果只需要两个参数,则可以使用Pair。资料来源:http://developer.android.com/reference/android/util/Pair.html
更多相关文章
- Android的startActivityForResult()与onActivityResult()与setRe
- Android开发入门之为应用添加多个Activity与参数传递
- java socket参数详解:TcpNoDelay
- 在spring 中如何注入map,set,list,property等参数
- 如何将动态参数传递给jquery函数
- 使用字符串参数调用AndroidJni静态方法。
- Java开发水吧点饮品系统(顶层父类对象做接口参数)
- java返回值是list的时候获取list的参数类型
- Java反射---getGenericSuperclass和ParameterizedType参数化类型