GridView GridView is aview group that display items in two dimensional scrolling grid (rows and columns). Items are inserted into this grid layout from a database or from an array. The ListView and GridView are subclasses of AdapterView and they can be populated by binding them to an Adapter, which retrieves data from an external source and creates a View that represents each data entry. flutterjunction.com
3.
Key Methods ofGridView flutterjunction.com setAdapter(Adapter adapter) Binds the data source (like an ArrayAdapter or custom adapter) to the GridView. gridView.setAdapter(adapter) setNumColumns(int numColumns) Sets the number of columns in the GridView. gridView.setNumColumns(3);
4.
Key Methods ofGridView flutterjunction.com setOnItemClickListener(OnItemClickListener listener) Handles item click events in the GridView. gridView.setOnItemClickListener(listener); getAdapter() Returns the adapter currently associated with the GridView. Adapter adapter = gridView.getAdapter();
5.
Key Methods ofGridView flutterjunction.com getSelectedItem() Returns the item that is currently selected. Object item = gridView.getSelectedItem();
GridView flutterjunction.com Features Flexible Grid Layout: GridViewprovides a structured grid layout that allows developers to organize data into rows and columns. The number of columns can be dynamically adjusted. Automatic Data Binding: With the help of adapters (like ArrayAdapter, BaseAdapter, or custom adapters), GridView automatically binds and displays data from various sources (arrays, lists, databases, etc.).
8.
GridView flutterjunction.com Features Customizable Grid Items Eachcell in the grid can be customized using custom layouts, allowing for rich content such as images, text, and interactive UI components. Scrollable Grid: GridView is inherently scrollable both vertically and horizontally, making it ideal for large data sets that require scrolling.
9.
GridView flutterjunction.com Features Efficient Item Reuse GridViewefficiently reuses item views with the ViewHolder pattern, improving performance and memory management when displaying large amounts of data. Responsive Layout Control Developers can control spacing between grid items, padding, alignment, and the number of columns to make the grid adaptive across various screen sizes and orientations.
RecyclerView flutterjunction.com RecyclerView is anadvanced, flexible version of ListView and GridView, used to efficiently display large datasets by recycling item views. Why Use RecyclerView? More flexible compared to ListView and GridView. Supports different layout managers (Linear, Grid, Staggered). Efficient memory usage with view recycling.
12.
Components of RecyclerView flutterjunction.com RecyclerView: Theview that contains and displays a list of items. LayoutManager: Manages how items are arranged. Types include: LinearLayoutManager (vertical/horizontal list) GridLayoutManager (grid format) StaggeredGridLayoutManager (grid with uneven rows/columns)
Methods in RecyclerView flutterjunction.com setLayoutManager(LayoutManagerlayoutManager) Sets the layout manager (Linear, Grid, etc.) for arranging items. setAdapter(Adapter adapter) Binds the adapter to RecyclerView to manage and display data. onCreateViewHolder(ViewGroup parent, int viewType) Inflates the item layout and returns a new ViewHolder instance.
RecyclerView flutterjunction.com Additional Uses ofRecyclerView Efficient item recycling with the ViewHolder pattern. Supports multiple layout managers. Built-in animations for item changes (add, remove, move). Easy implementation of complex lists (grids, staggered layouts). More control over item layout, interaction, and decoration.
17.
RecyclerView flutterjunction.com When to UseRecyclerView? Scrollable Lists: Chat apps, social feeds. Grids: Photo galleries, e-commerce product listings. Staggered Grids: Pinterest-style layouts. Complex Lists: Custom, interactive lists with varied item types.
Introduction to SQLite flutterjunction.com Itis an open-source database provided in Android. Lightweight, embedded database engine. So, there is no need to perform any database setup or administration task. Local storage solution for Android applications. Stores data in tables with rows and columns. The SQLite database is lazily initialized. This means that it isn't actually created until it's first accessed through a call to getReadableDatabase() or getWriteableDatabase(). This also means that any methods that call getReadableDatabase() or getWriteableDatabase() should be done on a background thread as there is a possibility that they might be kicking off the initial creation of the database.
20.
Establishing Connection flutterjunction.com A helperclass to manage database creation and version management. Requires overriding onCreate() and onUpgrade() methods. SQLite database will be used across your entire application; within services, applications, fragments, and more. For this reason, best practices often advise you to apply the singleton pattern to your SQLiteOpenHelper instances to avoid memory leaks and unnecessary reallocations. The best solution is to make your database instance a singleton instance across the entire application's lifecycle. SQLiteOpenHelper Class
Data Manipulation flutterjunction.com Keep InMind Use try-finally to ensure database resources are closed. Keep database interactions on a background thread to avoid blocking the UI. Use Singleton pattern for SQLiteOpenHelper to manage a single database instance.
flutterjunction.com Stands for ApplicationProgramming Interface. Set of rules and protocols for building and interacting with software applications. Enables different software systems to communicate with each other. API
flutterjunction.com Web API architecturestyle. Uses standard HTTP methods: GET, POST, PUT, DELETE. Data often exchanged in JSON or XML format. Types of API REST (Representational State Transfer)
33.
flutterjunction.com Protocol for exchangingstructured information. XML-based messaging protocol. Requires strict standards and more overhead. Types of API SOAP (Simple Object Access Protocol)
34.
flutterjunction.com Query language forAPIs. Allows clients to request only the data they need. More flexible than REST but requires a different setup. Types of API GraphQL
35.
flutterjunction.com Stands for JavaScriptObject Notation. Lightweight data-interchange format. Easy for humans to read and write, and easy for machines to parse and generate. Consists of key-value pairs. Supports data types like strings, numbers, objects, arrays, booleans, and null. Introduction to JSON