У меня есть эти ошибки
android.content.ActivityNotFoundException: Невозможно найти явный класс активности {};Вы объявили об этой активности в вашем AndroidManifest.xml?на android.app.Instrumentation.checkStartActivityResult (Instrumentation.java:2005) на android.app.Instrumentation.execStartActivity (Instrumentation.java:1673) на android.app.Activity.startActivityForResult (Activity.java:4586) на androidx.fragment.Приложение.app.FragmentActivity $ HostCallbacks.onStartActivityFromFragment (FragmentActivity.java:933) в androidx.fragment.app.Fragment.startActivity (Fragment.java:1185) в androidx.fragment.app.Fragment.startActivity (Fragment.java:1173) вcom.example.gerobokgo.AccountFragment.openUpdateProfile (AccountFragment.java:110) по адресу com.example.gerobokgo.AccountFragment.access $ 000 (AccountFragment.java:29) по адресу com.example.gerobokgo.AccountFragment $ 2.onClickj:93)
У меня error
на этих code
// For update and pass information method
private void openUpdateProfile() {
Intent intent= new Intent(getActivity(), UpdateProfileFragment.class);
//pass value from current to next page
intent.putExtra("name",tv_name.getText().toString().trim());
intent.putExtra("email", tv_email.getText().toString().trim());
intent.putExtra("Home Address",tv_home.getText().toString().trim());
intent.putExtra("Telephone", tv_phone.getText().toString().trim());
startActivity(intent);
}
public class AccountFragment extends Fragment
//For Update Method
btn_update.setOnClickListener( new View.OnClickListener(){
@Override
public void onClick(View view) {
openUpdateProfile();
}
AndroidManifest
<application
android:name=".Home"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".RegisterActivity"
android:screenOrientation="portrait"></activity>
<activity android:name=".LoginActivity"
android:screenOrientation="portrait"/>
<activity
android:name=".splashScreen"
android:theme="@style/SplashScreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:theme="@style/AppTheme" />
</application>
UpdateProfileFragment.java
public class UpdateProfileFragment extends Fragment implements View.OnClickListener {
EditText tv_name, tv_email, tv_home, tv_phone;
Button btn_update;
FirebaseAuth firebaseAuth;
FirebaseUser currentUser;
DatabaseReference databaseReference;
public UpdateProfileFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_update_profile, container, false);
//get data from intert (data from previous page)
Intent intent = getActivity().getIntent();
String name = intent.getStringExtra("Name");
String email = intent.getStringExtra("Email");
String address = intent.getStringExtra(" Shipping Address");
String phone = intent.getStringExtra("Telephone Number");
//ini
firebaseAuth = FirebaseAuth.getInstance();
currentUser = firebaseAuth.getCurrentUser();
databaseReference = FirebaseDatabase.getInstance().getReference("Customer").child(firebaseAuth.getUid());
tv_name = view.findViewById(R.id.tv_name);
tv_email = view.findViewById(R.id.tv_email);
tv_home = view.findViewById(R.id.tv_home);
tv_phone = view.findViewById(R.id.tv_phone);
tv_name.setText(name);
tv_email.setText(email);
tv_home.setText(address);
tv_phone.setText(phone);
btn_update.setOnClickListener(this);
return view;
}
@Override
public void onClick(View view) {
}
private void updateProfile() {
Intent intent = getActivity().getIntent();
String userUid = firebaseAuth.getCurrentUser().getUid();
String name = tv_name.getText().toString().trim();
String email = tv_email.getText().toString().trim();
String home = tv_home.getText().toString().trim();
String phone = tv_phone.getText().toString().trim();
Customer cust = new Customer(userUid, name, email, home, phone);
databaseReference.child("Customer").child(userUid).setValue(cust).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) {
Toast.makeText(getActivity(), "Update Successfully", Toast.LENGTH_SHORT).show();
getActivity().finish();
startActivity(new Intent(getActivity(), AccountFragment.class));
}
}
});
}
}