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

更多相关文章

  1. Android的startActivityForResult()与onActivityResult()与setRe
  2. Android开发入门之为应用添加多个Activity与参数传递
  3. java socket参数详解:TcpNoDelay
  4. 在spring 中如何注入map,set,list,property等参数
  5. 如何将动态参数传递给jquery函数
  6. 使用字符串参数调用AndroidJni静态方法。
  7. Java开发水吧点饮品系统(顶层父类对象做接口参数)
  8. java返回值是list的时候获取list的参数类型
  9. Java反射---getGenericSuperclass和ParameterizedType参数化类型

随机推荐

  1. android 性能优化
  2. AgentWeb WebView 与 Android交互 JS调用
  3. Android如何避免输入法弹出时遮挡住按钮
  4. No 122 · android获取本机号码和本机唯
  5. Android: 背景图片平铺要这么干
  6. Talking about Android Message Queue
  7. Android SDK Manager 报错:Connection to
  8. android 权限汇集
  9. 学习Android的一些网站收集
  10. android 电池(一):锂电池基本原理篇