I have problems with the transaction of a Fragments

0

package cu.castanedapp.good;

import android.app.FragmentTransaction; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.FragmentManager; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.TextView;

public class MainActivity extends AppCompatActivity {

final TextView galeria = (TextView)findViewById(R.id.segundo);
final TextView contactos = (TextView)findViewById(R.id.tercero);



@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
            galeria.setOnClickListener(new View.OnClickListener() {

                                   @Override
                                   public void onClick(View view) {
                                       Intent i = new Intent(MainActivity.this,galeria.class);
                                       startActivity(i);
                                   }

                               },

            contactos.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                   FragmentTransaction transaction;
                    contactos_fragment fragment = new contactos_fragment();
                                           transaction = getSupportFragmentManager().beginTransaction().replace(R.id.BarraMenu, *fragment*);//Aqui es donde da el error panando el parametro fragment
                   transaction.addToBackStack(null);
                    transaction.commit();





                }
            }));
}

}

ERROR Error: (40, 108) error: no suitable method found for replace (int, contacts_fragment) method FragmentTransaction.replace (int, Fragment, String) is not applicable (current and formal argument lists differ in length) method FragmentTransaction.replace (int, Fragment) is not applicable (current argument contacts_fragment can not be converted to Fragment by method invocation conversion)

    
asked by Raymer Castañeda 19.02.2018 в 18:11
source

0 answers