Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

listview malfunctioning with v1 #32

Closed
Devang-Targetint opened this issue Sep 6, 2014 · 0 comments
Closed

listview malfunctioning with v1 #32

Devang-Targetint opened this issue Sep 6, 2014 · 0 comments

Comments

@Devang-Targetint
Copy link

In the list view there is textview, button and edittext in the single list item.
And all the items are getting generated dynamically
sometimes 3 sometimes 7 sometimes 14 ...

If I put values in those edittext ... I am able to et values of 6 or less edittext ... In the device Genymotion with 4.7" with visible item on screen are 6 and 7th partial...
While in the 10" genymotin, the visible items are 9

How to get values from the all the edittext from this dynamic listview?

final list

..........

public class DeliveryDetailFinal extends BaseFragment {

    Integer mPickingId = null;
    Integer mLineSize = null;
    LinkedHashMap<String, String> productData = new LinkedHashMap<String, String>();
    List<Object> moveLinesfinalData;
    View mDOViewFinal = null;
    ListView mMoveLinesFinalListDo = null;
    Context mDBContextDDF = null;
    List<OEDataRow> moveLinesData;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        setHasOptionsMenu(true);
        mDOViewFinal = inflater.inflate(R.layout.fragment_delivery_order_detail_final_view,
                container, false);
        Bundle bundle = getArguments();
        if (bundle != null) {
            mLineSize = bundle.getInt("lineSize");
        }
        init();
        mDODHelper = db().getOEInstance();
        mDBContextDDF = (Context) getActivity();
        return mDOViewFinal;
    }

    private void init(){
            initControls();
    }

    private void initControls(){
        moveLinesData = mDeliveryOrderData.getO2MRecord("move_lines").browseEach();
        mMoveLinesFinalListDo = (ListView) mDOViewFinal.findViewById(R.id.DOMoveLinesFinal);
        moveLinesfinalData = new ArrayList<Object>();
        moveLinesfinalData.addAll(moveLinesData);
        OEListAdapter listAdapter = new OEListAdapter(mDBContextDDF, R.layout.fragment_final_details_view, moveLinesfinalData){
            @Override
              public View getView(int position, View convertView, ViewGroup parent) {
                  View mView = convertView;
                  if (mView == null)
                      mView = getActivity().getLayoutInflater().inflate(
                              getResource(), parent, false);
                  mView = createListViewRow(mView, position, moveLinesfinalData); 
                  mView.setVisibility(1);
                  return mView;
              }
        };
        mMoveLinesAdapterfinal = listAdapter;
        Log.d("final", "final  mMoveLinesAdapterfinal "+mMoveLinesAdapterfinal);
        mMoveLinesFinalListDo.setAdapter(mMoveLinesAdapterfinal);
    }

    public View createListViewRow(View mView, int position,
            List<Object> moveLinesObjectData) {
            final OEDataRow row = (OEDataRow) moveLinesObjectData.get(position);
        TextView eProductName = (TextView) mView.findViewById(R.id.textViewProductNameFinal);
        eProductName.setText(row.getString("name").toString());
        LinearLayout innerLinearLayout = (LinearLayout) mView.findViewById(R.id.innerLinearLayout);
        EditText editTextProductId = (EditText) innerLinearLayout.findViewById(R.id.editTextProductId);
        if(row != null)
            editTextProductId.setText(row.getInt("id").toString());

        EditText eProductSerial = (EditText) innerLinearLayout.findViewById(R.id.editTextProductSerialFinal);

        String id = editTextProductId.getText().toString();
        String serialNumber = ((EditText) eProductSerial).getText().toString();
        productData.put(id,serialNumber);

        Log.d("final", "final productData before "+productData);
        eProductSerial.setOnFocusChangeListener(new View.OnFocusChangeListener() {
            public void onFocusChange(View v, boolean hasFocus) {
               if (!hasFocus)
                {
                    LinearLayout parentLayout = (LinearLayout) v.getParent();
                    if(parentLayout != null) {
                        EditText editTextProductIdFocus = (EditText) parentLayout.findViewById(R.id.editTextProductId);
                        String id = editTextProductIdFocus.getText().toString();
                        String serialNumber = ((EditText) v).getText().toString();
                        productData.put(id,serialNumber);
                    }
                }
            }
        });
            final Button BarCode = (Button) innerLinearLayout.findViewById(R.id.buttonBarcode);
            BarCode.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View v) {
                    v.getId();
                }
            });
        return mView;
    }

    @Override
    public Object databaseHelper(Context context) {
        return new StockPickingDB(context);
    }
}

please help me ... Thanks in advance ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants