0

I have a fragment in which there are two buttons, one linking it to GoogleMap API which works perfectly fine whereas the other one linking to another activity crashes.

public class XBeeReceivedPacketsFragment extends AbstractXBeeDeviceFragment
{
@Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {


        // Inflate the layout for this fragment.
        View view = inflater.inflate(R.layout.xbee_received_data, container, false);
        initializeUIElements(view);
        return view;
        }

private void initializeUIElements(View view) {
btn_Minedb=view.findViewById(R.id.btn_Minedb);
        btn_Minedb.setOnClickListener(new OnClickListener()
                                      {
                                          @Override
                                          public void onClick(View v) {

                                              Intent intent=new Intent(XBeeReceivedPacketsFragment.this.getActivity(), MineDatabase.class);
                                              startActivity(intent);
                                          }


                                      }
        );


        btn_Map=view.findViewById(R.id.btn_Map);
        btn_Map.setOnClickListener(new View.OnClickListener()
                                   {
                                       @Override
                                       public void onClick(View v) {

                                           Intent intent=new Intent(XBeeReceivedPacketsFragment.this.getActivity(), MapsActivity.class);
                                           startActivity(intent);
                                       }


                                   }
        );
}

and here is the code for the activity where the intent is directing,However the app carshes everytime I click this button

package com.digi.xbee.sample.android.xbeemanager.fragments;



import androidx.appcompat.app.AppCompatActivity;

import com.digi.xbee.sample.android.xbeemanager.R;


public class MineDatabase extends AppCompatActivity {



    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_mine_database);
     

    }
}
  • Does this answer your question? [Unfortunately MyApp has stopped. How can I solve this?](https://stackoverflow.com/questions/23353173/unfortunately-myapp-has-stopped-how-can-i-solve-this) – a_local_nobody Sep 13 '20 at 11:21
  • Unfortunately I can't debug using logcat since I need to attach some hardware to usb for running the app.I just want to know the basic programming flaw that I am making – Shinjan Chakraborty Sep 14 '20 at 04:38
  • can't help without a stacktrace unfortunately – a_local_nobody Sep 14 '20 at 05:30

1 Answers1

1

Did you add MineDatabase activity in AndroidManifest.xml file? If not add it. Every component needs to be added in manifest file.

Ridcully
  • 23,362
  • 7
  • 71
  • 86
Jujare Vinayak
  • 121
  • 1
  • 8