0

How to display my SQLite data and bind it to an Adapter then display it in a recylcerviewer android.

This the whole code of my following class. Is it possible that I won't need to make an SQLite db to post my data directly through json response? if possible how should I do it? I just followed some tutorials

Login.java

public class LoginActivity extends Activity {

    private static final String TAG = RegisterActivity.class.getSimpleName();
    private Button btnLogin;
    private Button btnLinkToRegister;
    private EditText inputUsername;
    private EditText inputPassword;
    private ProgressDialog pDialog;
    private SessionManager session;
    private SQLiteHandler db;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);

        inputUsername = (EditText) findViewById(R.id.username);
        inputPassword = (EditText) findViewById(R.id.password);
        btnLogin = (Button) findViewById(R.id.btnLogin);
        btnLinkToRegister = (Button) findViewById(R.id.btnLinkToRegisterScreen);
        // Progress dialog
        pDialog = new ProgressDialog(this);
        pDialog.setCancelable(false);
        // SQLite database handler
        db = new SQLiteHandler(getApplicationContext());
        // Session manager
        session = new SessionManager(getApplicationContext());
        // Check if user is already logged in or not
        if (session.isLoggedIn()) {
            // User is already logged in. Take him to main activity
            Intent intent = new Intent(LoginActivity.this, MainActivity.class);
            startActivity(intent);
            finish();
        }
        // Login button Click Event
        btnLogin.setOnClickListener(new View.OnClickListener() {

            public void onClick(View view) {
                String username = inputUsername.getText().toString().trim();
                String password = inputPassword.getText().toString().trim();

                // Check for empty data in the form
                if (!username.isEmpty() && !password.isEmpty()) {
                    // login user
                    checkLogin(username, password);
                } else {
                    // Prompt user to enter credentials
                    Toast.makeText(getApplicationContext(),
                            "Please enter the credentials!", Toast.LENGTH_LONG)
                            .show();
                }
            }
        });
        // Link to Register Screen
        btnLinkToRegister.setOnClickListener(new View.OnClickListener() {

            public void onClick(View view) {
                Uri uri = Uri.parse("http://gsac.ph/iaccswebportal/register.php");
                Intent intent = new Intent(Intent.ACTION_VIEW, uri);
                startActivity(intent);
            }
        });
    }
    /**
     * function to verify login details in mysql db
     * */
    private void checkLogin(final String username, final String password) {
        // Tag used to cancel the request
        String tag_string_req = "req_login";

        pDialog.setMessage("Logging in ...");
        showDialog();

        StringRequest strReq = new StringRequest(Method.POST,
                AppConfig.URL_LOGIN, new Response.Listener<String>() {

            @Override
            public void onResponse(String response) {
                Log.d(TAG, "Login Response: " + response.toString());
                hideDialog();
                try {
                    JSONObject jsonObject = new JSONObject(response.toString());
                    Log.d(TAG, "Checking JSON Object" +jsonObject);
                    // Check for error node in json
                    if (!jsonObject.isNull("login")) {
                        JSONObject loginObject = (JSONObject) jsonObject.get("login");
                        // access individual json object thru jsonObject.get("FIELD_NAME")
                        Log.d("TEST", "-error attribute             : " + loginObject.get("error").toString());
                        Log.d("TEST", "-user attribute             : " + loginObject.get("user").toString());
                        // user successfully logged in
                        // Create login session
                        session.setLogin(true);
                        if (!loginObject.isNull("user")) {
                            // handle user login data
                            JSONObject userJSONObject = (JSONObject) loginObject.get("user");
                                Log.d("USER", "User Object                  : " + userJSONObject.toString());
                            String br_code =  userJSONObject.getString("br_code");
                                Log.d("USER", "-br_code attribute           : " + userJSONObject.get("br_code").toString());
                            String mem_id = userJSONObject.getString("mem_id");
                                Log.d("USER", "-mem_id attribute            : " + userJSONObject.get("mem_id").toString());
                            String username = userJSONObject.getString("username");
                                Log.d("USER", "-username attribute          : " + userJSONObject.get("username").toString());
                            String email = userJSONObject.getString("email");
                                Log.d("USER", "-email attribute             : " + userJSONObject.get("email").toString());
                            String created_at = userJSONObject.getString("created_at");
                                Log.d("USER", "-created_at attribute        : " + userJSONObject.get("created_at").toString());
                                Log.d("USER", "--------------------------------------------------------------------------------------------");
                            // Inserting row in users table
                            db.addUser(br_code, mem_id, username, email, created_at);
                        } else {
                            // a new JSON string that doesn't have user in login Object
                            Log.d("USER", "Unknown JSON String              : " + loginObject.toString());
                        }
                        //SL Details
                        if (!jsonObject.isNull("accounts")) {
                            JSONObject accountsObject = (JSONObject) jsonObject.get("accounts");
                            // access individual json object thru jsonObject.get("FIELD_NAME")
                            Log.d("SL_SUMM", "-error attribute             : " + accountsObject.get("error").toString());
                            JSONArray slArray = accountsObject.optJSONArray("sl_summ");
                            // Check if its login data i.e. user present
                            if (slArray != null) {
                                // handle account data
                                JSONArray array = ((JSONArray)accountsObject.getJSONArray("sl_summ"));
                                // access individual json array thru jsonObject.getJSONArray("FIELD_NAME")
                                Log.d("SL_SUMM", "-sl_summ array                       : " + accountsObject.getJSONArray("sl_summ").toString());
                                for (int index=0; index<array.length(); index++) {
                                    JSONObject object = (JSONObject)array.get(index);
                                    String sl_desc= object.getString("sl_desc");
                                        Log.d("SL_SUMM", "-sl_desc attribute           : " + object.get("sl_desc").toString());
                                    String tr_date= object.getString("tr_date");
                                        Log.d("SL_SUMM", "-tr_date attribute           : " + object.get("tr_date").toString());
                                    String actual_balance= object.getString("actual_balance");
                                        Log.d("SL_SUMM", "-actual_balance attribute    : " + object.get("actual_balance").toString());
                                    String available_balance= object.getString("available_balance");
                                        Log.d("SL_SUMM", "-available_balance attribute : " + object.get("available_balance").toString());
                                        Log.d("SL_SUMM", "----------------------------------------------------------------------------------");
                                    db.addUserSLDTL(sl_desc, tr_date, actual_balance, available_balance);
                                }
                            } else {
                                // a new JSON string that doesn't have sl_summ as member variable so display it and write new handler code
                                Log.d("SL_SUMM", "Unknown JSON String          : " + jsonObject.toString());
                            }
                        }
                        // Launch main activity
                        Intent intent = new Intent(LoginActivity.this, MainActivity.class);
                        startActivity(intent);
                        finish();
                    } else {
                        // Error in login. Get the error message
                        String errorMsg = jsonObject.getString("error_msg");
                        Toast.makeText(getApplicationContext(),errorMsg, Toast.LENGTH_LONG).show();
                    }
                } catch (JSONException e) {
                    // JSON error
                    e.printStackTrace();
                    Log.d("TEST", e.toString());
                    Toast.makeText(getApplicationContext(), "Json error: " + e.getMessage(), Toast.LENGTH_LONG).show();
                }
            }
        }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError error) {
                Log.e(TAG, "Login Error: " + error.getMessage());
                Toast.makeText(getApplicationContext(), error.getMessage(), Toast.LENGTH_LONG).show();
                hideDialog();
            }
        }) {
            @Override
            protected Map<String, String> getParams() {
                // Posting parameters to login url
                Map<String, String> params = new HashMap<String, String>();
                params.put("username", username);
                params.put("password", password);

                return params;
            }
        };
        // Adding request to request queue
        AppController.getInstance().addToRequestQueue(strReq, tag_string_req);
    }
    private void showDialog() {
        if (!pDialog.isShowing())
            pDialog.show();
    }
    private void hideDialog() {
        if (pDialog.isShowing())
            pDialog.dismiss();
    }
}

SQLiteHanlder.java

public class SQLiteHandler extends SQLiteOpenHelper {

    private static final String TAG = SQLiteHandler.class.getSimpleName();

    // All Static variables
    // Database Version
    private static final int DATABASE_VERSION = 1;

    // Database Name
    private static final String DATABASE_NAME = "test_db";

    // Table name
    private static final String TABLE_MEMBERS = "members";
    private static final String TABLE_MEMBERS_SLDTL = "sldtl";

    // members Table Column name
    private static final String BR_CODE = "br_code";
    private static final String MEM_ID = "mem_id";
    private static final String MEM_USERNAME = "username";
    private static final String MEM_EMAIL = "email";
    private static final String MEM_CREATED_AT = "created_at";

    // sldtl Table Column name
    private static final String SL_DESC = "sl_desc";
    private static final String TR_DATE = "trans_date";
    private static final String ACTUAL_BALANCE = "actual_balance";
    private static final String AVAILABLE_BALANCE = "available_balance";

    // Table Create Statements
    // Members table create statement
    private static final String CREATE_MEMBERS_TABLE = "CREATE TABLE "  + TABLE_MEMBERS + "("
            + BR_CODE + " INTEGER,"
            + MEM_ID + " INTEGER PRIMARY KEY,"
            + MEM_USERNAME + " TEXT,"
            + MEM_EMAIL + " TEXT UNIQUE,"
            + MEM_CREATED_AT + " TEXT" + ")";

    // SLDTL table create statement
    private static final String CREATE_SLDTL_TABLE = "CREATE TABLE " + TABLE_MEMBERS_SLDTL + "("
            + SL_DESC + " TEXT,"
            + TR_DATE + " DATETIME,"
            + ACTUAL_BALANCE + " REAL,"
            + AVAILABLE_BALANCE + " REAL" + ")";

    public SQLiteHandler(Context context) {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
    }
    @Override
    public void onCreate(SQLiteDatabase db) {
        // Creating required tables
        db.execSQL(CREATE_MEMBERS_TABLE);
        db.execSQL(CREATE_SLDTL_TABLE);
        Log.d(TAG, "Table members and sldtl was successfully created");
    }
    // Upgrading database
    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        // on upgrade drop existing tables
        db.execSQL("DROP TABLE IF EXISTS " + TABLE_MEMBERS);
        db.execSQL("DROP TABLE IF EXISTS " + TABLE_MEMBERS_SLDTL);

        Log.d(TAG, "Drop table members and sldtl if exists");
        // Creating new tables
        onCreate(db);
    }
    /**
     * Storing user details in database
     * */
    public void addUser(String br_code, String mem_id, String username, String email, String created_at) {
        SQLiteDatabase db = this.getWritableDatabase();

        ContentValues values = new ContentValues();
        values.put(BR_CODE, br_code); // branch code
        values.put(MEM_ID, mem_id); // mem id
        values.put(MEM_USERNAME, username); // username
        values.put(MEM_EMAIL, email); // Email
        values.put(MEM_CREATED_AT, created_at); // Created At

        // Inserting Row
        long id = db.insertOrThrow(TABLE_MEMBERS, null, values);

        db.close(); // Closing database connection

        Log.d(TAG, "Member's info was inserted successfully: " + id);
        Log.d(TAG, "BR CODE: " + br_code);
        Log.d(TAG, "Member ID: " + mem_id);
        Log.d(TAG, "Username: " + username);
        Log.d(TAG, "Email: " + email);
        Log.d(TAG, "Created at: " + created_at);
        Log.d(TAG, "---------------------------------");
    }
    /**
     * Getting user data from database
     * */
    public HashMap<String, String> getUserDetails() {
        HashMap<String, String> user = new HashMap<String, String>();
        String selectQuery = "SELECT * FROM " + TABLE_MEMBERS;

        SQLiteDatabase db = this.getReadableDatabase();
        Cursor cursor = db.rawQuery(selectQuery, null);
        // Move to first row
        cursor.moveToFirst();
        if (cursor.getCount() > 0) {
            user.put("br_code", cursor.getString(0));
            user.put("mem_id", cursor.getString(1));
            user.put("username", cursor.getString(2));
            user.put("email", cursor.getString(3));
            user.put("created_at", cursor.getString(4));

            Log.d(TAG, "Members's data: " + user.toString());
        }
        else{
            Log.d(TAG, "member's data is empty");
        }
        cursor.close();
        db.close();
        // return user
        Log.d(TAG, "Member's info was successfully fetch: " + user.toString());

        return user;
    }
    /**
     * Storing user SL details in database
     * */
    public void addUserSLDTL(String sl_desc, String tr_date, String  actual_balance, String available_balance){
        SQLiteDatabase db = this.getWritableDatabase();

        ContentValues values = new ContentValues();
        values.put(SL_DESC, sl_desc); // sl desc
        values.put(TR_DATE, tr_date); // trans date
        values.put(ACTUAL_BALANCE, actual_balance); // actual balance
        values.put(AVAILABLE_BALANCE, available_balance); // availabe balance

        // Inserting Row
        long id = db.insertOrThrow(TABLE_MEMBERS_SLDTL, null, values);
        db.close(); // Closing database connection

        Log.d(TAG, "Members's SL Details was successfully: " + id);
        Log.d(TAG, "SL Desc: " + sl_desc);
        Log.d(TAG, "Transaction Date: " + tr_date);
        Log.d(TAG, "Actual Balance: " + actual_balance);
        Log.d(TAG, "Available Balance: " + available_balance);
    }
    /**
     * Getting user SL details data from database
     * */
    public HashMap<String, String> getUserSLDTL() {
        HashMap<String, String> sl_summ = new HashMap<String, String>();
        String selectQuery = "SELECT * FROM " + TABLE_MEMBERS_SLDTL;

        SQLiteDatabase db = this.getReadableDatabase();
        Cursor cursor = db.rawQuery(selectQuery, null);
        // Move to first row
        cursor.moveToFirst();
        if (cursor.getCount() > 0) {
            sl_summ.put("sl_desc", cursor.getString(0));
            sl_summ.put("tr_date", cursor.getString(1));
            sl_summ.put("actual_balance", cursor.getString(2));
            sl_summ.put("available_balance", cursor.getString(3));

            Log.d(TAG, "Member's SL Details: " + sl_summ.toString());
        }
        else{
            Log.d(TAG, "member's SLDTL data is empty");
        }
        cursor.close();
        db.close();

        // return user
        Log.d(TAG, "Member's SL Details was successfully fetch: " + sl_summ.toString());

        return sl_summ;
    }
    /**
     * Getting user data from database
     * */
    public List<Datas> getUserSLDetails() {

        String selectQuery = "SELECT * FROM " + TABLE_MEMBERS;
        List<Datas>  mMemberDetails =  new ArrayList<>();

        SQLiteDatabase db = this.getReadableDatabase();
        Cursor cursor = db.rawQuery(selectQuery, null);
        // Move to first row
        cursor.moveToFirst();
        if (cursor.getCount() > 0) {

            Datas pMemebr = new Datas();

            pMemebr.setSL_DESC(cursor.getString(0));
            pMemebr.setTR_DATE(cursor.getString(1));
            pMemebr.setACTUAL_BALANCE(cursor.getString(2));
            pMemebr.setAVAILABLE_BALANCE(cursor.getString(3));

            mMemberDetails.add(pMemebr);
            Log.d(TAG, "Members's data: " + pMemebr.toString());
        }
        else{
            Log.d(TAG, "member's data is empty");
        }
        cursor.close();
        db.close();

        return mMemberDetails;

    }
    /**
     * Re create database Delete all tables and create them again
     * */
    public void deleteUsers() {
        SQLiteDatabase db = this.getWritableDatabase();
        // Delete All Rows
        db.delete(TABLE_MEMBERS, null, null);
        db.close();

        Log.d(TAG, "All member's info are now deleted in sqlite");
    }
    /**
     * Re create database Delete all tables and create them again
     * */
    public void deleteUserSLDTL() {
        SQLiteDatabase db = this.getWritableDatabase();
        // Delete All Rows
        db.delete(TABLE_MEMBERS_SLDTL, null, null);
        db.close();

        Log.d(TAG, "All member's SLDTL info are now deleted in sqlite");
    }
}

AccountsFragment.java

public class AccountsFragment extends Fragment {

    public AccountsFragment() {
        // Required empty public constructor
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View rootView = inflater.inflate(R.layout.fragment_accounts, container, false);
        RecyclerView rv = (RecyclerView) rootView.findViewById(R.id.rv_recycler_view);
        rv.setHasFixedSize(true);
        MyAdapter adapter = new MyAdapter(new String[]{"test one", "test two"});
        rv.setAdapter(adapter);

        LinearLayoutManager llm = new LinearLayoutManager(getActivity());
        rv.setLayoutManager(llm);

        return rootView;
    }
}

MyAdapter.java

public class MyAdapter extends RecyclerView.Adapter<MyAdapter.MyViewHolder> {

    private String[] mDataset;

    // Provide a reference to the views for each data item
    // Complex data items may need more than one view per item, and
    // you provide access to all the views for a data item in a view holder
    public static class MyViewHolder extends RecyclerView.ViewHolder {

        public CardView mCardView;
        public TextView account_type;
        public TextView accnt_description;
        public TextView balance_label;
        public TextView account_balance;

        public MyViewHolder(View v) {
            super(v);

            mCardView = (CardView) v.findViewById(R.id.card_view);

            account_type = (TextView) v.findViewById(R.id.lblShareCapital);
            balance_label = (TextView) v.findViewById(R.id.lblAvailableBalance);

            accnt_description = (TextView) v.findViewById(R.id.sl_desc);
            account_balance = (TextView) v.findViewById(R.id.actual_balance);
        }
    }
    // Provide a suitable constructor (depends on the kind of dataset)
        public MyAdapter(String[] myDataset) {
            mDataset = myDataset;
        }

    // Create new views (invoked by the layout manager)
    @Override
    public MyAdapter.MyViewHolder onCreateViewHolder(ViewGroup parent,
                                                     int viewType) {
        // create a new view
        View v = LayoutInflater.from(parent.getContext())
                .inflate(R.layout.card_item, parent, false);
        // set the view's size, margins, paddings and layout parameters
        MyViewHolder vh = new MyViewHolder(v);
        return vh;
    }
    @Override
    public void onBindViewHolder(MyViewHolder holder, final int position) {
        holder.account_type.setText(mDataset[position]);
        holder.mCardView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                String currentValue = mDataset[position];
                Log.d("CardView", "CardView Clicked: " + currentValue);
            }
        });
    }
    @Override
    public int getItemCount() {
        return mDataset.length;
    }
}

Datas.java

public class Datas {

private String SL_DESC;
private String TR_DATE;
private String ACTUAL_BALANCE;
private String AVAILABLE_BALANCE;

public String getSL_DESC() {
    return SL_DESC;
}

public void setSL_DESC(String SL_DESC) {
    this.SL_DESC = SL_DESC;
}

public String getTR_DATE() {
    return TR_DATE;
}

public void setTR_DATE(String TR_DATE) {
    this.TR_DATE = TR_DATE;
}

public String getACTUAL_BALANCE() {
    return ACTUAL_BALANCE;
}

public void setACTUAL_BALANCE(String ACTUAL_BALANCE) {
    this.ACTUAL_BALANCE = ACTUAL_BALANCE;
}

public String getAVAILABLE_BALANCE() {
    return AVAILABLE_BALANCE;
}

public void setAVAILABLE_BALANCE(String AVAILABLE_BALANCE) {
    this.AVAILABLE_BALANCE = AVAILABLE_BALANCE;
}

}

JRG
  • 4,037
  • 3
  • 23
  • 34
Novice
  • 77
  • 2
  • 11

1 Answers1

0

Change your AccountFragment Line below

MyAdapter adapter = new MyAdapter(new String[]{"test one", "test two"});

to

SQLiteHandler db = new SQLiteHandler(getActivity());
MyAdapter adapter = new MyAdapter(db.getUserSLDetails());

Then in your MyAdapter class change the dataset declaration in first line to -

private List<Datas> mDataset;

And your constructor to

public MyAdapter(List<Datas> myDataset) {
        mDataset = myDataset;
    }

Then in your onBindViewHolder method do

Datas datas = mDataset.get(position);
holder.account_balance.setText(datas.getACTUAL_BALANCE());

Do all 3 changes and then compile and run.

Kapil G
  • 4,081
  • 2
  • 20
  • 32
  • @kapsyn SQLiteHandler db = new SQLiteHandler(this); will generate an error sir. – Novice Jul 31 '17 at 08:07
  • I assumed you had a default constructor for your handler class. How does your handler class constructor look like ? – Kapil G Jul 31 '17 at 08:09
  • In that line you just have to create an object of your handler class. So you can do it based on how your handler class can be initialized. Or add the constructor code here. Basically you just need to call your getUserSLDetails method – Kapil G Jul 31 '17 at 08:10
  • Did you update? I still dont see the constructor. Are you accessing any other db related methods anywhere outside the class – Kapil G Jul 31 '17 at 08:19
  • my bad sir. I dont have a constructor yet. – Novice Jul 31 '17 at 08:28
  • not yet sir. I cannot understand it very. I'm not an android developer sir. I only followed some tutorials if things do not go well I posted a question here to ask some help. – Novice Jul 31 '17 at 08:46
  • this my constructor sir private String[] mDataset; and I change it to this private List mDataset; – Novice Jul 31 '17 at 09:19
  • This is also a good change but I was talking about the constructor of your SQLiteHandler class. How do you create the object of that class? Can you add full code of the class – Kapil G Jul 31 '17 at 09:22
  • I already posted the whole code of the following 5 classes sir – Novice Aug 01 '17 at 02:01
  • So my answer should now work. What issue do you get now – Kapil G Aug 01 '17 at 02:28
  • there was an error sir in Datas datas = mDataset[position]; Error:(68, 31) error: incompatible types: String cannot be converted to Datas. SQLiteHandler db = new SQLiteHandler(this); Error:(37, 50) error: incompatible types: AccountsFragment cannot be converted to Context. MyAdapter adapter = new MyAdapter(db.getUserSLDetails()); Error:(38, 66) error: incompatible types: List cannot be converted to String[] – Novice Aug 01 '17 at 02:47
  • @Novice updated my answer and it should work now. didnt notice you were using Fragment there so changed that now. – Kapil G Aug 01 '17 at 03:13
  • there is an error here sir. Datas datas = mDataset[position]; Error:(72, 31) error: array required, but List found. and in this code public void onClick(View view) { String currentValue = mDataset[position]; Log.d("CardView", "CardView Clicked: " + currentValue); } String currentValue = mDataset[position];Error:(77, 47) error: array required, but List found – Novice Aug 01 '17 at 03:20
  • when i change the Datas datas = mDataset[position]; to Datas datas = mDataset.get(position); the error is fix. but it has still an error in onbind String currentValue = mDataset. – Novice Aug 01 '17 at 03:21
  • So your current value is not String anymore. Its the object of Datas class. So your list is the list of Datas class. If you want to access any value you have to do Datas datas = mDataset.get(position); holder.account_balance.setText(datas.getACTUAL_BALANCE()); I mentioned this in Step 3 – Kapil G Aug 01 '17 at 03:23
  • use the getter methods that are there in datas class to get values one bye one and show in each textview of your viewholder – Kapil G Aug 01 '17 at 03:25
  • sir, there's no data was displayed, sir. I checked the android log cat and this the response Members' SL Details data: [gsacmobileportal.activity.Datas@5357cf18] of the Log.d("getUserSLDetails()", "Members's SL Details data: " + mMemberDetails.toString()); – Novice Aug 01 '17 at 04:00
  • Don't print the class directly in log. Try to print one of the variables of the class in the log and see if data is coming. – Kapil G Aug 01 '17 at 04:11
  • there is a data sir Members' SL Description: PA : Savings Account but only the 1st row not the whole rows my current table has 2 rows of data. – Novice Aug 01 '17 at 04:53
  • I will open another question sir and accept ur answer above. cuz I think this is another issue? – Novice Aug 01 '17 at 04:54
  • Yes add another question for that as that looks a different problem. Do Accept the answer above – Kapil G Aug 01 '17 at 05:11
  • but why It did not display to my cardView sir/ – Novice Aug 01 '17 at 05:36
  • Basically in your viewholder you need to setup what to display in your card view. So you need to check your logic there. Plus you also need to test if your database is returning full data from your query – Kapil G Aug 01 '17 at 05:46
  • it only return 1 row sir. I will open another question now sir. – Novice Aug 01 '17 at 05:52
  • Yes and in that clearly explain what you are looking for and what is now missing with minimal code. Also what are the rows in your data and what is not displayed – Kapil G Aug 01 '17 at 05:54
  • here is the link of my new question sir. hope you will help me with these. https://stackoverflow.com/questions/45431017/how-to-retrieve-all-the-rows-in-my-db – Novice Aug 01 '17 at 07:01
  • Yes I just saw that and added my answer to the question as well. Check it. – Kapil G Aug 01 '17 at 07:10
  • sir can u help me with this problem https://stackoverflow.com/questions/47864786/data-does-not-display-in-listview/47882058?noredirect=1#comment82740603_47882058 – Novice Dec 20 '17 at 07:28