Error while editing through SQLITE

0

I'm trying to edit an information that is saved on the SQLITE side. I'm working with fragments.  But I have the following error:

FATAL EXCEPTION: main
                                                                                           Process: com.example.gerdaumanagement.gerdaumanagement, PID: 11997
                                                                                           android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.gerdaumanagement.gerdaumanagement/com.example.gerdaumanagement.gerdaumanagement.adicionar_usuario}; have you declared this activity in your AndroidManifest.xml?
                                                                                               at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1805)
                                                                                               at android.app.Instrumentation.execStartActivity(Instrumentation.java:1523)
                                                                                               at android.app.Activity.startActivityForResult(Activity.java:4225)
                                                                                               at android.support.v4.app.BaseFragmentActivityJB.startActivityForResult(BaseFragmentActivityJB.java:50)
                                                                                               at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:79)
                                                                                               at android.app.Activity.startActivityForResult(Activity.java:4183)
                                                                                               at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:859)
                                                                                               at android.app.Activity.startActivity(Activity.java:4522)
                                                                                               at android.app.Activity.startActivity(Activity.java:4490)
                                                                                               at com.example.gerdaumanagement.gerdaumanagement.usuario$UsuarioAdapter$2.onClick(usuario.java:218)
                                                                                               at android.view.View.performClick(View.java:5637)
                                                                                               at android.view.View$PerformClick.run(View.java:22429)
                                                                                               at android.os.Handler.handleCallback(Handler.java:751)
                                                                                               at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                                               at android.os.Looper.loop(Looper.java:154)
                                                                                               at android.app.ActivityThread.main(ActivityThread.java:6119)
                                                                                               at java.lang.reflect.Method.invoke(Native Method)
                                                                                               at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
                                                                                               at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

I have a listview with all the contacts, and in each contact I have an icon to edit and delete. The edit would be as follows: '

ImageView editarBt = (ImageView) view.findViewById(R.id.editar);
            editarBt.setOnClickListener(new Button.OnClickListener(){
                @Override
                public void onClick(View view) {
                    Intent intent = new Intent(getActivity(), adicionar_usuario.class);
                    intent.putExtra("nome", listaUser.get(auxPosition).getNome());
                    intent.putExtra("email", listaUser.get(auxPosition).getEmail());
                    intent.putExtra("np", listaUser.get(auxPosition).getNp());
                    intent.putExtra("tipoFunc", listaUser.get(auxPosition).getTipoFunc());
                    intent.putExtra("id", listaUser.get(auxPosition).getId());
                   getActivity().startActivity(intent);
                }
            });

When I click edit, the error occurs.

I've tried to change these try this code: '

 ImageView editarBt = (ImageView) view.findViewById(R.id.editar);
            editarBt.setOnClickListener(new Button.OnClickListener(){
                @Override
                public void onClick(View view) {

                    Bundle data = new Bundle();
                    data.putString("nome", listaUser.get(auxPosition).getNome());
                    data.putString("email", listaUser.get(auxPosition).getEmail());
                    data.putString("np", listaUser.get(auxPosition).getNp());
                    data.putString("tipoFunc", listaUser.get(auxPosition).getTipoFunc());
                    data.putInt("id", listaUser.get(auxPosition).getId());
                    Fragment fragment = new adicionar_usuario();
                    fragment.setArguments(data);




                }
            });
'

Does anyone know the reason for this error?

    
asked by anonymous 22.06.2017 / 20:40

1 answer

1

Lucas,

When you are going to put a Fragment in some Activity, you use the following code:

FragmentManager fragmentManager = getSupportFragmentManager();
        fragmentManager.beginTransaction()
                .replace(R.id.container, adicionar_usuario, "adicionar usuário")
                .commit();

And in Layout, you should have a FrameLayout with the id container , example:

<FrameLayout
  android:id="@+id/container"
  android:layout_width="match_parent"
  android:layout_height="match_parent" />

You should have already done this to declare this current Fragment that you put the code there.

Any questions scream there.

    
23.06.2017 / 15:09