Skip to content
Snippets Groups Projects
Commit 14a0f031 authored by Niharika K's avatar Niharika K
Browse files

Profile

parent b0a102bd
No related branches found
No related tags found
No related merge requests found
......@@ -9,15 +9,23 @@ import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.Toast;
public class ProfileActivity extends AppCompatActivity {
public String str="";
DatabaseHelper2 db=new DatabaseHelper2(this);
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_profile);
Intent i =getIntent();
str=i.getStringExtra("Name");
TextView uname = (TextView)findViewById(R.id.userName);
uname.setText(str);
Button cancel =(Button)findViewById(R.id.cancel);
cancel.setOnClickListener(new View.OnClickListener() {
......@@ -36,8 +44,6 @@ public class ProfileActivity extends AppCompatActivity {
EditText phone = (EditText)findViewById(R.id.phone);
RadioButton selectedRadioButton;
int selectedId = gender.getCheckedRadioButtonId();
selectedRadioButton = (RadioButton)findViewById(selectedId);
......@@ -51,8 +57,10 @@ public class ProfileActivity extends AppCompatActivity {
boolean res =db.insertdata(selectedRadioButton.getText().toString(),a,p);
if(res) {
//Toast.makeText(this, "Inserted ", Toast.LENGTH_SHORT).show();
Intent i =new Intent(getApplicationContext(),UserArea.class);
startActivity(i);
Intent i2 =new Intent(getApplicationContext(),UserArea.class);
//i2.putExtra("Name",str);
startActivity(i2);
}
......
......@@ -23,18 +23,20 @@ public class UserArea extends AppCompatActivity {
private ActionBarDrawerToggle mToggle;
NavigationView navigationView;
public String s ="";
//TextView v;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_user_area);
if (googleServicesAvailable()){
Toast.makeText(this,"Perfect",Toast.LENGTH_SHORT).show();
//Toast.makeText(this,"Perfect",Toast.LENGTH_SHORT).show();
}
Intent i =getIntent();
String s = i.getStringExtra("name");
TextView v =(TextView)findViewById(R.id.textView2);
v.setText("Welcome "+s);
s = i.getStringExtra("name");
// v =(TextView)findViewById(R.id.textView2);
//v.setText("Welcome "+s);
mDrawerLayout = (DrawerLayout)findViewById(R.id.activity_user_area);
mToggle = new ActionBarDrawerToggle(this,mDrawerLayout,R.string.open,R.string.close);
......@@ -51,6 +53,7 @@ public class UserArea extends AppCompatActivity {
switch (item.getItemId()){
case R.id.my_profile :
Intent i =new Intent(getApplicationContext(),ProfileActivity.class);
i.putExtra("Name",s);
startActivity(i);
mDrawerLayout.closeDrawers();
break;
......@@ -96,4 +99,6 @@ public class UserArea extends AppCompatActivity {
}
return false;
}
}
......@@ -19,12 +19,12 @@
android:layout_alignParentStart="true"
android:layout_marginStart="136dp"
android:layout_marginTop="21dp"
android:id="@+id/textView" />
android:id="@+id/uname" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/textView"
android:layout_below="@+id/uname"
android:layout_marginTop="48dp"
android:id="@+id/userName"
android:layout_alignParentStart="true" />
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment