Advertisement
droidM

Untitled

Oct 14th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 33.38 KB | None | 0 0
  1. //////////////////////////////////////////////////////////////////////////////////////////////////
  2. **JAVA CLASSES**
  3. ------------------------------------------------------------
  4. **DBHelper**
  5.  
  6. import android.content.ContentValues;
  7. import android.content.Context;
  8. import android.database.Cursor;
  9. import android.database.sqlite.SQLiteDatabase;
  10. import android.database.sqlite.SQLiteOpenHelper;
  11. import android.util.Log;
  12.  
  13. import java.util.ArrayList;
  14.  
  15. /**
  16. * Created by Suraj on 10/6/2018.
  17. */
  18.  
  19. public class DBHandler extends SQLiteOpenHelper {
  20.  
  21. public DBHandler(Context context) {
  22. super(context, "user_db", null, 1);
  23.  
  24. }
  25.  
  26. @Override
  27. public void onCreate(SQLiteDatabase db) {
  28.  
  29. String createQuery = "CREATE TABLE "+UserProfile.Users.TABLE_NAME +"( "+UserProfile.Users.COL_ID +" INTEGER PRIMARY KEY AUTOINCREMENT ,"+UserProfile.Users.COL_USERNAME+" TEXT UNIQUE," +
  30. UserProfile.Users.COL_PASSWORD +" TEXT, "+UserProfile.Users.COL_GENDER +" TEXT, "+UserProfile.Users.COL_DOB +" TEXT"+")";
  31.  
  32. Log.d("createQuery",createQuery);
  33.  
  34. try {
  35. db.execSQL(createQuery);
  36. }
  37. catch (Exception e){
  38. e.printStackTrace();
  39. Log.e("Exception",e.getMessage());
  40. }
  41.  
  42. }
  43.  
  44. @Override
  45. public void onUpgrade(SQLiteDatabase db, int i, int i1) {
  46.  
  47. String createQuery = "CREATE TABLE "+UserProfile.Users.TABLE_NAME +"( "+UserProfile.Users.COL_ID +" INTEGER PRIMARY KEY AUTOINCREMENT ,"+UserProfile.Users.COL_USERNAME+" TEXT," +
  48. UserProfile.Users.COL_PASSWORD +" TEXT, "+UserProfile.Users.COL_GENDER +" TEXT, "+UserProfile.Users.COL_DOB+" TEXT"+")";
  49.  
  50. Log.d("createQuery",createQuery);
  51.  
  52. try {
  53. db.execSQL(createQuery);
  54. }
  55. catch (Exception e){
  56. e.printStackTrace();
  57. Log.e("Exception",e.getMessage());
  58. }
  59.  
  60.  
  61. }
  62.  
  63. public boolean addInfo(UserProfile.Users users){
  64.  
  65. SQLiteDatabase db = this.getWritableDatabase();
  66.  
  67. String insertQuery = "INSERT INTO "+UserProfile.Users.TABLE_NAME+"("+UserProfile.Users.COL_USERNAME+","+UserProfile.Users.COL_PASSWORD+","+UserProfile.Users.COL_GENDER+","+
  68. UserProfile.Users.COL_DOB+") VALUES('"+users.getUsername()+"','"+users.getPassword()+"','"+users.getGender()+"','"+users.getDob()+"')";
  69.  
  70. Log.d("insertQuery",insertQuery);
  71.  
  72. try {
  73. db.execSQL(insertQuery);
  74. return true;
  75. }
  76. catch (Exception e){
  77. e.printStackTrace();
  78. Log.d("Exception",e.getMessage());
  79. }
  80.  
  81. db.close();
  82. return false;
  83. }
  84.  
  85. public boolean updateInfor(UserProfile.Users users){
  86.  
  87. SQLiteDatabase db = this.getWritableDatabase();
  88.  
  89. ContentValues values = new ContentValues();
  90.  
  91. String username = users.getUsername();
  92. String password = users.getPassword();
  93. String dob = users.getDob();
  94. String gender = users.getGender();
  95. int id = users.getId();
  96. values.put(UserProfile.Users.COL_DOB,dob);
  97. values.put(UserProfile.Users.COL_GENDER,gender);
  98. values.put(UserProfile.Users.COL_PASSWORD,password);
  99. values.put(UserProfile.Users.COL_USERNAME,username);
  100.  
  101. int result = db.update(UserProfile.Users.TABLE_NAME,values,UserProfile.Users.COL_ID+" = ?",new String[]{String.valueOf(id)});
  102.  
  103. if(result >0)
  104. return true;
  105.  
  106. return false;
  107. }
  108.  
  109.  
  110. public ArrayList<UserProfile.Users> readAllInfor(){
  111.  
  112. ArrayList<UserProfile.Users> userList = new ArrayList<>();
  113.  
  114. SQLiteDatabase db = this.getWritableDatabase();
  115.  
  116. String readAllQuery = "SELECT * FROM "+UserProfile.Users.TABLE_NAME;
  117.  
  118. Cursor cursor = db.rawQuery(readAllQuery,null);
  119.  
  120. if(cursor.moveToFirst()){
  121. do{
  122. UserProfile.Users users = UserProfile.getProfile().getUser();
  123.  
  124. users.setId(Integer.parseInt(cursor.getString(0)));
  125. users.setUsername(cursor.getString(1));
  126. users.setPassword(cursor.getString(2));
  127. users.setGender(cursor.getString(3));
  128. users.setDob(cursor.getString(4));
  129.  
  130. userList.add(users);
  131.  
  132. }while (cursor.moveToNext());
  133. }
  134.  
  135. return userList;
  136.  
  137. }
  138.  
  139. public UserProfile.Users readAllInfor(String userName){
  140.  
  141. SQLiteDatabase db = this.getWritableDatabase();
  142.  
  143. String readSingleQuery = "SELECT * FROM "+ UserProfile.Users.TABLE_NAME+" WHERE "+ UserProfile.Users.COL_USERNAME + " = '"+ userName+"'";
  144.  
  145. Cursor cursor = db.rawQuery(readSingleQuery,null);
  146.  
  147. if(cursor.moveToFirst()){
  148.  
  149. UserProfile.Users users = UserProfile.getProfile().getUser();
  150.  
  151. users.setId(Integer.parseInt(cursor.getString(0)));
  152. users.setUsername(cursor.getString(1));
  153. users.setPassword(cursor.getString(2));
  154. users.setGender(cursor.getString(3));
  155. users.setDob(cursor.getString(4));
  156.  
  157. return users;
  158. }
  159.  
  160. return null;
  161. }
  162.  
  163. public UserProfile.Users readAllInfor(int id){
  164.  
  165. SQLiteDatabase db = this.getWritableDatabase();
  166.  
  167. String readSingleQuery = "SELECT * FROM "+ UserProfile.Users.TABLE_NAME+" WHERE "+ UserProfile.Users.COL_ID + " = '"+ id+"'";
  168.  
  169. Cursor cursor = db.rawQuery(readSingleQuery,null);
  170.  
  171. if(cursor.moveToFirst()){
  172.  
  173. UserProfile.Users users = UserProfile.getProfile().getUser();
  174.  
  175. users.setId(Integer.parseInt(cursor.getString(0)));
  176. users.setUsername(cursor.getString(1));
  177. users.setPassword(cursor.getString(2));
  178. users.setGender(cursor.getString(3));
  179. users.setDob(cursor.getString(4));
  180.  
  181. return users;
  182. }
  183.  
  184. return null;
  185. }
  186.  
  187.  
  188.  
  189. public void deleteInfo(String username){
  190.  
  191. SQLiteDatabase db = this.getWritableDatabase();
  192.  
  193. String deleteQuery = "DELETE FROM "+ UserProfile.Users.TABLE_NAME+" WHERE "+ UserProfile.Users.COL_USERNAME +" = '"+ username +"' ";
  194. Log.d("deleteQuery ",deleteQuery);
  195. db.execSQL(deleteQuery);
  196. db.close();
  197. }
  198.  
  199.  
  200.  
  201. }
  202. ------------------------------------------------------------------------------------------------------
  203. **UserProfile**
  204.  
  205. public final class UserProfile {
  206.  
  207. private UserProfile(){
  208.  
  209. }
  210.  
  211. public static UserProfile getProfile(){
  212.  
  213. UserProfile userProfile = new UserProfile();
  214. return userProfile;
  215. }
  216. class Users implements BaseColumn{
  217.  
  218. public static final String TABLE_NAME = "UserInfo";
  219. public static final String COL_ID = "_ID";
  220. public static final String COL_USERNAME = "userName ";
  221. public static final String COL_DOB = "dateOfBirth";
  222. public static final String COL_GENDER = "Gender";
  223. public static final String COL_PASSWORD = "Password";
  224.  
  225.  
  226. //display karana ona variable tika
  227. private int id;
  228. private String username;
  229. private String dob;
  230. private String gender;
  231. private String password;
  232.  
  233.  
  234. public int getId() {
  235. return id;
  236. }
  237.  
  238. public void setId(int id) {
  239. this.id = id;
  240. }
  241.  
  242. public String getUsername() {
  243. return username;
  244. }
  245.  
  246. public void setUsername(String username) {
  247. this.username = username;
  248. }
  249.  
  250. public String getDob() {
  251. return dob;
  252. }
  253.  
  254. public void setDob(String dob) {
  255. this.dob = dob;
  256. }
  257.  
  258. public String getGender() {
  259. return gender;
  260. }
  261.  
  262. public void setGender(String gender) {
  263. this.gender = gender;
  264. }
  265.  
  266. public String getPassword() {
  267. return password;
  268. }
  269.  
  270. public void setPassword(String password) {
  271. this.password = password;
  272. }
  273. }
  274. //hethuwa-wena thanaka class ekaka wena wenama varible cll krnnaq ona unoth
  275. public Users getUser(){
  276. Users users = new Users();
  277.  
  278. return users;
  279. }
  280.  
  281.  
  282.  
  283. }
  284.  
  285. ----------------------------------------------------------------------------------------------------------------
  286. **EditProfile**
  287.  
  288. import android.content.Intent;
  289. import android.support.v7.app.AppCompatActivity;
  290. import android.os.Bundle;
  291. import android.view.View;
  292. import android.widget.Button;
  293. import android.widget.EditText;
  294. import android.widget.RadioButton;
  295. import android.widget.RadioGroup;
  296. import android.widget.Toast;
  297.  
  298. public class EditProfile extends AppCompatActivity {
  299.  
  300. Button searchBtn;
  301. EditText userName_editText;
  302. EditText password_editText;
  303. EditText dob_editText;
  304. RadioGroup genderRadioGroup;
  305. RadioButton genderRadioBtn;
  306.  
  307. //new Edit
  308. RadioButton genderRadioBtnMale;
  309. RadioButton genderRadioBtnFemale;
  310.  
  311. Button editBtn;
  312. Button deleteBtn;
  313. Intent intent;
  314. DBHandler dbHandler;
  315.  
  316. public static final String USERID_EDITPROFILE = "userID";
  317.  
  318. @Override
  319. protected void onCreate(Bundle savedInstanceState) {
  320. super.onCreate(savedInstanceState);
  321. setContentView(R.layout.activity_edit_profile);
  322.  
  323. searchBtn = (Button)findViewById(R.id.editprof_searchbtn);
  324. userName_editText = (EditText)findViewById(R.id.editprof_userName);
  325. password_editText = (EditText)findViewById(R.id.editprof_password);
  326. dob_editText = (EditText)findViewById(R.id.editprof_dob);
  327. genderRadioGroup = (RadioGroup)findViewById(R.id.editprof_radiogroup);
  328. editBtn = (Button)findViewById(R.id.editprof_editbtn);
  329. deleteBtn = (Button)findViewById(R.id.editprof_deletebtn);
  330.  
  331.  
  332. //new edit
  333. genderRadioBtnMale = (RadioButton) findViewById(R.id.editprof_male_radio);
  334. genderRadioBtnFemale = (RadioButton) findViewById(R.id.editprof_female_radio);
  335.  
  336. intent = getIntent();
  337.  
  338.  
  339. dbHandler = new DBHandler(EditProfile.this);
  340.  
  341. setUserDetails();
  342.  
  343. deleteBtn.setOnClickListener(new View.OnClickListener() {
  344. @Override
  345. public void onClick(View view) {
  346. String username = userName_editText.getText().toString();
  347.  
  348. if(username == null){
  349. Toast.makeText(EditProfile.this,"Please enter username to delete your profile",Toast.LENGTH_SHORT).show();
  350. }
  351. else{
  352. UserProfile.Users users = dbHandler.readAllInfor(username);
  353.  
  354. if(users == null){
  355. Toast.makeText(EditProfile.this,"No profile found from this username, please enter valid username",Toast.LENGTH_SHORT).show();
  356. }
  357. else{
  358. dbHandler.deleteInfo(username);
  359. Intent redirectintent_home = new Intent(EditProfile.this,Home.class);
  360. startActivity(redirectintent_home);
  361. }
  362. }
  363. }
  364. });
  365.  
  366. editBtn.setOnClickListener(new View.OnClickListener() {
  367. @Override
  368. public void onClick(View view) {
  369.  
  370. String userID_String = intent.getStringExtra(Home.USERID);
  371. if(userID_String == null){
  372. Toast.makeText(EditProfile.this,"Error!!",Toast.LENGTH_SHORT).show();
  373. Intent redirectintent_home = new Intent(getApplicationContext(),Home.class);
  374. startActivity(redirectintent_home);
  375. }
  376. int userID = Integer.parseInt(userID_String);
  377.  
  378. String username = userName_editText.getText().toString();
  379. String password = password_editText.getText().toString();
  380. String dob = dob_editText.getText().toString();
  381. int selectedGender = genderRadioGroup.getCheckedRadioButtonId();
  382. genderRadioBtn = (RadioButton)findViewById(selectedGender);
  383. String gender = genderRadioBtn.getText().toString();
  384.  
  385. UserProfile.Users users = UserProfile.getProfile().getUser();
  386. users.setUsername(username);
  387. users.setPassword(password);
  388. users.setDob(dob);
  389. users.setGender(gender);
  390. users.setId(userID);
  391.  
  392. dbHandler.updateInfor(users);
  393. Toast.makeText(EditProfile.this,"Updated Successfully",Toast.LENGTH_SHORT).show();
  394. Intent redirectintent_home = new Intent(getApplicationContext(),Home.class);
  395. startActivity(redirectintent_home);
  396. }
  397. });
  398.  
  399. searchBtn.setOnClickListener(new View.OnClickListener() {
  400. @Override
  401. public void onClick(View view) {
  402. String username = userName_editText.getText().toString();
  403. if (username == null){
  404. Toast.makeText(EditProfile.this,"Please enter a username",Toast.LENGTH_SHORT).show();
  405. }
  406. else{
  407. UserProfile.Users users_search = dbHandler.readAllInfor(username);
  408.  
  409.  
  410. if(users_search == null){
  411. Toast.makeText(EditProfile.this,"Please enter a valid username",Toast.LENGTH_SHORT).show();
  412. }
  413. else{
  414. userName_editText.setText(users_search.getUsername());
  415. password_editText.setText(users_search.getPassword());
  416. dob_editText.setText(users_search.getDob());
  417. int id = users_search.getId();
  418. Intent redirectintent = new Intent(EditProfile.this,EditProfile.class);
  419. redirectintent.putExtra(USERID_EDITPROFILE,Integer.toString(id));
  420. startActivity(redirectintent);
  421. }
  422. }
  423. }
  424. });
  425.  
  426.  
  427. }
  428.  
  429. public void setUserDetails(){
  430.  
  431. String userID_String = intent.getStringExtra(Home.USERID);
  432. if(userID_String == null){
  433. Toast.makeText(EditProfile.this,"Error!!",Toast.LENGTH_SHORT).show();
  434. Intent redirectintent_home = new Intent(EditProfile.this,Home.class);
  435. startActivity(redirectintent_home);
  436. }
  437. int userID = Integer.parseInt(userID_String);
  438. UserProfile.Users users = dbHandler.readAllInfor(userID);
  439. userName_editText.setText(users.getUsername());
  440. password_editText.setText(users.getPassword());
  441. dob_editText.setText(users.getDob());
  442.  
  443. //new edit
  444. String gender = users.getGender();
  445. if(gender.equals("Male")){
  446. genderRadioBtnMale.setChecked(true);
  447. genderRadioBtnFemale.setChecked(false);
  448. }
  449. else{
  450. genderRadioBtnMale.setChecked(false);
  451. genderRadioBtnFemale.setChecked(true);
  452. }
  453. }
  454. }
  455.  
  456. ---------------------------------------------------------------------------------------------------------------
  457. **Home**
  458.  
  459.  
  460. import android.content.Intent;
  461. import android.support.v7.app.AppCompatActivity;
  462. import android.os.Bundle;
  463. import android.view.View;
  464. import android.widget.Button;
  465. import android.widget.EditText;
  466. import android.widget.Toast;
  467.  
  468. public class Home extends AppCompatActivity {
  469.  
  470.  
  471. EditText username_editText;
  472. EditText password_editText;
  473. Button loginbtn;
  474. Button registerbtn;
  475.  
  476. public static final String USERID = "userID";
  477.  
  478. @Override
  479. protected void onCreate(Bundle savedInstanceState) {
  480. super.onCreate(savedInstanceState);
  481. setContentView(R.layout.activity_home);
  482.  
  483. username_editText = (EditText)findViewById(R.id.home_userName);
  484. password_editText = (EditText)findViewById(R.id.home_password);
  485. loginbtn = (Button)findViewById(R.id.home_loginBtn);
  486. registerbtn = (Button)findViewById(R.id.home_registerBtn);
  487. final DBHandler dbHandler = new DBHandler(Home.this);
  488.  
  489. registerbtn.setOnClickListener(new View.OnClickListener() {
  490. @Override
  491. public void onClick(View view) {
  492.  
  493. Intent intent = new Intent(Home.this,ProfileManagement.class);
  494. startActivity(intent);
  495. }
  496. });
  497.  
  498. loginbtn.setOnClickListener(new View.OnClickListener() {
  499. @Override
  500. public void onClick(View view) {
  501. String userName = username_editText.getText().toString();
  502. String password = password_editText.getText().toString();
  503.  
  504. if(userName.equals("") || password.equals("")){
  505. Toast.makeText(Home.this,"Login Unsuccessful",Toast.LENGTH_SHORT).show();
  506. }
  507. else{
  508. UserProfile.Users users = dbHandler.readAllInfor(userName);
  509.  
  510. if(users == null){
  511. Toast.makeText(Home.this,"Invalid username or password",Toast.LENGTH_SHORT).show();
  512. }
  513.  
  514. else{
  515. int userID = users.getId();
  516. Intent editProfIntent = new Intent(Home.this,EditProfile.class);
  517. editProfIntent.putExtra(USERID,Integer.toString(userID));
  518. startActivity(editProfIntent);
  519.  
  520. }
  521. }
  522. }
  523. });
  524. }
  525. }
  526.  
  527.  
  528. ----------------------------------------------------------------------------------------------------------------------
  529. **ProfileManagement**
  530.  
  531. import android.content.Intent;
  532. import android.support.v7.app.AppCompatActivity;
  533. import android.os.Bundle;
  534. import android.view.View;
  535. import android.widget.Button;
  536. import android.widget.EditText;
  537. import android.widget.RadioButton;
  538. import android.widget.RadioGroup;
  539. import android.widget.Toast;
  540.  
  541. public class ProfileManagement extends AppCompatActivity {
  542.  
  543. EditText username_editText;
  544. EditText password_editText;
  545. EditText dob_editText;
  546. RadioGroup radioGroup;
  547. RadioButton gender_radioBtn;
  548. Button saveProfBtn;
  549.  
  550. public final static String USERID_PROFILEMGMT = "userID";
  551.  
  552. @Override
  553. protected void onCreate(Bundle savedInstanceState) {
  554. super.onCreate(savedInstanceState);
  555. setContentView(R.layout.activity_profile_management);
  556.  
  557. username_editText = (EditText)findViewById(R.id.profmgmt_userName);
  558. password_editText = (EditText)findViewById(R.id.profmgmt_password);
  559. dob_editText = (EditText)findViewById(R.id.profmgmt_dob);
  560. radioGroup = (RadioGroup)findViewById(R.id.profmgmt_radiogroup);
  561. saveProfBtn = (Button)findViewById(R.id.profmgmt_btn);
  562. final DBHandler dbHandler = new DBHandler(ProfileManagement.this);
  563.  
  564. saveProfBtn.setOnClickListener(new View.OnClickListener() {
  565. @Override
  566. public void onClick(View view) {
  567.  
  568. String username = username_editText.getText().toString();
  569. String password = password_editText.getText().toString();
  570. String dob = dob_editText.getText().toString();
  571. int selectedGender = radioGroup.getCheckedRadioButtonId();
  572. gender_radioBtn = (RadioButton)findViewById(selectedGender);
  573. String gender = gender_radioBtn.getText().toString();
  574.  
  575. UserProfile.Users users = UserProfile.getProfile().getUser();
  576. users.setUsername(username);
  577. users.setPassword(password);
  578. users.setDob(dob);
  579. users.setGender(gender);
  580. boolean result = dbHandler.addInfo(users);
  581.  
  582. if(result == true){
  583. Toast.makeText(ProfileManagement.this,"Successfully added",Toast.LENGTH_SHORT).show();
  584. UserProfile.Users newusers = dbHandler.readAllInfor(username);
  585. int userID = newusers.getId();
  586. Intent intent = new Intent(ProfileManagement.this,EditProfile.class);
  587. intent.putExtra(USERID_PROFILEMGMT,Integer.toString(userID));
  588. startActivity(intent);
  589. }
  590.  
  591. }
  592. });
  593.  
  594. }
  595. }
  596.  
  597.  
  598. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  599. **XML**
  600. ------------------------------------------------------------------------
  601. **activity edit profile**
  602.  
  603. <?xml version="1.0" encoding="utf-8"?>
  604. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  605. xmlns:app="http://schemas.android.com/apk/res-auto"
  606. xmlns:tools="http://schemas.android.com/tools"
  607. android:layout_width="match_parent"
  608. android:layout_height="match_parent"
  609. tools:context="com.modelpaper.mad.it17121002.EditProfile">
  610.  
  611. <TextView
  612. android:id="@+id/textView2"
  613. android:layout_width="wrap_content"
  614. android:layout_height="wrap_content"
  615. android:layout_alignLeft="@+id/textView"
  616. android:layout_alignStart="@+id/textView"
  617. android:layout_below="@+id/textView"
  618. android:layout_marginTop="45dp"
  619. android:text="Date Of Birth "
  620. android:textSize="24sp" />
  621.  
  622. <TextView
  623. android:id="@+id/textView"
  624. android:layout_width="wrap_content"
  625. android:layout_height="wrap_content"
  626. android:layout_alignParentTop="true"
  627. android:layout_marginTop="72dp"
  628. android:layout_toLeftOf="@+id/profmgmt_btn"
  629. android:layout_toStartOf="@+id/profmgmt_btn"
  630. android:text="User Name"
  631. android:textSize="24sp" />
  632.  
  633. <TextView
  634. android:id="@+id/textView3"
  635. android:layout_width="wrap_content"
  636. android:layout_height="wrap_content"
  637. android:layout_alignLeft="@+id/textView4"
  638. android:layout_alignStart="@+id/textView4"
  639. android:layout_below="@+id/textView4"
  640. android:layout_marginTop="41dp"
  641. android:text="Gender"
  642. android:textSize="24sp" />
  643.  
  644. <TextView
  645. android:id="@+id/textView4"
  646. android:layout_width="wrap_content"
  647. android:layout_height="wrap_content"
  648. android:layout_alignLeft="@+id/textView2"
  649. android:layout_alignStart="@+id/textView2"
  650. android:layout_below="@+id/textView2"
  651. android:layout_marginTop="46dp"
  652. android:text="Password"
  653. android:textSize="24sp" />
  654.  
  655. <Button
  656. android:id="@+id/editprof_editbtn"
  657. android:layout_width="wrap_content"
  658. android:layout_height="wrap_content"
  659. android:layout_alignParentBottom="true"
  660. android:layout_alignParentLeft="true"
  661. android:layout_alignParentStart="true"
  662. android:layout_marginBottom="54dp"
  663. android:layout_marginLeft="39dp"
  664. android:layout_marginStart="39dp"
  665. android:text="Edit" />
  666.  
  667. <EditText
  668. android:id="@+id/editprof_userName"
  669. android:layout_width="wrap_content"
  670. android:layout_height="wrap_content"
  671. android:layout_alignTop="@+id/textView"
  672. android:layout_toEndOf="@+id/textView2"
  673. android:layout_toRightOf="@+id/textView2"
  674. android:ems="10"
  675. android:inputType="textPersonName" />
  676.  
  677. <EditText
  678. android:id="@+id/editprof_dob"
  679. android:layout_width="wrap_content"
  680. android:layout_height="wrap_content"
  681. android:layout_alignBottom="@+id/textView2"
  682. android:layout_toEndOf="@+id/textView2"
  683. android:layout_toRightOf="@+id/textView2"
  684. android:ems="10"
  685. android:inputType="textPersonName" />
  686.  
  687. <EditText
  688. android:id="@+id/editprof_password"
  689. android:layout_width="wrap_content"
  690. android:layout_height="wrap_content"
  691. android:layout_alignBottom="@+id/textView4"
  692. android:layout_alignLeft="@+id/editprof_dob"
  693. android:layout_alignStart="@+id/editprof_dob"
  694. android:ems="10"
  695. android:inputType="textPersonName" />
  696.  
  697. <RadioGroup
  698. android:id="@+id/editprof_radiogroup"
  699. android:layout_width="wrap_content"
  700. android:layout_height="wrap_content"
  701. android:layout_alignLeft="@+id/profmgmt_password"
  702. android:layout_alignStart="@+id/profmgmt_password"
  703. android:layout_alignTop="@+id/textView3"
  704. android:layout_marginLeft="150dp">
  705.  
  706. <RadioButton
  707. android:id="@+id/editprof_male_radio"
  708. android:layout_width="wrap_content"
  709. android:layout_height="wrap_content"
  710. android:layout_weight="1"
  711. android:text="Male"
  712. android:textSize="24sp" />
  713.  
  714. <RadioButton
  715. android:id="@+id/editprof_female_radio"
  716. android:layout_width="wrap_content"
  717. android:layout_height="wrap_content"
  718. android:layout_marginLeft="100dp"
  719. android:layout_weight="1"
  720. android:text="Female"
  721. android:textSize="24sp" />
  722. </RadioGroup>
  723.  
  724. <Button
  725. android:id="@+id/editprof_deletebtn"
  726. android:layout_width="wrap_content"
  727. android:layout_height="wrap_content"
  728. android:layout_alignBaseline="@+id/editprof_editbtn"
  729. android:layout_alignBottom="@+id/editprof_editbtn"
  730. android:layout_marginEnd="14dp"
  731. android:layout_marginRight="14dp"
  732. android:layout_toLeftOf="@+id/editprof_searchbtn"
  733. android:layout_toStartOf="@+id/editprof_searchbtn"
  734. android:text="Delete" />
  735.  
  736. <Button
  737. android:id="@+id/editprof_searchbtn"
  738. android:layout_width="wrap_content"
  739. android:layout_height="wrap_content"
  740. android:layout_above="@+id/editprof_userName"
  741. android:layout_alignParentEnd="true"
  742. android:layout_alignParentRight="true"
  743. android:layout_marginBottom="11dp"
  744. android:text="Search" />
  745. </RelativeLayout>
  746.  
  747. -----------------------------------------------------------------------------------------------------
  748. **activity home profile**
  749.  
  750. <?xml version="1.0" encoding="utf-8"?>
  751. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  752. xmlns:app="http://schemas.android.com/apk/res-auto"
  753. xmlns:tools="http://schemas.android.com/tools"
  754. android:layout_width="match_parent"
  755. android:layout_height="match_parent"
  756. tools:context="com.modelpaper.mad.it17121002.Home">
  757.  
  758. <TextView
  759. android:id="@+id/userName_text"
  760. android:layout_width="wrap_content"
  761. android:layout_height="40dp"
  762. android:layout_alignParentLeft="true"
  763. android:layout_alignParentStart="true"
  764. android:layout_alignParentTop="true"
  765. android:layout_marginLeft="14dp"
  766. android:layout_marginStart="14dp"
  767. android:layout_marginTop="71dp"
  768. android:text="User Name"
  769. android:textSize="24sp" />
  770.  
  771. <TextView
  772. android:id="@+id/userName_text2"
  773. android:layout_width="wrap_content"
  774. android:layout_height="40dp"
  775. android:layout_alignLeft="@+id/userName_text"
  776. android:layout_alignStart="@+id/userName_text"
  777. android:layout_below="@+id/userName_text"
  778. android:layout_marginTop="49dp"
  779. android:text="Password"
  780. android:textSize="24sp" />
  781.  
  782. <EditText
  783. android:id="@+id/home_userName"
  784. android:layout_width="wrap_content"
  785. android:layout_height="wrap_content"
  786. android:layout_alignParentEnd="true"
  787. android:layout_alignParentRight="true"
  788. android:layout_alignTop="@+id/userName_text"
  789. android:layout_marginEnd="17dp"
  790. android:layout_marginRight="17dp"
  791. android:ems="10"
  792. android:inputType="textPersonName" />
  793.  
  794. <EditText
  795. android:id="@+id/home_password"
  796. android:layout_width="wrap_content"
  797. android:layout_height="wrap_content"
  798. android:layout_alignBottom="@+id/userName_text2"
  799. android:layout_alignEnd="@+id/home_userName"
  800. android:layout_alignRight="@+id/home_userName"
  801. android:ems="10"
  802. android:inputType="textPersonName" />
  803.  
  804. <Button
  805. android:id="@+id/home_loginBtn"
  806. android:layout_width="wrap_content"
  807. android:layout_height="wrap_content"
  808. android:layout_below="@+id/home_password"
  809. android:layout_marginTop="97dp"
  810. android:layout_toLeftOf="@+id/home_password"
  811. android:layout_toStartOf="@+id/home_password"
  812. android:text="Login" />
  813.  
  814. <Button
  815. android:id="@+id/home_registerBtn"
  816. android:layout_width="wrap_content"
  817. android:layout_height="wrap_content"
  818. android:layout_alignBaseline="@+id/home_loginBtn"
  819. android:layout_alignBottom="@+id/home_loginBtn"
  820. android:layout_alignEnd="@+id/home_password"
  821. android:layout_alignRight="@+id/home_password"
  822. android:layout_marginEnd="39dp"
  823. android:layout_marginRight="39dp"
  824. android:text="Register" />
  825. </RelativeLayout>
  826.  
  827.  
  828. -----------------------------------------------------------------------------------------------
  829. **activiity_profile_management**
  830. <?xml version="1.0" encoding="utf-8"?>
  831. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  832. xmlns:app="http://schemas.android.com/apk/res-auto"
  833. xmlns:tools="http://schemas.android.com/tools"
  834. android:layout_width="match_parent"
  835. android:layout_height="match_parent"
  836. tools:context="com.modelpaper.mad.it17121002.ProfileManagement">
  837.  
  838. <TextView
  839. android:id="@+id/textView2"
  840. android:layout_width="wrap_content"
  841. android:layout_height="wrap_content"
  842. android:layout_alignLeft="@+id/textView"
  843. android:layout_alignStart="@+id/textView"
  844. android:layout_below="@+id/textView"
  845. android:layout_marginTop="45dp"
  846. android:text="Date Of Birth "
  847. android:textSize="24sp" />
  848.  
  849. <TextView
  850. android:id="@+id/textView"
  851. android:layout_width="wrap_content"
  852. android:layout_height="wrap_content"
  853. android:layout_alignParentTop="true"
  854. android:layout_marginTop="72dp"
  855. android:layout_toLeftOf="@+id/profmgmt_btn"
  856. android:layout_toStartOf="@+id/profmgmt_btn"
  857. android:text="User Name"
  858. android:textSize="24sp" />
  859.  
  860. <TextView
  861. android:id="@+id/textView3"
  862. android:layout_width="wrap_content"
  863. android:layout_height="wrap_content"
  864. android:layout_alignLeft="@+id/textView4"
  865. android:layout_alignStart="@+id/textView4"
  866. android:layout_below="@+id/textView4"
  867. android:layout_marginTop="41dp"
  868. android:text="Gender"
  869. android:textSize="24sp" />
  870.  
  871. <TextView
  872. android:id="@+id/textView4"
  873. android:layout_width="wrap_content"
  874. android:layout_height="wrap_content"
  875. android:layout_alignLeft="@+id/textView2"
  876. android:layout_alignStart="@+id/textView2"
  877. android:layout_below="@+id/textView2"
  878. android:layout_marginTop="46dp"
  879. android:text="Password"
  880. android:textSize="24sp" />
  881.  
  882. <Button
  883. android:id="@+id/profmgmt_btn"
  884. android:layout_width="wrap_content"
  885. android:layout_height="wrap_content"
  886. android:layout_alignParentBottom="true"
  887. android:layout_centerHorizontal="true"
  888. android:layout_marginBottom="56dp"
  889. android:text="Register" />
  890.  
  891. <EditText
  892. android:id="@+id/profmgmt_userName"
  893. android:layout_width="wrap_content"
  894. android:layout_height="wrap_content"
  895. android:layout_alignTop="@+id/textView"
  896. android:layout_toEndOf="@+id/textView2"
  897. android:layout_toRightOf="@+id/textView2"
  898. android:ems="10"
  899. android:inputType="textPersonName" />
  900.  
  901. <EditText
  902. android:id="@+id/profmgmt_dob"
  903. android:layout_width="wrap_content"
  904. android:layout_height="wrap_content"
  905. android:layout_alignBottom="@+id/textView2"
  906. android:layout_toEndOf="@+id/textView2"
  907. android:layout_toRightOf="@+id/textView2"
  908. android:ems="10"
  909. android:inputType="textPersonName" />
  910.  
  911. <EditText
  912. android:id="@+id/profmgmt_password"
  913. android:layout_width="wrap_content"
  914. android:layout_height="wrap_content"
  915. android:layout_alignBottom="@+id/textView4"
  916. android:layout_alignEnd="@+id/profmgmt_dob"
  917. android:layout_alignRight="@+id/profmgmt_dob"
  918. android:ems="10"
  919. android:inputType="textPersonName" />
  920.  
  921.  
  922. <RadioGroup
  923. android:id="@+id/profmgmt_radiogroup"
  924. android:layout_width="wrap_content"
  925. android:layout_height="wrap_content"
  926. android:layout_alignLeft="@+id/profmgmt_password"
  927. android:layout_alignStart="@+id/profmgmt_password"
  928. android:layout_alignTop="@+id/textView3">
  929.  
  930. <RadioButton
  931. android:id="@+id/profmgmt_male_radio"
  932. android:layout_width="wrap_content"
  933. android:layout_height="wrap_content"
  934. android:layout_weight="1"
  935. android:text="Male"
  936. android:textSize="24sp" />
  937.  
  938. <RadioButton
  939. android:id="@+id/profmgmt_female_radio"
  940. android:layout_width="wrap_content"
  941. android:layout_height="wrap_content"
  942. android:layout_marginLeft="100dp"
  943. android:layout_weight="1"
  944. android:text="Female"
  945. android:textSize="24sp" />
  946. </RadioGroup>
  947.  
  948. </RelativeLayout>
  949. ------------------------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement