我试图检索一些已添加到套件中的数据,但我无法使用正常方式检索它。无法从套件中检索数据
我这工作当前的代码是
Intent i = getIntent();
Bundle bundle = i.getExtras();
for (String key : bundle.keySet()) {
Object value = "start_color";
start_color = String.format("%s", key);
}
这让我捆价值,但是当我使用一个标准的代码是这样
Intent i = getIntent();
Bundle bundle = i.getExtras();
if (bundle != null)
{
String value = bundle.getString("start_color");
}
是无法获得的束值我很困惑为什么发生这种情况!有人能告诉我为什么会发生这种情况吗?
这就是我把价值成束
String rgbString = "R: " + Color.red(color) + " B: " + Color.blue(color) + " G: " + Color.green(color);
//Change activity send data
Intent device = new Intent(v.getContext(), Create_Preset.class);
device.putExtra(rgbString,"start_color");
startActivity(device);
overridePendingTransition(R.anim.left_in, R.anim.left_out);
我甚至通过REST API,因此那些想知道,如果包有任何增值新行插入我的使用改变代码预设表的代码,是的,它确实!!
这里是我的存储值看到对数据库的选择start_color
和end_color
这些都是我从包获取值
Host: localhost Database: led Generation Time: Jan 17, 2015 at 04:37 PM Generated by: phpMyAdmin 4.2.7.1/MySQL 5.6.20 SQL query: SELECT * FROM `preset` WHERE 1 LIMIT 0, 25 ; Rows: 2 Current selection does not contain a unique column. Grid edit, checkbox, Edit, Copy and Delete features are not available. preset starttime_hour starttime_min endtime_hour endtime_min startColor endColor test 12 0 12 0 R: 159 B: 159 G: 159 R: 159 B: 159 G: 159 test2 12 0 12 0 R: 39 B: 122 G: 91 R: 39 B: 122 G: 91
您确定该包含有该值吗?在代码中显示你把值放在包中的代码 – Marcus
@Marcus包中包含值我怎么才能得到它与改变的代码? –
您正在反转键和值。 – corsair992