Posts

SqLite CURD Operations

 1. Create Helper Class public class DatabaseHelper extends SQLiteOpenHelper {      public static final String Database_name = "Students.db";      public static final String Table_name = "Student_table";      public static final String col_id = "Id";      public static final String col_name = "name";      public static final String col_marks = "marks";      public DatabaseHelper(@Nullable Context context) {        super(context, Database_name, null, 1);      }      @Override      public void onCreate(SQLiteDatabase db) {          db.execSQL("create table " + Table_name +" (Id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT , marks INTEGER)");      }      @Override      public void onUpgrade(SQLi...

Android Activity Lifecycle

Image
  What is the Android Lifecycle? The Android Activity Lifecycle defines how an activity behaves in different states: - Created - Started - Resumed - Paused - Stopped - Destroyed Lifecycle Methods • onCreate(): Initialize your activity • onStart(): Activity is about to become visible • onResume(): Activity has become visible • onPause(): Partially obscured • onStop(): Fully obscured • onRestart(): Restarting after stop • onDestroy(): Cleanup before destruction JAVA CODE    @Override         protected   void  onCreate(Bundle savedInstanceState) {            super .onCreate(savedInstanceState);           setContentView(R.layout.activity_main);           Log.d( "lifecycle" , "onCreate invoked" );       }        @Ove...

Recycler View: MarketApp

Image
 Recycler View: MarketApp 📋 Steps to Create a RecyclerView: Item Layout: First, design the layout for a single item in XML. This layout defines how each row/item in the RecyclerView will look. RecyclerView Widget: Add the RecyclerView in your activity's layout and initialize it in the activity or fragment using Java/Kotlin code. Model Class: Create a data class that holds the information for each item (like title, image, etc.) you want to show in the RecyclerView. Adapter Class: This is where the real action happens. The adapter connects the data (from the model) to the views (item layout). It handles creating item views and binding data to them. ViewHolder: ViewHolder holds references to the views inside each item, making scrolling smooth and fast by avoiding repeated findViewById calls Resources :   https://drive.google.com/drive/folders/1vp4TVMTACXblVQM-HGPc1UrqWZoAoRV6?usp=drive_link Item Layout android:layout_height="wrap_content">     ...

List View : Planet Application

Image
 Output Step 1: Create Layout: item_list_layout android:layout_height="wrap_content" <ImageView         android:id="@+id/imageView"         android:layout_width="100dp"         android:layout_height="100dp"         android:layout_margin="16dp"         android:layout_marginStart="16dp"         app:layout_constraintBottom_toBottomOf="parent"         app:layout_constraintStart_toStartOf="parent"         app:layout_constraintTop_toTopOf="parent" />       <TextView         android:id="@+id/planet_name"         android:layout_width="wrap_content"         android:layout_height="wrap...