I have created a bottom navigation activity with three fragments using templates from Android Studio.
In the first Fragment of this bottom navigation activity, has a Listiview with many items. I need to redirect the user to another activity when he clicks on an item, but the fragment doesn't show any Activity file when insert the Intent code, just Java files.
This my code below:
Can anyone tell me why?
In the first Fragment of this bottom navigation activity, has a Listiview with many items. I need to redirect the user to another activity when he clicks on an item, but the fragment doesn't show any Activity file when insert the Intent code, just Java files.
This my code below:
Java:
mRef.addChildEventListener(new ChildEventListener() {
@Override
public void onChildAdded(@NonNull DataSnapshot dataSnapshot, @Nullable String s) {
Product product = dataSnapshot.getValue(Product.class); // My class Product
products.add(product); // Adding product to Array products
adapter.notifyDataSetChanged();
TextView txtNameUserApp = (TextView) getActivity().findViewById(R.id.txtNameUserApp);
ImageView imgUserApp = (ImageView) getActivity().findViewById(R.id.imgUserApp);
ClasseFirebase.getDataUser(txtNameUserApp, imgUserApp, mAuth, getContext());
// Setting the Itemclick of the ListView lstvProducts
lstvProducts.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
startActivity(new Intent(getActivity(), MinhaActivty.class)); // In this place I need to insert the name of another activity
}
});
}
Can anyone tell me why?