我有一个listView of items.Each项目里面有两个单独的片段,当点击该项目时可见。片段内有另一个ListView和一个按钮。该按钮显示一个对话框,通过该对话框填充片段内的ListView。问题是当对话框关闭时,父列表视图会刷新,因此片段可见性消失。我必须再次单击父列表视图项以查看片段及其内容。我希望片段视图及其更新的内容在对话框解除后仍然可以查看。所以有人请帮助我。
以下是我的父listView类:
@SuppressLint("NewApi")
public class Due extends FragmentActivity implements
OutletformAddDialog_due.DonebuttonListener {
TextView headerView;
View tempstore, imagetempstore;
OutletformAddDialog_due selectedOutlet;
Fragment fr;
public BaseAdapter dueadapter;
ListView Duelist;
Boolean DuedetailFlag = false, OrderdetailFlag = false;
TextView DueDetailsRight, DueDetailsTop, DueDetailsBottom,
DueDetailsrightHorizontal, OrderDetailsleft, OrderDetailstop,
OrderDetailsBottom, OrderDetailsleftHorizontal, DueDetailsButton,
OrderDetailsButton, btnDueNav, tvOutletName;
Button DuetoCallCard;
int index;
public int getIndex() {
return index;
}
private String order_id;
private String outlet_id;
private String amount;
private String date;
private int count = 0;
private View lvNavigation;
boolean formDashboard = false;
ArrayList<Payment> dueArray = new ArrayList<Payment>();
ArrayList<DueItem> tempdueArray = new ArrayList<DueItem>();
ArrayList<String> navigationList;
NavigationAdapter adapter;
int prevItem, currentItem;
View btnDuetoCallCard;
private ImageView home;
String stateStore = "";
TextView totalCollectedDue;
TextView orderDueAmmount;
ViewGroup header;
private View clickedHeaderView;
FragmentManager fm;
FragmentTransaction fragmentTransaction;
public String getheaderDueamount() {
return orderDueAmmount.getText().toString();
}
public void setheaderDueamount(String amount) {
orderDueAmmount.setText(amount);
}
// public void setDueList(int position) {
// dueadapter.getItem(position)
// }
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.duea_amount_layout);
DuetoCallCard = (Button) findViewById(R.id.btnDuetoCallCard);
DuetoCallCard.bringToFront();
Duelist = (ListView) findViewById(R.id.due_layout_listView);
tvOutletName = (TextView) findViewById(R.id.textviewoutletname);
home = (ImageView) findViewById(R.id.btndueHome);
home.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
Intent intent = new Intent(new Intent(Due.this,
MainActivity.class));
intent.putExtra("home", true);
startActivity(intent);
}
});
Bundle b = getIntent().getExtras();
if (b != null) {
formDashboard = getIntent().getExtras().getBoolean("fromDashboard");
}
if (formDashboard) {
// spinRoute.setVisibility(View.VISIBLE);
// spinOutlet.setVisibility(View.VISIBLE);
// Outlet1542
selectedOutlet = new OutletformAddDialog_due();
selectedOutlet.show(getFragmentManager(), "dialog");
} else {
populateArray();
}
btnDuetoCallCard = findViewById(R.id.btnDuetoCallCard);
initArrays();
// for disappearing the big circular button
Duelist.setOnScrollListener(new OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem,
int visibleItemCount, int totalItemCount) {
if (firstVisibleItem + visibleItemCount >= totalItemCount) {
// End has been reached
// btnaddOutlet.startAnimation(AnimationUtils.loadAnimation(Outlet_List.this,
// android.R.anim.fade_out));
btnDuetoCallCard.setVisibility(View.GONE);
} else {
// btnaddOutlet.startAnimation(AnimationUtils.loadAnimation(Outlet_List.this,
// android.R.anim.fade_in));
btnDuetoCallCard.setVisibility(View.VISIBLE);
}
if (visibleItemCount == totalItemCount)
btnDuetoCallCard.setVisibility(View.VISIBLE);
}
});
}
void populateArray() {
dueadapter = new BaseAdapter() {
LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// if (convertView == null) {
convertView = inflater.inflate(R.layout.dueamounts_list_item,
null);
// }
TextView orderNo = (TextView) convertView
.findViewById(R.id.tvdueOrderNo);
TextView orderDate = (TextView) convertView
.findViewById(R.id.tvdueDate);
orderDueAmmount = (TextView) convertView
.findViewById(R.id.tvRemainingDueAmmount);
ImageButton imgbtn = (ImageButton) convertView
.findViewById(R.id.dueImageButton);
orderNo.setText("Order "
+ dueArray.get(position).getOrder_id().getId());
orderDate.setText(dueArray.get(position).getDate());
Double dueAmount = dueArray.get(position).getAmount();
orderDueAmmount.setText(formatDoubleValues(dueAmount));
// old way
// orderNo.setText("" + dueArray.get(position).getOrder());
// orderDate.setText(dueArray.get(position).getDate());
// orderAmmount.setText(dueArray.get(position).getAmmount());
header = (ViewGroup) convertView.findViewById(R.id.header);
header.setId(position);
header.setOnClickListener(due_header_clicked);
ViewGroup body = (ViewGroup) convertView
.findViewById(R.id.body);
View Headerparent = (View) header.getParent();
View image = findViewById(R.id.dueImageButton);
View TAB_Orderdetail = body.findViewById(R.id.btnOrderDetails);
View TAB_Duedetail = body.findViewById(R.id.btnDueDetails);
TAB_Orderdetail.setOnClickListener(change_fragment_listener);
TAB_Duedetail.setOnClickListener(change_fragment_listener);
// imgbtn.setOnClickListener(due_header_clicked);
View placeHolder = convertView
.findViewById(R.id.duefragment_placeholder);
int id = 10000 + position;
placeHolder.setId(id);
dueArray.get(position).setPlaceHolder(id);
Payment item = dueArray.get(position);
if (stateStore.equals("" + position)) {
// header.performClick();
body.setVisibility(View.VISIBLE);
header.performClick();
} else {
body.setVisibility(View.GONE);
}
// totalCollectedDue = (TextView) convertView
// .findViewById(R.id.tvTotalCollectedDueAmount);
return convertView;
}
@Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return position;
}
@Override
public Object getItem(int position) {
// TODO Auto-generated method stub
return dueArray.get(position);
}
@Override
public int getCount() {
// TODO Auto-generated method stub
return dueArray.size();
}
};
Duelist.setAdapter(dueadapter);
dueadapter.notifyDataSetChanged();
Duelist.setDivider(null);
Duelist.setDividerHeight(0);
}
int headerIndex = 0;
// View headerView;
int placeHolder_id = 0;
public OnClickListener due_header_clicked = new OnClickListener() {
@Override
public void onClick(View v) {
onHeaderClicked(v);
clickedHeaderView = v;
}
};
public void onHeaderClicked(View v) {
index = v.getId();
headerIndex = index;
// fr = dueArray.get(index).getDueFragment();
Bundle bundle = new Bundle();
bundle.putInt("index", headerIndex);
fr = tempdueArray.get(index).getDueFragment(headerIndex);
// fr.setArguments(bundle);
// tempdueArray.get(index).setDue_fragment(headerIndex);
Due.this.placeHolder_id = dueArray.get(index).getPlaceHolder();
final Payment item = dueArray.get(index);
// saving the header clicked position for later use
stateStore = "" + v.getId();
View view = (View) v.getParent();
TextView headerDueamount = (TextView) view
.findViewById(R.id.tvRemainingDueAmmount);
headerView = headerDueamount;
DueDetailsRight = (TextView) view.findViewById(R.id.tvduedetialright);
DueDetailsTop = (TextView) view.findViewById(R.id.tvdeudetailstop);
DueDetailsBottom = (TextView) view
.findViewById(R.id.tvdeudetailsBottom1);
DueDetailsrightHorizontal = (TextView) view
.findViewById(R.id.tvDuedetailslefthorizontal);
OrderDetailsBottom = (TextView) view
.findViewById(R.id.tvorderdetailBottom);
OrderDetailstop = (TextView) view.findViewById(R.id.tvorderdetailtop);
OrderDetailsleft = (TextView) view
.findViewById(R.id.tvOrderdetailsleft);
OrderDetailsleftHorizontal = (TextView) view
.findViewById(R.id.tvDuedetailsrighthorizontal);
final View body = view.findViewById(R.id.body);
View image = view.findViewById(R.id.dueImageButton);
View TAB_Orderdetail = body.findViewById(R.id.btnOrderDetails);
View TAB_Duedetail = body.findViewById(R.id.btnDueDetails);
TAB_Orderdetail.setOnClickListener(change_fragment_listener);
TAB_Duedetail.setOnClickListener(change_fragment_listener);
if (body.getVisibility() != View.VISIBLE) {
if (tempstore != null) {
tempstore.setVisibility(View.GONE);
imagetempstore
.setBackgroundResource(R.drawable.ic_due_dropdown_icon);
}
tempstore = body;
imagetempstore = image;
body.setVisibility(View.VISIBLE);
// if (fr == null) {
View test = (View) v.getParent().getParent();
DueDetailsButton = (TextView) test
.findViewById(R.id.btnOrderDetails);
OrderDetailsleft.setVisibility(View.INVISIBLE);
OrderDetailstop.setVisibility(View.INVISIBLE);
DueDetailsBottom.setVisibility(View.INVISIBLE);
OrderDetailsleftHorizontal.setVisibility(View.INVISIBLE);
DueDetailsRight.setVisibility(View.VISIBLE);
DueDetailsTop.setVisibility(View.VISIBLE);
OrderDetailsBottom.setVisibility(View.VISIBLE);
DueDetailsrightHorizontal.setVisibility(View.VISIBLE);
fm = getSupportFragmentManager();
fragmentTransaction = fm.beginTransaction();
// fr = dueArray.get(index).getOrderFragment();
// fragmentTransaction.replace(item.getPlaceHolder(), fr);
// fragmentTransaction.commit();
// fr = dueArray.get(index).getDueFragment();
fr = tempdueArray.get(index).getDueFragment(headerIndex);
fm = getSupportFragmentManager();
fragmentTransaction = fm.beginTransaction();
fragmentTransaction.replace(item.getPlaceHolder(), fr);
fragmentTransaction.commit();
image.setBackgroundResource(R.drawable.ic_expand_icon);
} else {
image.setBackgroundResource(R.drawable.ic_due_dropdown_icon);
body.setVisibility(View.GONE);
}
}
public OnClickListener change_fragment_listener = new OnClickListener() {
@Override
public void onClick(View v) {
changeFargment(v);
}
};
public void changeFargment(View v) {
View test = (View) v.getParent().getParent();
DueDetailsRight = (TextView) test.findViewById(R.id.tvduedetialright);
DueDetailsTop = (TextView) test.findViewById(R.id.tvdeudetailstop);
DueDetailsBottom = (TextView) test
.findViewById(R.id.tvdeudetailsBottom1);
DueDetailsrightHorizontal = (TextView) test
.findViewById(R.id.tvDuedetailslefthorizontal);
OrderDetailsBottom = (TextView) test
.findViewById(R.id.tvorderdetailBottom);
OrderDetailstop = (TextView) test.findViewById(R.id.tvorderdetailtop);
OrderDetailsleft = (TextView) test
.findViewById(R.id.tvOrderdetailsleft);
OrderDetailsleftHorizontal = (TextView) test
.findViewById(R.id.tvDuedetailsrighthorizontal);
DueDetailsButton = (TextView) test.findViewById(R.id.btnDueDetails);
OrderDetailsButton = (TextView) test.findViewById(R.id.btnOrderDetails);
OrderDetailsButton = (TextView) test.findViewById(R.id.btnOrderDetails);
switch (v.getId()) {
case R.id.btnOrderDetails:
DueDetailsButton.setTextColor(Color.parseColor("#8e8f92"));
OrderDetailsButton.setTextColor(Color.parseColor("#050708"));
// Bundle bundle = new Bundle();
// bundle.putInt("index", headerIndex);
// fr = dueArray.get(headerIndex).getOrderFragment();
fr = tempdueArray.get(headerIndex).getOrderFragment(headerIndex);
// fr.setArguments(bundle);
DueDetailsRight.setVisibility(View.INVISIBLE);
DueDetailsTop.setVisibility(View.INVISIBLE);
OrderDetailsBottom.setVisibility(View.INVISIBLE);
DueDetailsrightHorizontal.setVisibility(View.INVISIBLE);
OrderDetailsleft.setVisibility(View.VISIBLE);
OrderDetailstop.setVisibility(View.VISIBLE);
DueDetailsBottom.setVisibility(View.VISIBLE);
OrderDetailsleftHorizontal.setVisibility(View.VISIBLE);
break;
case R.id.btnDueDetails:
OrderDetailsButton.setTextColor(Color.parseColor("#8e8f92"));
DueDetailsButton.setTextColor(Color.parseColor("#050708"));
Bundle bundle = new Bundle();
bundle.putInt("index", headerIndex);
// fr = dueArray.get(headerIndex).getDueFragment();
fr = tempdueArray.get(headerIndex).getDueFragment(headerIndex);
fr.setArguments(bundle);
OrderDetailsleft.setVisibility(View.INVISIBLE);
OrderDetailstop.setVisibility(View.INVISIBLE);
DueDetailsBottom.setVisibility(View.INVISIBLE);
OrderDetailsleftHorizontal.setVisibility(View.INVISIBLE);
DueDetailsRight.setVisibility(View.VISIBLE);
DueDetailsTop.setVisibility(View.VISIBLE);
OrderDetailsBottom.setVisibility(View.VISIBLE);
DueDetailsrightHorizontal.setVisibility(View.VISIBLE);
break;
case R.id.btnCollection:
break;
case R.id.btndueHome:
Intent intent = new Intent(new Intent(Due.this, MainActivity.class));
intent.putExtra("home", true);
startActivity(intent);
break;
}
// DueDetail.total = 0;
FragmentManager fm = getSupportFragmentManager();
FragmentTransaction fragmentTransaction = fm.beginTransaction();
fragmentTransaction.replace(Due.this.placeHolder_id, fr);
fragmentTransaction.commit();
}
public void buttonClickActions(View v) {
startActivity(new Intent(Due.this, CallCard.class));
finish();
}
@Override
public void onDoneButtonClick(DialogFragment dialog, String outlet,
String outletId) {
tvOutletName.setText(outlet);
outlet_id = outletId;
populateArray();
}
List<Payment> dueList;
public void initArrays() {
dueList = Entity.query(Payment.class).executeMulti();
// initializing the arraylist with object values
for (int i = 0; i < dueList.size(); i++) {
dueArray.add(dueList.get(i));
DueItem dt = new DueItem();
// dt.setOrder("order " + dueList.get(i).getOrder_id());
// dt.setDate("21July,2015" + dueList.get(i).getDate());
// dt.setAmmount("BDT" + dueList.get(i).getAmount());
tempdueArray.add(dt);
}
}
public String formatDoubleValues(Double myDouble) {
DecimalFormat myFormat = new DecimalFormat("0.00");
return myFormat.format(myDouble);
}
}
以下类是更新片段ListView和它所在的父Listview的片段类之一。
public class DueDetail extends Fragment {
BaseAdapter dueDetailAdapter;
ListView dueDetailList;
TextView collectionbtn;
TextView totalInitialDue;
CheckBox cbCash, cbCheque;
private String dueAmmount;
double total, totalremainingDue;
int currentDueOnOrder = 100000;
ArrayList<DueCollection> arrayDueDetail = new ArrayList<DueCollection>();
ArrayList<Payment> arrayPayment = new ArrayList<Payment>();
List<DueCollection> duelist;
List<Payment> paymentlist;
private TextView TotalCollectedDue;
Formater fObj = new Formater();
int currentPositon;
int position;
Due dueActivity;
OrderModel om;
DueCollection odi;
boolean setClicked = false;
public DueDetail(int pos) {
//
duelist = Entity.query(DueCollection.class).executeMulti();
for (int i = 0; i < duelist.size(); i++) {
// if (duelist.get(i).getAmount() != null) {
int postion = duelist.get(i).getPayment_id().getId();
if (postion == pos + 1) {
arrayDueDetail.add(duelist.get(i));
}
}
paymentlist = Entity.query(Payment.class).executeMulti();
for (int i = 0; i < paymentlist.size(); i++) {
arrayPayment.add(paymentlist.get(i));
}
// for calculating the total of collected due in the duedetail
// fragment
for (int i = 0; i < arrayDueDetail.size(); i++) {
if (arrayDueDetail.get(i).getAmount() != null) {
int dueAmount = Integer.parseInt(arrayDueDetail.get(i)
.getAmount());
total += dueAmount;
}
}
//
}
@Override
@Nullable
public View onCreateView(LayoutInflater inflater,
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.due_amounts_duedetails_history,
container, false);
this.view = view;
dueActivity = (Due) getActivity();
position = dueActivity.getIndex();
DecimalFormat formatter = new DecimalFormat("#,###,###");
totalInitialDue = (TextView) view.findViewById(R.id.tvRemainingDue);
totalInitialDue.setText("BDT "
+ arrayPayment.get(position).getInitialDue());
TotalCollectedDue = (TextView) view
.findViewById(R.id.tvTotalCollectedDueAmount);
String totalduecollection = amountFormatter(total);
TotalCollectedDue.setText("BDT " + totalduecollection);
updateUI();
return view;
}
View view;
public void updateUI() {
if (view == null)
return;
collectionbtn = (TextView) view.findViewById(R.id.btnCollection);
collectionbtn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
final Dialog d = new Dialog(getActivity());
d.requestWindowFeature(Window.FEATURE_NO_TITLE);
d.setContentView(R.layout.due_collection_popup);
// d.requestWindowFeature(Window.FEATURE_NO_TITLE);
final EditText et = (EditText) d
.findViewById(R.id.etduecollectionamount);
d.findViewById(R.id.btnCollectionOk).setOnClickListener(
new OnClickListener() {
@Override
public void onClick(View v) {
dueAmmount = et.getText().toString();
if (dueAmmount != null) {
if (!(dueAmmount.equals(""))) {
int incremental_position = position + 1;
// creating a object of duecollection
odi = new DueCollection();
odi.setAmount(dueAmmount);
SimpleDateFormat sdf = new SimpleDateFormat(
"dd MMMM,yyyy");
String currentDate = sdf
.format(new Date());
odi.setDate(currentDate);
Payment payObj = Entity
.query(Payment.class)
.where("_id='"
+ incremental_position
+ "'").execute();
odi.setPayment_id(payObj);
om = Entity
.query(OrderModel.class)
.where("_id='"
+ incremental_position
+ "'").execute();
odi.setOrder_id(om);
odi.save();
arrayDueDetail.add(odi);
// *** duecollection obj creation ends
// here
total = 0;
dueDetailAdapter.notifyDataSetChanged();
for (int i = 0; i < arrayDueDetail
.size(); i++) {
double dueAmount = Integer
.parseInt(arrayDueDetail
.get(i).getAmount());
total += dueAmount;
}
String DueOnOrder = arrayPayment.get(
position).getInitialDue();
double remainingdue = Double
.parseDouble(DueOnOrder)
- total;
dueActivity.dueArray.get(position)
.setAmount(remainingdue);
dueActivity.dueadapter
.notifyDataSetChanged();
payObj.setAmount(remainingdue);
payObj.setSynced("0");
payObj.save();
// set the total remaining due to the
// header textview
String totalduecollection = amountFormatter(total);
TotalCollectedDue.setText("BDT "
+ totalduecollection);
dueActivity.stateStore = "" + position;
setClicked = true;
}
}
d.dismiss();
}
});
d.show();
d.setOnDismissListener(new OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
// dueActivity.populateArray();
Formater fobJ = new Formater();
DueCollectionAsyncTask dcat = new DueCollectionAsyncTask(
dueActivity, "" + odi.getOrder_id().getId(), ""
+ odi.getPayment_id().getOutlet_id()
.getId(), dueAmmount, fobJ
.getDateinPrefferedFormat());
dcat.execute();
}
});
}
});
// dueActivity.header.performClick();
dueDetailList = (ListView) view.findViewById(R.id.listViewDueDetails);
dueDetailAdapter = new BaseAdapter() {
LayoutInflater inflater = (LayoutInflater) getActivity()
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// if (convertView == null) {
convertView = inflater.inflate(
R.layout.due_amounts_duedetails_product_items, null);
// }
TextView dueFragproduct = (TextView) convertView
.findViewById(R.id.tvduefragDate);
TextView dueFragDueCollectionAmmount = (TextView) convertView
.findViewById(R.id.tvduefragProductAmmount);
dueFragproduct.setText(arrayDueDetail.get(position).getDate());
DecimalFormat formatter = new DecimalFormat("#,###,###");
String commaformatedstring = ""
+ arrayDueDetail.get(position).getAmount();
dueFragDueCollectionAmmount.setText("BDT "
+ commaformatedstring);
return convertView;
}
@Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return 0;
}
@Override
public Object getItem(int position) {
// TODO Auto-generated method stub
return arrayDueDetail.get(position);
}
@Override
public int getCount() {
// TODO Auto-generated method stub
return arrayDueDetail.size();
}
};
dueDetailList.setAdapter(dueDetailAdapter);
dueDetailList.setDivider(null);
dueDetailList.setDividerHeight(0);
setListViewHeightBasedOnChildren(dueDetailList);
}
/****
* Method for Setting the Height of the ListView dynamically. Hack to fix
* the issue of not showing all the items of the ListView when placed inside
* a ScrollView
****/
public void setListViewHeightBasedOnChildren(ListView listView) {
ListAdapter listAdapter = listView.getAdapter();
if (listAdapter == null)
return;
int desiredWidth = MeasureSpec.makeMeasureSpec(listView.getWidth(),
MeasureSpec.UNSPECIFIED);
int totalHeight = 0;
View view = null;
for (int i = 0; i < listAdapter.getCount(); i++) {
view = listAdapter.getView(i, view, listView);
if (i == 0)
view.setLayoutParams(new ViewGroup.LayoutParams(desiredWidth,
LayoutParams.WRAP_CONTENT));
view.measure(desiredWidth, MeasureSpec.UNSPECIFIED);
totalHeight += view.getMeasuredHeight();
}
ViewGroup.LayoutParams params = listView.getLayoutParams();
params.height = totalHeight
+ (listView.getDividerHeight() * (listAdapter.getCount() - 1));
listView.setLayoutParams(params);
listView.requestLayout();
}
public void confirmationDialog(String msg, String title, final Dialog d) {
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
getActivity());
alertDialogBuilder.setMessage(msg);
final AlertDialog alertDialog = alertDialogBuilder.create();
alertDialogBuilder.setTitle(title);
alertDialogBuilder.setPositiveButton("yes",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface arg0, int arg1) {
d.dismiss();
}
});
alertDialogBuilder.setNegativeButton("No",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
alertDialog.cancel();
}
});
AlertDialog alertDialog2 = alertDialogBuilder.create();
alertDialog2.show();
Button nbutton = alertDialog2
.getButton(DialogInterface.BUTTON_NEGATIVE);
nbutton.setBackgroundColor(Color.parseColor("#47b96b"));
Button pbutton = alertDialog2
.getButton(DialogInterface.BUTTON_POSITIVE);
pbutton.setBackgroundColor(Color.parseColor("#e06165"));
int textViewId = alertDialog2.getContext().getResources()
.getIdentifier("android:id/alertTitle", null, null);
TextView tv = (TextView) alertDialog2.findViewById(textViewId);
tv.setTextColor(getResources().getColor(R.color.coral_blue));
}
public String amountFormatter(double number) {
DecimalFormat formatter = new DecimalFormat("#,###,###");
String totalduecollection = formatter.format(Double.parseDouble(""
+ number));
return totalduecollection;
}
}
答案 0 :(得分:-1)
对我来说并不完全清楚。您是否在对话框中意味着您有一些反映片段lisview的动作?
我在这里理解你正在子视图片段中做一些反映在父视图列表项上的内容,你期望在视图中更新父项数据并且在这里保持视图状态你打算打开父项就像它一样(当你更新片段或对话框中的内容时)
我的主要答案是你保持位置以某种方式保持活动类的成员引用,你实际在父项目onClick回调中设置父列表。
保持这个位置,以后你所要做的就是在适配器内调用一个方法来传递位置以在项目视图上设置执行clic
您可以从此链接获得提示..
http://blog.wittchen.biz.pl/how-to-highlight-and-click-on-listview-item-in-android-programmatically/