我試圖檢索一些已添加到套件中的數據,但我無法使用正常方式檢索它。無法從套件中檢索數據
我這工作當前的代碼是
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