-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprofileActivity.java
45 lines (38 loc) · 1.69 KB
/
profileActivity.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package com.example.rental;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.MenuItem;
import android.widget.Toast;
import com.google.android.material.bottomnavigation.BottomNavigationView;
public class ProfileActivity extends AppCompatActivity {
BottomNavigationView bottomNavigationView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_profile2);
bottomNavigationView = findViewById(R.id.bottomnavigator);
bottomNavigationView.setSelectedItemId(R.id.profile);
bottomNavigationView.setOnItemSelectedListener(new BottomNavigationView.OnItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
int itemId = item.getItemId();
if (itemId == R.id.profile) {
return true;
} else if (itemId == R.id.search) {
startActivity(new Intent(getApplicationContext(), HomeActivity.class));
overridePendingTransition(0, 0);
return true;
} else if (itemId == R.id.repair) {
startActivity(new Intent(getApplicationContext(), RepairActivity.class));
overridePendingTransition(0, 0);
return true;
} else {
Toast.makeText(ProfileActivity.this, "Invalid navigation item selected!", Toast.LENGTH_SHORT).show();
}
return false;
}
});
}
}