DoctorAnanSmnia

HomeWorkSchoolVerticalSystem

Oct 25th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 45.56 KB | None | 0 0
  1. ActivityMain
  2. =============
  3. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  4.     android:layout_width="match_parent"
  5.     android:layout_height="match_parent"
  6.     android:background="#f7fcff"
  7.     android:orientation="vertical">
  8.  
  9.     <TextView
  10.         android:layout_width="match_parent"
  11.         android:layout_height="wrap_content"
  12.         android:layout_marginTop="15dp"
  13.         android:gravity="center"
  14.         android:text="Welcome, Login To The System"
  15.         android:textColor="#ff8cd1"
  16.         android:textSize="22sp" />
  17.  
  18.     <EditText
  19.         android:id="@+id/etname"
  20.         android:layout_width="match_parent"
  21.         android:layout_height="wrap_content"
  22.         android:layout_marginTop="15dp"
  23.         android:hint="User Name"
  24.         android:textSize="22sp" />
  25.  
  26.     <EditText
  27.         android:id="@+id/etPassword"
  28.         android:layout_width="match_parent"
  29.         android:layout_height="wrap_content"
  30.         android:hint="Password"
  31.         android:inputType="textPassword"
  32.         android:textSize="22sp" />
  33.  
  34.     <LinearLayout
  35.         android:layout_width="match_parent"
  36.         android:layout_height="wrap_content"
  37.         android:orientation="horizontal">
  38.  
  39.         <Button
  40.             android:id="@+id/btnlog"
  41.             android:layout_width="wrap_content"
  42.             android:layout_height="wrap_content"
  43.             android:layout_margin="10dp"
  44.             android:layout_weight="1"
  45.             android:textColor="#ff8cd1"
  46.             android:text="Login"
  47.             android:textSize="18sp" />
  48.  
  49.  
  50.         <Button
  51.             android:id="@+id/btnreg"
  52.             android:layout_width="wrap_content"
  53.             android:layout_height="wrap_content"
  54.             android:layout_margin="10dp"
  55.             android:layout_weight="1"
  56.             android:textColor="#00acff"
  57.             android:text="Register"
  58.             android:textSize="18sp" />
  59.  
  60.         <Button
  61.             android:id="@+id/btnex"
  62.             android:layout_width="wrap_content"
  63.             android:layout_height="wrap_content"
  64.             android:layout_margin="10dp"
  65.             android:layout_weight="1"
  66.             android:textColor="#ff8cd1"
  67.             android:text="Exit"
  68.             android:textSize="18sp" />
  69.     </LinearLayout>
  70.     <TextView
  71.         android:id="@+id/tverr"
  72.         android:layout_width="match_parent"
  73.         android:layout_height="wrap_content"
  74.         android:layout_marginTop="15dp"
  75.         android:gravity="center"
  76.         android:textColor="#e5061d"
  77.         android:textSize="22sp" />
  78.     <TextView
  79.         android:id="@+id/simple"
  80.         android:layout_width="match_parent"
  81.         android:layout_height="wrap_content"
  82.         android:layout_marginTop="15dp"
  83.         android:gravity="center"
  84.         android:text="If You Are A Teacher, \n Please Ask The Responsible \n Person, About The Register. \n \n POWERED BY: \n Anan Smnia \n(C)"
  85.         android:textColor="#51aca9"
  86.         android:textSize="22sp" />
  87. </LinearLayout>
  88.  
  89. MainActivity.java
  90. =================
  91. package com.example.user.webtop;
  92.  
  93. import android.content.Context;
  94. import android.content.Intent;
  95. import android.content.SharedPreferences;
  96. import android.graphics.Color;
  97. import android.support.v7.app.AppCompatActivity;
  98. import android.os.Bundle;
  99. import android.view.View;
  100. import android.widget.Button;
  101. import android.widget.EditText;
  102. import android.widget.TextView;
  103. import android.widget.Toast;
  104. import android.app.AlertDialog;
  105. import android.content.DialogInterface;
  106.  
  107.  
  108. public class MainActivity extends AppCompatActivity implements View.OnClickListener {
  109.     private EditText etname;
  110.     private EditText etpass;
  111.     private TextView tve;
  112.  
  113.     @Override
  114.     protected void onCreate(Bundle savedInstanceState) {
  115.         super.onCreate(savedInstanceState);
  116.         setContentView(R.layout.activity_main);
  117.  
  118.         connectToLayout();
  119.     }
  120.  
  121.     private void connectToLayout() {
  122.         etname = (EditText) findViewById(R.id.etname);
  123.         etpass = (EditText) findViewById(R.id.etPassword);
  124.         tve = (TextView) findViewById(R.id.tverr);
  125.  
  126.  
  127.         findViewById(R.id.btnex).setOnClickListener(this);
  128.         findViewById(R.id.btnlog).setOnClickListener(this);
  129.         findViewById(R.id.btnreg).setOnClickListener(this);
  130.  
  131.     }
  132.  
  133.     @Override
  134.     public void onClick(View v) {
  135.         String userName = etname.getText().toString();
  136.         String password = etpass.getText().toString();
  137.         if (v.getId() == R.id.btnex) {
  138.             AlertDialog.Builder ad = new AlertDialog.Builder(this);
  139.             ad.setTitle("Are You Sure To Exit ?");
  140.             ad.setPositiveButton("Exit", new DialogInterface.OnClickListener() {
  141.                 @Override
  142.                 public void onClick(DialogInterface dialog, int which) {
  143.                     moveTaskToBack(true);
  144.                     android.os.Process.killProcess(android.os.Process.myPid());
  145.                     System.exit(1);
  146.                 }
  147.             });
  148.             ad.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
  149.                 @Override
  150.                 public void onClick(DialogInterface dialog, int which) {
  151.                     dialog.dismiss();
  152.                 }
  153.             });
  154.             ad.show();
  155.         }
  156.  
  157.         if (v.getId() == R.id.btnlog) {
  158.             tve.setText("");
  159.             userName = etname.getText().toString();
  160.             password = etpass.getText().toString();
  161.  
  162.             if (userName.length() == 0 || password.length() == 0) {
  163.                 tve.setText("Please Fill User Name And Password !");
  164.                 tve.setTextColor(Color.rgb(229, 6, 29));
  165.                 return;
  166.             } else if (userName.length() > 0 && password.length() > 0) {
  167.                 if (isValid(userName, password)) {
  168.                     if (!isTeacher(userName, password)) {
  169.                         Intent i = new Intent(this, StudentActivity.class);
  170.                         i.putExtra("CurrentUser", userName);
  171.                         startActivity(i);
  172.                         etname.setText("");
  173.                         etpass.setText("");
  174.                         tve.setText("");
  175.                     } else  if (isTeacher(userName, password)) {
  176.                         Intent i = new Intent(this, TeacherActivity.class);
  177.                         i.putExtra("CurrentUser", userName);
  178.                         startActivity(i);
  179.                         etname.setText("");
  180.                         etpass.setText("");
  181.                         tve.setText("");
  182.                     }
  183.                 } else {
  184.                     tve.setText("Wrong User Name Or Password !");
  185.                     tve.setTextColor(Color.rgb(229, 6, 29));
  186.                 }
  187.             }
  188.         }
  189.         if (v.getId() == R.id.btnreg) {
  190.             tve.setText("");
  191.             userName = etname.getText().toString();
  192.             password = etpass.getText().toString();
  193.  
  194.             if (userName.length() == 0 || password.length() == 0) {
  195.                 tve.setText("Please Fill User Name And Password !");
  196.                 tve.setTextColor(Color.rgb(229, 6, 29));
  197.                 return;
  198.             }
  199.  
  200.             if (!isUserExist(userName)) {
  201.                 addNewUser(userName, password);
  202.                 tve.setText("User Was Added !");
  203.                 tve.setTextColor(Color.rgb(88, 168, 77));
  204.                 etname.setText("");
  205.                 etpass.setText("");
  206.             } else {
  207.                 tve.setText("Error Adding The User " + userName + " !");
  208.                 tve.setTextColor(Color.rgb(229, 6, 29));
  209.             }
  210.         }
  211.  
  212.     }
  213.  
  214.     private boolean isTeacher(String userName, String password) {
  215.         if (userName.substring(0, 1).equals("T")  && password.substring(0, 2).equals("00") && password.substring(password.length() - 2).equals("00")) {
  216.             return true;
  217.         }
  218.         return false;
  219.     }
  220.  
  221.  
  222.     private boolean isValid(String userName, String password) {
  223.  
  224.         SharedPreferences prefs = this.getSharedPreferences("myUsers", Context.MODE_PRIVATE);
  225.  
  226.         String savedPassword = prefs.getString(userName, "");
  227.  
  228.         return (savedPassword.equals(password));
  229.     }
  230.  
  231.     private boolean addNewUser(String userName, String password) {
  232.         SharedPreferences prefs = this.getSharedPreferences("myUsers", Context.MODE_PRIVATE);
  233.         SharedPreferences.Editor editor = prefs.edit();
  234.         editor.putString(userName, password);
  235.         return editor.commit();
  236.     }
  237.  
  238.     private boolean isUserExist(String userName) {
  239.         SharedPreferences prefs = this.getSharedPreferences("myUsers", Context.MODE_PRIVATE);
  240.         String savedPassword = prefs.getString(userName, "");
  241.         return (!savedPassword.equals(""));
  242.     }
  243.  
  244. }
  245.  
  246.  
  247. person.class
  248. =============
  249. package com.example.user.webtop;
  250.  
  251. /**
  252.  * Created by user on 20/10/2017.
  253.  */
  254.  
  255. public class person {
  256.  
  257.     private String name;
  258.     private String mark;
  259.  
  260.     public person(String name, String mark){
  261.         this.name=name;
  262.         this.mark=mark;
  263.     }
  264.     public String getName() {
  265.         return name;
  266.     }
  267.  
  268.     public void setName(String name) {
  269.         this.name = name;
  270.     }
  271.  
  272.     public String getMark() {
  273.         return mark;
  274.     }
  275.  
  276.     public void setMark(String mark) {
  277.         this.mark = mark;
  278.     }
  279. }
  280.  
  281. personAdapter.class
  282. ====================
  283. package com.example.user.webtop;
  284.  
  285. import android.content.Context;
  286. import android.view.LayoutInflater;
  287. import android.view.View;
  288. import android.view.ViewGroup;
  289. import android.widget.BaseAdapter;
  290. import android.widget.TextView;
  291.  
  292. import java.util.List;
  293.  
  294. /**
  295.  * Created by user on 20/10/2017.
  296.  */
  297.  
  298. public class PersonAdapter extends BaseAdapter {
  299.    private Context context;
  300.     private List<person> personsList;
  301.  
  302.     public PersonAdapter(Context context, List<person> personsList){
  303.         this.context=context;
  304.         this.personsList=personsList;
  305.     }
  306.  
  307.     @Override
  308.     public int getCount() {
  309.         return this.personsList.size();
  310.     }
  311.  
  312.     @Override
  313.     public Object getItem(int position) {
  314.         return personsList.get(position);
  315.     }
  316.  
  317.     @Override
  318.     public long getItemId(int position) {
  319.         return position;
  320.     }
  321.  
  322.     @Override
  323.     public View getView(int position, View convertView, ViewGroup parent) {
  324.         View myView = LayoutInflater.from(context).inflate(R.layout.studentshow, null);
  325.         final person ps = personsList.get(position);
  326.         ((TextView) myView.findViewById(R.id.StudentsesName)).setText(ps.getName());
  327.         ((TextView) myView.findViewById(R.id.studentGrade)).setText(ps.getMark());
  328.         return myView;
  329.     }
  330. }
  331. StudentActiviy.java
  332. ===============
  333. package com.example.user.webtop;
  334.  
  335. import android.content.Context;
  336. import android.content.SharedPreferences;
  337. import android.support.v7.app.AppCompatActivity;
  338. import android.os.Bundle;
  339. import android.view.View;
  340. import android.widget.ArrayAdapter;
  341. import android.widget.Button;
  342. import android.widget.ListView;
  343. import android.widget.TextView;
  344. import android.widget.Toast;
  345.  
  346. import java.util.ArrayList;
  347. import java.util.List;
  348.  
  349. public class StudentActivity extends AppCompatActivity implements View.OnClickListener {
  350.  
  351.     private TextView tvname;
  352.     private TextView Clases;
  353.     private String snames;
  354.     private ListView lsvGrades;
  355.  
  356.     private Button btn;
  357.     List<person> lst;
  358.     Context context;
  359.  
  360.     @Override
  361.     protected void onCreate(Bundle savedInstanceState) {
  362.         super.onCreate(savedInstanceState);
  363.         setContentView(R.layout.activity_student);
  364.         btn = (Button) findViewById(R.id.btnExist);
  365.         tvname = (TextView) findViewById(R.id.Names);
  366.         Clases = (TextView) findViewById(R.id.Classes);
  367.         snames = getIntent().getStringExtra("CurrentUser");
  368.         lsvGrades = (ListView) findViewById(R.id.lsvGrades);
  369.         this.context = this;
  370.  
  371.         btn.setOnClickListener(this);
  372.         tvname.setText(snames);
  373.  
  374.         lst = loadFromFile();
  375.         PersonAdapter myAdapter = new PersonAdapter(context, lst);
  376.         lsvGrades.setAdapter(myAdapter);
  377.     }
  378.     private List<person> loadFromFile() {
  379.         SharedPreferences myfile = this.getSharedPreferences("MyPersons", Context.MODE_PRIVATE);
  380.         Object[] keys = myfile.getAll().keySet().toArray();
  381.         List<person> lst = new ArrayList<>();
  382.         for (int i = 0; i < keys.length; i += 1) {
  383.             String namesubject = (String) keys[i];
  384.             String[] ss = namesubject.split("\\|");
  385.             if (ss[1].equals(snames)) {
  386.                 lst.add(new person(ss[3], ss[2]));
  387.                 Clases.setText(ss[0]);
  388.             }
  389.         }
  390.  
  391.         return lst;
  392.     }
  393.  
  394.     @Override
  395.     public void onClick(View v) {
  396. this.finish();
  397.     }
  398. }
  399.  
  400. Activity_student.xml
  401. =====================
  402. <?xml version="1.0" encoding="utf-8"?>
  403. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  404.     android:layout_width="match_parent"
  405.     android:layout_height="match_parent"
  406.     android:orientation="vertical">
  407.     <Button
  408.         android:id="@+id/btnExist"
  409.         android:layout_width="match_parent"
  410.         android:layout_height="wrap_content"
  411.         android:background="#00acff"
  412.         android:text="Exit"
  413.         android:textSize="22sp" />
  414.     <LinearLayout
  415.         android:layout_width="wrap_content"
  416.         android:layout_height="wrap_content"
  417.         android:orientation="horizontal">
  418.         <TextView
  419.         android:id="@+id/Names"
  420.         android:layout_width="wrap_content"
  421.         android:layout_height="match_parent"
  422.         android:gravity="right"
  423.             android:text="aaa"
  424.             android:textColor="#ff8cd1"
  425.         android:layout_marginTop="15dp"
  426.         android:textSize="22sp" />
  427.         <TextView
  428.             android:layout_width="match_parent"
  429.             android:layout_height="wrap_content"
  430.             android:gravity="center"
  431.             android:text="                        "
  432.             android:textColor="#ff8cd1"
  433.             android:layout_marginTop="15dp"
  434.             android:textSize="22sp" />
  435.     <TextView
  436.         android:id="@+id/Classes"
  437.         android:layout_width="match_parent"
  438.         android:layout_height="wrap_content"
  439.         android:gravity="left"
  440.         android:text="aaa"
  441.         android:textColor="#ff8cd1"
  442.         android:layout_marginTop="15dp"
  443.         android:textSize="22sp" />
  444.     </LinearLayout>
  445.     <ListView
  446.         android:id="@+id/lsvGrades"
  447.         android:layout_width="match_parent"
  448.         android:layout_height="wrap_content"> </ListView>
  449.     <TextView
  450.         android:layout_width="match_parent"
  451.         android:layout_height="wrap_content"
  452.         android:gravity="center"
  453.         android:textSize="22sp" />
  454.  
  455. </LinearLayout>
  456.  
  457. Teacher.class
  458. ==============
  459. package com.example.user.webtop;
  460.  
  461. /**
  462.  * Created by user on 19/10/2017.
  463.  */
  464.  
  465. public class Teacher {
  466.     private String Subject;
  467.     private String Clases;
  468.  
  469.  
  470.     public Teacher(String Subject, String Clases) {
  471.         this.Subject = Subject;
  472.         this.Clases = Clases;
  473.     }
  474.  
  475.     public String getSubject() {
  476.         return Subject;
  477.     }
  478.  
  479.     public String getClases() {
  480.         return Clases;
  481.     }
  482.  
  483.     public void setName(String Subject) {
  484.         this.Subject = Subject;
  485.     }
  486.  
  487.     public void setClases(String Clases) {
  488.         this.Clases = Clases;
  489.     }
  490.  
  491. }
  492. TeacherAdapter.class
  493. ====================
  494. package com.example.user.webtop;
  495. import android.content.Context;
  496. import android.view.LayoutInflater;
  497. import android.view.View;
  498. import android.view.ViewGroup;
  499. import android.widget.BaseAdapter;
  500. import android.widget.TextView;
  501. import java.util.List;
  502.  
  503. public class TeacherAdapter extends BaseAdapter {
  504.  
  505.     private Context context;
  506.     private List<Teacher> TeachersList;
  507.  
  508.     public TeacherAdapter(List<Teacher> TeachersList, Context context) {
  509.         this.TeachersList = TeachersList;
  510.         this.context = context;
  511.     }
  512.  
  513.     @Override
  514.     public int getCount() {
  515.         return this.TeachersList.size();
  516.     }
  517.  
  518.     @Override
  519.     public Object getItem(int position) {
  520.         return TeachersList.get(position);    }
  521.  
  522.     @Override
  523.     public long getItemId(int position) {
  524.         return 0;
  525.     }
  526.  
  527.     @Override
  528.     public View getView(int position, View convertView, ViewGroup parent) {
  529.         View myView = LayoutInflater.from(context).inflate(R.layout.list_row_layout, null);
  530.         final Teacher teacher = TeachersList.get(position);
  531.         ((TextView) myView.findViewById(R.id.tvsubject)).setText(teacher.getSubject());
  532.         ((TextView) myView.findViewById(R.id.tvclases)).setText(teacher.getClases());
  533.         return myView;
  534.     }
  535. }
  536. TeacherActivity.java
  537. ====================
  538. package com.example.user.webtop;
  539.  
  540. import android.content.Context;
  541. import android.content.DialogInterface;
  542. import android.content.Intent;
  543. import android.content.SharedPreferences;
  544. import android.support.v7.app.AlertDialog;
  545. import android.support.v7.app.AppCompatActivity;
  546. import android.os.Bundle;
  547. import android.view.View;
  548. import android.widget.AdapterView;
  549. import android.widget.Button;
  550. import android.widget.EditText;
  551. import android.widget.ListView;
  552. import android.widget.TextView;
  553. import android.widget.Toast;
  554.  
  555. import java.util.ArrayList;
  556. import java.util.List;
  557.  
  558. public class TeacherActivity extends AppCompatActivity implements View.OnClickListener {
  559.     private TextView tvteachername;
  560.     private String teachername;
  561.     private EditText etٍNewSubject;
  562.     private EditText etNewGrade;
  563.     private Button btnAddItem;
  564.     private Button btnExit;
  565.     private ListView lsvTeachers;
  566.     List<Teacher> lst;
  567.     Context context;
  568.  
  569.     @Override
  570.     protected void onCreate(Bundle savedInstanceState) {
  571.         super.onCreate(savedInstanceState);
  572.         setContentView(R.layout.activity_teacher);
  573.  
  574.         tvteachername = (TextView) findViewById(R.id.tvteachername);
  575.         teachername = getIntent().getStringExtra("CurrentUser");
  576.  
  577.         tvteachername.setText(teachername.substring(1, teachername.length()));
  578.  
  579.         this.context = this;
  580.         etٍNewSubject = (EditText) findViewById(R.id.etٍNewSubject);
  581.         etNewGrade = (EditText) findViewById(R.id.etNewGrade);
  582.  
  583.         btnAddItem = (Button) findViewById(R.id.btnAddTeacher);
  584.         btnExit = (Button) findViewById(R.id.btnExit);
  585.         lsvTeachers = (ListView) findViewById(R.id.lsvItems);
  586.         btnAddItem.setOnClickListener(this);
  587.         btnExit.setOnClickListener(this);
  588.  
  589.         lst = loadFromFile();
  590.         TeacherAdapter myAdapter = new TeacherAdapter(lst, this);
  591.         lsvTeachers.setAdapter(myAdapter);
  592.  
  593.         lsvTeachers.setOnItemClickListener(new AdapterView.OnItemClickListener() {
  594.             @Override
  595.             public void onItemClick(AdapterView<?> parent, View view, final int position, long id) {
  596.                 final AlertDialog.Builder Dialoga = new AlertDialog.Builder(context);
  597.                 Dialoga.setTitle("U Want To Edit " + lst.get(position).getSubject() + " Subject, " + lst.get(position).getClases() + " Class Marks ?");
  598.                 Dialoga.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
  599.                     @Override
  600.                     public void onClick(DialogInterface dialog, int which) {
  601.                         Intent i = new Intent(context, ClassActivity.class);
  602.                         i.putExtra("SubjectName", (String) lst.get(position).getSubject());
  603.                         i.putExtra("ClassName", (String) lst.get(position).getClases());
  604.                         i.putExtra("TeacherName", teachername);
  605.  
  606.                         startActivity(i);
  607.                         lsvTeachers.setAdapter(new TeacherAdapter(lst, context));
  608.                     }
  609.                 });
  610.                 Dialoga.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
  611.                     @Override
  612.                     public void onClick(DialogInterface dialog, int which) {
  613.                         dialog.dismiss();
  614.                     }
  615.                 });
  616.                 Dialoga.show();
  617.             }
  618.         });
  619.  
  620.         lsvTeachers.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
  621.             @Override
  622.             public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
  623.                 final String SubjectForRemove = (String) lst.get(position).getSubject();
  624.                 final String clasesForRemove = (String) lst.get(position).getClases();
  625.                 final AlertDialog.Builder Dialoga = new AlertDialog.Builder(context);
  626.                 Dialoga.setTitle("U Want To Delete The " + SubjectForRemove + " Subject, " + clasesForRemove + " Class ?");
  627.                 Dialoga.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
  628.                     @Override
  629.                     public void onClick(DialogInterface dialog, int which) {
  630.                         SharedPreferences myfile = context.getSharedPreferences("MyTeachers", Context.MODE_PRIVATE);
  631.                         myfile.edit().remove(teachername + "|" + SubjectForRemove + "|" + clasesForRemove).commit();
  632.                         lst = loadFromFile();
  633.                         lsvTeachers.setAdapter(new TeacherAdapter(lst, context));
  634.                     }
  635.                 });
  636.                 Dialoga.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
  637.                     @Override
  638.                     public void onClick(DialogInterface dialog, int which) {
  639.                         dialog.dismiss();
  640.                     }
  641.                 });
  642.                 Dialoga.show();
  643.  
  644.  
  645.                 return false;
  646.             }
  647.         });
  648.     }
  649.  
  650.     @Override
  651.     public void onClick(View v) {
  652.         if (v.getId() == R.id.btnAddTeacher) {
  653.             String newSubjectName = etٍNewSubject.getText().toString();
  654.             String newClassName = etNewGrade.getText().toString();
  655.  
  656.             if (!newSubjectName.isEmpty() && !newClassName.isEmpty()) {
  657.                 // add the item
  658.                 SharedPreferences myfile = this.getSharedPreferences("MyTeachers", Context.MODE_PRIVATE);
  659.                 String oldclassandsubject = myfile.getString(teachername + "|" + newSubjectName + "|" + newClassName, "");
  660.  
  661.  
  662.                 Object[] keys = myfile.getAll().keySet().toArray();
  663.                 int c = 0;
  664.                 for (int i = 0; i < keys.length; i += 1) {
  665.                     String namesubject = (String) keys[i];
  666.                     String[] ss = namesubject.split("\\|");
  667.                     if (oldclassandsubject.equals("") && (ss[1].toString().equals(newSubjectName) == false && ss[2].toString().equals(newClassName) == false) || (ss[1].toString().equals(newSubjectName) == true && ss[2].toString().equals(newClassName) == false) || (ss[1].toString().equals(newSubjectName) == false && ss[2].toString().equals(newClassName) == true)) {
  668.                         c++;
  669.                     }
  670.                 }
  671.  
  672.                 if (keys.length == c)
  673.                     myfile.edit().putString(teachername + "|" + newSubjectName + "|" + newClassName, "1").commit();
  674.                 if (keys.length > c)
  675.                     Toast.makeText(this, "The Teacher Of The " + newSubjectName + ", Of " + newClassName + " Class, Found In The System!", Toast.LENGTH_LONG).show();
  676.  
  677.  
  678.                 // update the list
  679.                 lst = loadFromFile();
  680.                 lsvTeachers.setAdapter(new TeacherAdapter(lst, this));
  681.                 etٍNewSubject.setText("");
  682.                 etNewGrade.setText("");
  683.             }
  684.         }
  685.         if (v.getId() == R.id.btnExit) {
  686.             this.finish();
  687.         }
  688.  
  689.  
  690.         }
  691.  
  692.     private List<Teacher> loadFromFile() {
  693.         SharedPreferences myfile = this.getSharedPreferences("MyTeachers", Context.MODE_PRIVATE);
  694.         Object[] keys = myfile.getAll().keySet().toArray();
  695.         List<Teacher> lst = new ArrayList<>();
  696.         for (int i = 0; i < keys.length; i += 1) {
  697.             String namesubject = (String) keys[i];
  698.             String[] ss = namesubject.split("\\|");
  699.             if (ss[0].equals(teachername)) {
  700.                 lst.add(new Teacher(ss[1], ss[2]));
  701.             }
  702.         }
  703.         return lst;
  704.     }
  705.  
  706. }
  707. Activity_Teacher.xml
  708. ====================
  709. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  710.     android:layout_width="match_parent"
  711.     android:layout_height="match_parent"
  712.     android:orientation="vertical">
  713.     <LinearLayout
  714.         android:layout_width="match_parent"
  715.         android:layout_height="wrap_content"
  716.         android:orientation="horizontal">
  717.         <Button
  718.             android:id="@+id/btnExit"
  719.             android:layout_width="match_parent"
  720.             android:layout_height="wrap_content"
  721.             android:background="#ff8cd1"
  722.             android:text="Exit"
  723.             android:textSize="22sp" />
  724.     </LinearLayout>
  725.     <LinearLayout
  726.         android:layout_width="match_parent"
  727.         android:layout_height="wrap_content"
  728.         android:orientation="horizontal">
  729.  
  730.         <TextView
  731.             android:id="@+id/tvteachername"
  732.             android:layout_width="match_parent"
  733.             android:layout_height="wrap_content"
  734.             android:layout_weight="2"
  735.             android:gravity="center"
  736.             android:textColor="#00acff"
  737.             android:textSize="22sp" />
  738.     </LinearLayout>
  739.  
  740.     <LinearLayout
  741.         android:layout_width="match_parent"
  742.         android:layout_height="wrap_content"
  743.         android:orientation="horizontal">
  744.  
  745.         <EditText
  746.             android:id="@+id/etٍNewSubject"
  747.             android:layout_width="match_parent"
  748.             android:layout_height="wrap_content"
  749.             android:layout_weight="2"
  750.             android:hint="Subject"
  751.             android:textSize="22sp" />
  752.  
  753.         <EditText
  754.             android:id="@+id/etNewGrade"
  755.             android:layout_width="match_parent"
  756.             android:layout_height="wrap_content"
  757.             android:layout_weight="2"
  758.             android:inputType="number"
  759.             android:hint="Class"
  760.             android:textSize="22sp" />
  761.  
  762.         <Button
  763.             android:id="@+id/btnAddTeacher"
  764.             android:layout_width="match_parent"
  765.             android:layout_height="wrap_content"
  766.             android:layout_weight="2"
  767.             android:background="#ff8cd1"
  768.             android:text="Add"
  769.             android:textSize="22sp" />
  770.     </LinearLayout>
  771.  
  772.     <ListView
  773.         android:id="@+id/lsvItems"
  774.         android:layout_width="match_parent"
  775.         android:layout_height="wrap_content"
  776.         android:choiceMode="singleChoice"></ListView>
  777. </LinearLayout>
  778.  
  779. ClassActivity.java
  780. ===================
  781. package com.example.user.webtop;
  782.  
  783. import android.app.AlertDialog;
  784. import android.content.Context;
  785. import android.content.DialogInterface;
  786. import android.content.Intent;
  787. import android.content.SharedPreferences;
  788. import android.support.v7.app.AppCompatActivity;
  789. import android.os.Bundle;
  790. import android.view.LayoutInflater;
  791. import android.view.View;
  792. import android.widget.AdapterView;
  793. import android.widget.Button;
  794. import android.widget.EditText;
  795. import android.widget.ListView;
  796. import android.widget.TextView;
  797. import android.widget.Toast;
  798.  
  799. import java.util.ArrayList;
  800. import java.util.List;
  801.  
  802. public class ClassActivity extends AppCompatActivity implements View.OnClickListener {
  803.  
  804.     private String TeachersNames;
  805.     private String SubjectsNames;
  806.     private String ClasesNames;
  807.     private TextView tvTeachers;
  808.     private TextView tvSubjects;
  809.     private TextView tvClaases;
  810.     private EditText etٍNewStudent;
  811.     private EditText etNewMark;
  812.     private Button btnAddStudent;
  813.     private Button btnExits;
  814.     private Button btnpre;
  815.     private ListView lsvPersons;
  816.     List<person> lst;
  817.     Context context;
  818.     int c = 0;
  819.  
  820.     @Override
  821.     protected void onCreate(Bundle savedInstanceState) {
  822.         super.onCreate(savedInstanceState);
  823.         setContentView(R.layout.activity_class);
  824.  
  825.         tvTeachers = (TextView) findViewById(R.id.tvTeacherNames);
  826.         tvSubjects = (TextView) findViewById(R.id.tvSubjectsesNames);
  827.         tvClaases = (TextView) findViewById(R.id.tvClaasesNames);
  828.         etٍNewStudent = (EditText) findViewById(R.id.etStudentName);
  829.         etNewMark = (EditText) findViewById(R.id.etStudentMark);
  830.         btnAddStudent = (Button) findViewById(R.id.btnAddStudent);
  831.         btnExits = (Button) findViewById(R.id.btnExits);
  832.         btnpre = (Button) findViewById(R.id.btnPrevius);
  833.         lsvPersons = (ListView) findViewById(R.id.lsvStudents);
  834.  
  835.         lst = new ArrayList<>();
  836.         this.context = this;
  837.  
  838.         TeachersNames = getIntent().getStringExtra("TeacherName");
  839.         SubjectsNames = getIntent().getStringExtra("SubjectName");
  840.         ClasesNames = getIntent().getStringExtra("ClassName");
  841.         tvTeachers.setText(TeachersNames.substring(1, TeachersNames.length()));
  842.         tvSubjects.setText(SubjectsNames);
  843.         tvClaases.setText(ClasesNames);
  844.  
  845.         btnAddStudent.setOnClickListener(this);
  846.         btnExits.setOnClickListener(this);
  847.         btnpre.setOnClickListener(this);
  848.  
  849.         lst = loadFromFile();
  850.         PersonAdapter pa = new PersonAdapter(context, lst);
  851.         lsvPersons.setAdapter(pa);
  852.  
  853.         lsvPersons.setOnItemClickListener(new AdapterView.OnItemClickListener() {
  854.             @Override
  855.             public void onItemClick(AdapterView<?> parent, View view, final int position, long id) {
  856.                 final AlertDialog.Builder myDialog = new AlertDialog.Builder(context);
  857.                 final View myView = LayoutInflater.from(context).inflate(R.layout.mark_update, null);
  858.                 myDialog.setView(myView);
  859.                 myDialog.setTitle("Update Mark");
  860.                 myDialog.setPositiveButton("OK", new DialogInterface.OnClickListener() {
  861.                     @Override
  862.                     public void onClick(DialogInterface dialog, int which) {
  863.                         String inputDatas = ((EditText) myView.findViewById(R.id.etNewMark)).getText().toString();
  864.                         if (!inputDatas.isEmpty() && Integer.parseInt(inputDatas) > 19 && Integer.parseInt(inputDatas) <= 100) {
  865.                             int newMark = Integer.parseInt(inputDatas);
  866.                             String itemName = lst.get(position).getName();
  867.                             SharedPreferences myfiles = context.getSharedPreferences("MyPersons", Context.MODE_PRIVATE);
  868.                             if (!lst.get(position).getMark().equals("")) {
  869.                                 Object[] keys = myfiles.getAll().keySet().toArray();
  870.                                 for (int i = 0; i < keys.length; i += 1) {
  871.                                     String personName = (String) keys[i];
  872.                                     String[] ss = personName.split("\\|");
  873.                                     if (ss[0].equals(ClasesNames) && ss[1].equals(itemName) && ss[3].equals(SubjectsNames) && ss[4].equals(TeachersNames) && !ss[2].equals("")) {
  874.                                         myfiles.edit().remove(ClasesNames + "|" + itemName + "|" + ss[2] + "|" + SubjectsNames + "|" + TeachersNames).commit();
  875.                                         myfiles.edit().putString(ClasesNames + "|" + itemName + "|" + inputDatas + "|" + SubjectsNames + "|" + TeachersNames, "1").commit();
  876.                                         lst = loadFromFile();
  877.                                         lsvPersons.setAdapter(new PersonAdapter(context, lst));
  878.                                     }
  879.                                 }
  880.                             }
  881.                             if (lst.get(position).getMark().equals("")) {
  882.                                 myfiles.edit().putString((ClasesNames + "|" + itemName + "|" + inputDatas + "|" + SubjectsNames + "|" + TeachersNames), "1").commit();
  883.                                 lst.remove(position);
  884.                                 lst = loadFromFile();
  885.                                 lsvPersons.setAdapter(new PersonAdapter(context, lst));
  886.                             }
  887.                         }
  888.                         lst = loadFromFile();
  889.                         lsvPersons.setAdapter(new PersonAdapter(context, lst));
  890.                         dialog.cancel();
  891.                     }
  892.  
  893.                 });
  894.                 myDialog.show();
  895.             }
  896.         });
  897.  
  898.         lsvPersons.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
  899.             @Override
  900.             public boolean onItemLongClick(AdapterView<?> parent, View view, final int position, long id) {
  901.  
  902.                 final String MarkForRemove = (String) lst.get(position).getMark();
  903.                 final String NameForRemove = (String) lst.get(position).getName();
  904.                 final android.support.v7.app.AlertDialog.Builder Dialoga = new android.support.v7.app.AlertDialog.Builder(context);
  905.                 Dialoga.setTitle("U Want To Delete The " + NameForRemove + " Student, " + MarkForRemove + " Mark ?");
  906.                 Dialoga.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
  907.                     @Override
  908.                     public void onClick(DialogInterface dialog, int which) {
  909.                         SharedPreferences myfile = context.getSharedPreferences("MyPersons", Context.MODE_PRIVATE);
  910.                         myfile.edit().remove(ClasesNames + "|" + lst.get(position).getName() + "|" + lst.get(position).getMark() + "|" + SubjectsNames + "|" + TeachersNames).commit();
  911.                         lst = loadFromFile();
  912.                         lsvPersons.setAdapter(new PersonAdapter(context, lst));
  913.                     }
  914.                 });
  915.                 Dialoga.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
  916.                     @Override
  917.                     public void onClick(DialogInterface dialog, int which) {
  918.                         dialog.dismiss();
  919.                     }
  920.                 });
  921.                 Dialoga.show();
  922.  
  923.  
  924.                 return false;
  925.             }
  926.         });
  927.  
  928.     }
  929.  
  930.     @Override
  931.     public void onClick(View v) {
  932.         lst = loadFromFile();
  933.  
  934.         if (v.getId() == R.id.btnAddStudent) {
  935.             lst = loadFromFile();
  936.  
  937.             boolean flag = false;
  938.  
  939.             String newPersonName = etٍNewStudent.getText().toString();
  940.             String newPersonMark = etNewMark.getText().toString();
  941.             if (!newPersonName.isEmpty() && !newPersonMark.isEmpty() && Integer.parseInt(newPersonMark) > 19 && Integer.parseInt(newPersonMark) <= 100) {
  942.                 SharedPreferences myfile = this.getSharedPreferences("MyPersons", Context.MODE_PRIVATE);
  943.                 String classnamemarksubjectteacher = myfile.getString(ClasesNames + "|" + newPersonName + "|" + newPersonMark + "|" + SubjectsNames + "|" + TeachersNames, "");
  944.                 SharedPreferences mf = context.getSharedPreferences("MyPersons", Context.MODE_PRIVATE);
  945.                 Object[] keys = mf.getAll().keySet().toArray();
  946.                 for (int i = 0; i < keys.length; i += 1) {
  947.                     String personName = (String) keys[i];
  948.                     String[] ss = personName.split("\\|");
  949.  
  950.                     if (ss[1].equals(newPersonName) && !ss[0].equals(ClasesNames) && isUserFound(newPersonName)) {
  951.                         Toast.makeText(this, "The Student, " + newPersonName + " Is Avalibale In Another Class !", Toast.LENGTH_LONG).show();
  952.                         flag = true;
  953.  
  954.                     } else if (ss[1].equals(newPersonName) && ss[0].equals(ClasesNames) && isUserFound(newPersonName) && isUserNotFoundInTheList(newPersonName)) {
  955.                         myfile.edit().putString(ClasesNames + "|" + newPersonName + "|" + newPersonMark + "|" + SubjectsNames + "|" + TeachersNames, "1").commit();
  956.                         flag = true;
  957.                     } else if (ss[1].equals(newPersonName) && ss[0].equals("") && isUserFound(newPersonName) && isUserNotFoundInTheList(newPersonName)) {
  958.                         myfile.edit().putString(ClasesNames + "|" + newPersonName + "|" + newPersonMark + "|" + SubjectsNames + "|" + TeachersNames, "1").commit();
  959.                         flag = true;
  960.  
  961.                     }
  962.                 }
  963.                 if (isUserFound(newPersonName) && flag == false && isUserNotFoundInTheList(newPersonName)) {
  964.                     myfile.edit().putString(ClasesNames + "|" + newPersonName + "|" + newPersonMark + "|" + SubjectsNames + "|" + TeachersNames, "1").commit();
  965.                     flag = false;
  966.                 }
  967.                 if (!isUserFound(newPersonName))
  968.                     Toast.makeText(this, "The Student " + newPersonName + " Is Not Avalibale In The System, Or It's A Teacher Please Check It !", Toast.LENGTH_LONG).show();
  969.                 lst = loadFromFile();
  970.                 lsvPersons.setAdapter(new PersonAdapter(this, lst));
  971.                 etٍNewStudent.setText("");
  972.                 etNewMark.setText("");
  973.             } else {
  974.                 Toast.makeText(this, "Some Thing Is Illegal, Please Check The Student Name And The Mark !", Toast.LENGTH_LONG).show();
  975.             }
  976.         }
  977.         if (v.getId() == R.id.btnExits) {
  978.             lst = loadFromFile();
  979.  
  980.             Intent i = new Intent(this, MainActivity.class);
  981.             this.finish();
  982.             startActivity(i);
  983.         }
  984.  
  985.         if (v.getId() == R.id.btnPrevius) {
  986.             lst = loadFromFile();
  987.  
  988.             this.finish();
  989.         }
  990.  
  991.  
  992.     }
  993.  
  994.  
  995.  
  996.  
  997.     private boolean isUserFound(String userName) {
  998.         SharedPreferences prefs = this.getSharedPreferences("myUsers", Context.MODE_PRIVATE);
  999.         String savedPassword = prefs.getString(userName, "");
  1000.         if ((!savedPassword.equals("")) && isNotTeacher(userName))
  1001.             return true;
  1002.         return false;
  1003.     }
  1004.  
  1005.     private boolean isNotTeacher(String userName) {
  1006.         SharedPreferences prefs = this.getSharedPreferences("myUsers", Context.MODE_PRIVATE);
  1007.         String savedPassword = prefs.getString(userName, "");
  1008.         if (!userName.substring(0, 1).equals("T") || !savedPassword.substring(0, 2).equals("00") ||
  1009.                 !savedPassword.substring(savedPassword.length() - 2).equals("00"))
  1010.             return true;
  1011.         return false;
  1012.     }
  1013.  
  1014.     private List<person> loadFromFile() {
  1015.         SharedPreferences myfile = this.getSharedPreferences("MyPersons", Context.MODE_PRIVATE);
  1016.         Object[] keys = myfile.getAll().keySet().toArray();
  1017.         List<person> lsts = new ArrayList<>();
  1018.  
  1019.         for (int i = 0; i < keys.length; i += 1) {
  1020.             String personName = (String) keys[i];
  1021.             String[] ss = personName.split("\\|");
  1022.  
  1023.  
  1024.             if (ss[0].equals(ClasesNames)) {
  1025.                 if (ss[3].equals(SubjectsNames) && ss[4].equals(TeachersNames)) {
  1026.                     lsts.add(new person(ss[1], ss[2]));
  1027.  
  1028.                 }
  1029.  
  1030.             }
  1031.         }
  1032.  
  1033.         return lsts;
  1034.     }
  1035.  
  1036.     private boolean isUserNotFoundInTheList(String personname){
  1037.  
  1038.         for (int i = 0 ; i <lst.size(); i++){
  1039.             if (lst.get(i).getName().equals(personname)) return false;
  1040.         }
  1041.  
  1042.         return true;
  1043.     }
  1044.  
  1045. }
  1046. Activity_class.xml
  1047. ===================
  1048. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  1049.     android:layout_width="match_parent"
  1050.     android:layout_height="match_parent"
  1051.     android:background="#f7fcff"
  1052.     android:orientation="vertical">
  1053.     <LinearLayout
  1054.         android:layout_width="match_parent"
  1055.         android:layout_height="wrap_content"
  1056.         android:orientation="horizontal">
  1057.         <Button
  1058.             android:id="@+id/btnExits"
  1059.             android:layout_width="match_parent"
  1060.             android:layout_height="wrap_content"
  1061.             android:background="#ff8cd1"
  1062.             android:layout_weight="2"
  1063.             android:text="Exit"
  1064.             android:textSize="22sp" />
  1065.         <Button
  1066.             android:id="@+id/btnPrevius"
  1067.             android:layout_width="match_parent"
  1068.             android:layout_height="wrap_content"
  1069.             android:background="#00acff"
  1070.             android:layout_weight="2"
  1071.             android:text="Previous"
  1072.             android:textSize="22sp" />
  1073.     </LinearLayout>
  1074.     <LinearLayout
  1075.         android:layout_width="match_parent"
  1076.         android:layout_height="wrap_content"
  1077.         android:orientation="horizontal">
  1078.  
  1079.         <TextView
  1080.             android:id="@+id/tvTeacherNames"
  1081.             android:layout_width="match_parent"
  1082.             android:layout_height="match_parent"
  1083.             android:layout_marginTop="15dp"
  1084.             android:layout_weight="1"
  1085.             android:textColor="#ff8cd1"
  1086.             android:textSize="22sp" />
  1087.  
  1088.         <TextView
  1089.             android:id="@+id/tvSubjectsesNames"
  1090.             android:layout_width="match_parent"
  1091.             android:layout_height="match_parent"
  1092.             android:layout_marginTop="15dp"
  1093.             android:layout_weight="1"
  1094.             android:textColor="#00acff"
  1095.             android:textSize="22sp" />
  1096.  
  1097.         <TextView
  1098.             android:id="@+id/tvClaasesNames"
  1099.             android:layout_width="match_parent"
  1100.             android:layout_height="match_parent"
  1101.             android:layout_marginTop="15dp"
  1102.             android:layout_weight="1"
  1103.             android:textColor="#ff8cd1"
  1104.             android:textSize="22sp" />
  1105.     </LinearLayout>
  1106.  
  1107.  
  1108.     <LinearLayout
  1109.         android:layout_width="match_parent"
  1110.         android:layout_height="wrap_content"
  1111.         android:orientation="horizontal">
  1112.  
  1113.         <EditText
  1114.             android:id="@+id/etStudentName"
  1115.             android:layout_width="match_parent"
  1116.             android:layout_height="wrap_content"
  1117.             android:layout_weight="2"
  1118.             android:hint="Name"
  1119.             android:textSize="22sp" />
  1120.  
  1121.         <EditText
  1122.             android:id="@+id/etStudentMark"
  1123.             android:layout_width="match_parent"
  1124.             android:layout_height="wrap_content"
  1125.             android:inputType="number"
  1126.             android:layout_weight="2"
  1127.             android:hint="Mark"
  1128.             android:textSize="22sp" />
  1129.  
  1130.         <Button
  1131.             android:id="@+id/btnAddStudent"
  1132.             android:layout_width="match_parent"
  1133.             android:layout_height="wrap_content"
  1134.             android:layout_weight="2"
  1135.             android:background="#ff8cd1"
  1136.             android:text="Add"
  1137.             android:textSize="22sp" />
  1138.     </LinearLayout>
  1139.     <ListView
  1140.         android:id="@+id/lsvStudents"
  1141.         android:layout_width="match_parent"
  1142.         android:layout_height="wrap_content"
  1143.         android:choiceMode="singleChoice"></ListView>
  1144.     <TextView
  1145.         android:layout_width="match_parent"
  1146.         android:layout_height="wrap_content"
  1147.         android:gravity="center"
  1148.         android:textColor="#00acff"
  1149.         android:textSize="22sp" />
  1150. </LinearLayout>
  1151.  
  1152. list_row_layout.xml
  1153. ===================
  1154. <?xml version="1.0" encoding="utf-8"?>
  1155. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  1156.     android:layout_width="match_parent"
  1157.     android:layout_height="wrap_content"
  1158.     android:background="#00acff"
  1159.     android:orientation="horizontal">
  1160.  
  1161.     <TextView
  1162.         android:id="@+id/tvsubject"
  1163.         android:layout_width="match_parent"
  1164.         android:layout_height="wrap_content"
  1165.         android:layout_weight="1"
  1166.         android:textColor="#FFFFFF"
  1167.         android:textSize="22sp" />
  1168.  
  1169.     <TextView
  1170.         android:id="@+id/tvclases"
  1171.         android:layout_width="match_parent"
  1172.         android:layout_height="wrap_content"
  1173.         android:layout_weight="1"
  1174.         android:textColor="#FFFFFF"
  1175.         android:textSize="22sp" />
  1176.  
  1177. </LinearLayout>
  1178. mark_update.xml
  1179. ================
  1180. <?xml version="1.0" encoding="utf-8"?>
  1181. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  1182.     android:orientation="vertical" android:layout_width="match_parent"
  1183.     android:layout_height="match_parent">
  1184.     <EditText
  1185.         android:id="@+id/etNewMark"
  1186.         android:layout_width="match_parent"
  1187.         android:layout_height="wrap_content"
  1188.         android:hint="Enter The New Mark"
  1189.         android:inputType="number"
  1190.         android:textSize="22sp" />
  1191.  
  1192. </LinearLayout>
  1193. studentshow.xml
  1194. ===============
  1195. <?xml version="1.0" encoding="utf-8"?>
  1196. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  1197.     android:layout_width="match_parent"
  1198.     android:layout_height="wrap_content"
  1199.     android:background="#ff8cd1"
  1200.     android:orientation="horizontal">
  1201.  
  1202.     <TextView
  1203.         android:id="@+id/StudentsesName"
  1204.         android:layout_width="match_parent"
  1205.         android:layout_height="wrap_content"
  1206.         android:layout_weight="1"
  1207.         android:textColor="#FFFFFF"
  1208.         android:textSize="22sp" />
  1209.     <TextView
  1210.         android:id="@+id/studentGrade"
  1211.         android:fontFamily="sans-serif-medium"
  1212.         android:layout_width="match_parent"
  1213.         android:layout_height="wrap_content"
  1214.         android:layout_weight="1"
  1215.         android:textColor="#FFFFFF"
  1216.         android:textSize="22sp" />
  1217. </LinearLayout>
  1218. updatemarks.xml
  1219. =================
  1220. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  1221.     android:layout_width="match_parent"
  1222.     android:layout_height="match_parent"
  1223.     android:orientation="horizontal">
  1224.  
  1225.     <EditText
  1226.         android:layout_width="match_parent"
  1227.         android:layout_height="wrap_content"
  1228.         android:layout_weight="2"
  1229.         android:hint="New Mark"
  1230.         android:textSize="22sp" />
  1231.  
  1232.     <Button
  1233.         android:id="@+id/etNewQuentity"
  1234.         android:layout_width="match_parent"
  1235.         android:layout_height="wrap_content"
  1236.         android:layout_weight="2"
  1237.         android:hint="The New Mark"
  1238.         android:textColorHint="#00acff"
  1239.         android:textSize="22sp" />
  1240.  
  1241. </LinearLayout>
Add Comment
Please, Sign In to add comment