About Us

At MYK DEALS, we provide you with an excellent shopping experience as our clients’ satisfaction matter a lot. 

*"براہ کرم نوٹ فرمالیں کہ ۔۔۔*

*آن لائن ٹرانزیکشنز کے متعلق مذہبی شرائط کے تحت، تمام آرڈرز فقط وعدہ کی بنیاد پر طے ہوں گے ۔*
*جس کی بنیادی وجہ صرف اور صرف یہی ہے کہ ۔۔۔*

*اکثر ہم دوسروں کا مال سیل کرتے ہیں*
*لہذا جب اپ آرڈر لکھائیں گے جو کہ ہمارے درمیان وعدہ ہوگا ہمیں آگے سے مال مل گیا تو ہم آپ کو دینے کے پابند ہوں گے اور آپ بھی نہ لینا چاہیں تو آپ کو اجازت ہوگی ۔*

جس کو آسان لفظوں میں یوں سمجھ لیں کہ ۔۔۔
*ہمارا سودا کیش ان ڈیلیوری پر فائنل ہوگا ۔*

*آپ کا آرڈر مکمل کرنا ہم اپنی ذمہ داری سمجھتے ہیں ۔*

*آپ کے تعاون اور ہماری سروس پر اعتماد کا شکریہ۔"*

 

 

 

 

////////////////Dynamic Fragmentation code\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

....................///// Mian Activity File\\\\\\.............................

package com.myapp.myapplication;

import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.FrameLayout;

public class MainActivity extends AppCompatActivity {
Button btn1, btn2;


@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btn1=findViewById(R.id.btn1);
btn2=findViewById(R.id.btn2);
btn1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
FragmentTransaction fragmentTransaction=getSupportFragmentManager().beginTransaction();
fragmentTransaction.add(R.id.framlayout1,new BlankFragment());
fragmentTransaction.commit();
}
});
btn2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
FragmentTransaction fragmentTransaction=getSupportFragmentManager().beginTransaction();
fragmentTransaction.add(R.id.framlayout1,new BlankFragment2());
fragmentTransaction.commit();
}
});

}
}


.....................///////////////////////blank fragmentation fil\\\\\\\\\\\\\\\\\\\\............


package com.myapp.myapplication;

import android.os.Bundle;

import androidx.fragment.app.Fragment;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

/**
* A simple {@link Fragment} subclass.
* Use the {@link BlankFragment2#newInstance} factory method to
* create an instance of this fragment.
*/
public class BlankFragment2 extends Fragment {

// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1";
private static final String ARG_PARAM2 = "param2";

// TODO: Rename and change types of parameters
private String mParam1;
private String mParam2;

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

/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param param1 Parameter 1.
* @param param2 Parameter 2.
* @return A new instance of fragment BlankFragment2.
*/
// TODO: Rename and change types and number of parameters
public static BlankFragment2 newInstance(String param1, String param2) {
BlankFragment2 fragment = new BlankFragment2();
Bundle args = new Bundle();
args.putString(ARG_PARAM1, param1);
args.putString(ARG_PARAM2, param2);
fragment.setArguments(args);
return fragment;
}

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mParam1 = getArguments().getString(ARG_PARAM1);
mParam2 = getArguments().getString(ARG_PARAM2);
}
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_blank2, container, false);
}
}

 

 

Recycle View

Create a layout:
It should Include Card
Styling is up to you
Card will have 3 Components (2 Text Views and 1 Image View )
And assign them id’s

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<androidx.cardview.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>

<GridLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:rowCount="3"
android:columnCount="1">

<ImageView
android:id="@+id/imgContact"
android:layout_width="350dp"
android:layout_height="200dp"
android:src="@drawable/omen"
/>
<TextView
android:id="@+id/txtName"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Contact"
android:textSize="22sp"
android:textStyle="bold"/>
<TextView
android:id="@+id/txtNumber"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Contact Number"
android:textSize="16sp" />

</GridLayout>

</androidx.cardview.widget.CardView>

</LinearLayout>


Create a xml file for Recycle View
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center">

<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/recylerContact"/>


</LinearLayout>

Now In Main Activity File
package com.example.finals;

import android.os.Bundle;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import java.util.ArrayList;

public class MainActivity extends AppCompatActivity {
ArrayList<ContactModel> arrContacts =new ArrayList<>();

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.recycler_view);

RecyclerView recyclerView=findViewById(R.id.recylerContact);

// step 4
recyclerView.setLayoutManager(new LinearLayoutManager(this));



arrContacts.add(new ContactModel(R.drawable.omen,"Omen","44444"));
arrContacts.add(new ContactModel(R.drawable.omen,"Omeny","44444"));
arrContacts.add(new ContactModel(R.drawable.omen,"Omena","44444"));
arrContacts.add(new ContactModel(R.drawable.omen,"Omens","44444"));
arrContacts.add(new ContactModel(R.drawable.omen,"Omenc","44444"));
arrContacts.add(new ContactModel(R.drawable.omen,"Omend","44444"));
arrContacts.add(new ContactModel(R.drawable.omen,"Omenyy","44444"));
arrContacts.add(new ContactModel(R.drawable.omen,"Omenaa","44444"));
arrContacts.add(new ContactModel(R.drawable.omen,"Omenh","44444"));
arrContacts.add(new ContactModel(R.drawable.omen,"Omenj","44444"));
arrContacts.add(new ContactModel(R.drawable.omen,"Omenjgd","44444"));

RecylerContactAdapter adapter = new RecylerContactAdapter(this,arrContacts);
recyclerView.setAdapter(adapter);


}
}

In This code :
ArrayList<ContactModel> arrContacts =new ArrayList<>();
Means we have array as we know that array only accepts one type that can be either string or integers. So to solve this error we create custom model that will accept multiple data types
so For that we will create a java file which will include constructor

package com.example.finals;

//Structure class (Customize Array which accepts multiple data types)
public class ContactModel {
int img;
String name,number;

public ContactModel(int img,String name,String number){
this.name = name;
this.number = number;
this.img = img;
}
}

NOW

arrContacts.add(new ContactModel(R.drawable.omen,"Omen","44444"));
we are going to add in array
so as we write arraContact that is variable name of array it will ask for (3 items because we have passed <Contact Model > in array )
so now if we see our Contact model constructor parameter it was requiring 3 parameters , so that is what we are passing


Create Custom Recycle Adapter
So in mainActivity
RecylerContactAdapter adapter = new RecylerContactAdapter(this,arrContacts);

We see this line at end so this RecyclerContactAdapter is custom that we have created
So we will create a java file

package com.example.finals;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import java.util.ArrayList;

public class RecylerContactAdapter extends RecyclerView.Adapter<RecylerContactAdapter.ViewHolder> {

Context context;
ArrayList<ContactModel> arrContacts;
RecylerContactAdapter(Context context , ArrayList<ContactModel> arrContacts){
this.context = context;
this.arrContacts=arrContacts;
}

@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {

View view =LayoutInflater.from(context).inflate(R.layout.contact_card,parent,false);
ViewHolder viewHolder= new ViewHolder(view);
return viewHolder;
}

@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {

holder.imgContact.setImageResource(arrContacts.get(position).img);
holder.txtName.setText(arrContacts.get(position).name);
holder.txtNumber.setText(arrContacts.get(position).number);

}

@Override
public int getItemCount() {
return arrContacts.size();
}

public class ViewHolder extends RecyclerView.ViewHolder{

TextView txtName,txtNumber;
ImageView imgContact;

public ViewHolder(@NonNull View itemView) {
super(itemView);

txtName = itemView.findViewById(R.id.txtName);
txtNumber = itemView.findViewById(R.id.txtNumber);
imgContact = itemView.findViewById(R.id.imgContact);


}
}
}