我只是想知道什么样的方式有通过从ClassA的两个或两个以上的双值ClassB的
I am just wondering what ways there are to pass two or more double values from classA to ClassB
在一分钟我已经找到code,让我这个方法:
at the minute i have found code that give me this method:
double a, b;
double a = 2.456;
double b = 764.2353;
Intent i = new Intent();
i.setClassName("com.b00348312.application","com.b00348312.application.ClassB");
double number = getIntent().getDoubleExtra("value1", a);
double number = getIntent().getDoubleExtra("value2", b);
startActivity(i);
这不通过的值,也可以找到检索这些值的方法
This does not pass the values through nor can i find a way of retrieving these values
在这里还有一个问题提出创建类的实例,但在尝试,我似乎无法通过正确地传递价值的方法。
Another question on here suggested the method of creating an instance of the class but trying that i cant seem to pass the values through properly.
我编程的机器人,所以我不知道是否该方法会有所不同。
I am programming for Android, so I don't know if the method will be different
您实际上并没有把你的双打到意图
You're not actually placing your doubles into your Intent
Intent yourInent = new Intent(thisActivity.this, nextActivity.class);
Bundle b = new Bundle();
b.putDouble("key", doubleVal);
yourIntent.putExtras(b);
startActivity(yourIntent);
然后,把它在你的下一个活动:
Then, get it in your next Activity:
Bundle b = getIntent().getExtras();
double result = b.getDouble("key");