我有兩個列表活動A。列表視圖中的值從活動B獲得。當列表被點擊時,它假設去活動B。如何在另一個類中顯示seekBar值?
對於A中的進步價值,它實際上從搜索條得到。
假設第一個列表被點擊了,seekBar應該顯示36而不是0!這是我到目前爲止嘗試過的。
活動A
listview.setOnItemClickListener(new AdapterView.OnItemClickListener() { // if listView is clicked
@Override
public void onItemClick(AdapterView<?> a, View v, int position, long id) {
Object o = listview.getItemAtPosition(position);
SearchResults fullObject = (SearchResults) o;
String temp = fullObject.getDescription();
String[] ReceiveDescription = temp.split(":");
String Progress=fullObject.getProgress();
String[] ReceiveProgress=Progress.split(":");
String TimeIn=fullObject.getTimeIn();
String []ReceiveTimeIn=TimeIn.split(":");
String TimeOut=fullObject.getTimeOut();
String []ReceiveTimeOut=TimeOut.split(":");
Intent i = new Intent(getApplication(), Add_Details_Information.class);
i.putExtra("ReceiveProject", ReceiveProject);
i.putExtra("ReceiveDescription", ReceiveDescription[1]);
i.putExtra("ReceiveProgress", ReceiveProgress[1].getProgress()); //cannot resolve getProgress
i.putExtra("ReceiveTimeIn", ReceiveTimeIn[1]);
i.putExtra("ReceiveTimeOut", ReceiveTimeOut[1]);
i.putExtra("date",date);
i.putExtra("status", status);
startActivityForResult(i,PROJECT_REQUEST_CODE);
}
});
}
活動B
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.add_details_information);
addItemsOnSpinner(); // Spinner for project/service/training
tp = new TimePick(); // call tmePick
description=(EditText)findViewById(R.id.editTextWorkDescription);
timeIn=(EditText)findViewById(R.id.TimeIn);
timeOut=(EditText)findViewById(R.id.TimeOut);
save=(Button)findViewById(R.id.saveButton);
seekBar=(SeekBar)findViewById(R.id.seekBarPercentage);
progressText=(TextView)findViewById(R.id.textProgress);
progressText.setText("Covered:" + "" + seekBar.getProgress() + "/" + seekBar.getMax());
if(getIntent().getExtras()!=null)
{
final String Project1=getIntent().getStringExtra("ReceiveProject");
final String Description1 = getIntent().getStringExtra("ReceiveDescription");
final int Progress1=getIntent().getIntExtra("ReceiveProgress",0);
final String TimeIn1=getIntent().getStringExtra("ReceiveTimeIn");
final String TimeOut1=getIntent().getStringExtra("ReceiveTimeOut");
// project.setText(Project1);
description.setText(Description1);
timeIn.setText(TimeIn1);
timeOut.setText(TimeOut1);
seekBar.setProgress(Progress1);
// Toast.makeText(this,Progress1,Toast.LENGTH_LONG).show();
progressText.setText("Covered:" + "" + seekBar.getProgress() + "/" + seekBar.getMax());
}
您只想要'seekbar'值或希望顯示'seekbar'進展到您正在獲取的值。 – Pankaj
@Clairvoyant我想要顯示'seekbar進度' – John
您是否添加了'setOnSeekBarChangeListener'? – Jas