Home > Mobile >  From the activity to failure, jump on the Internet to see a lot of didn't finished
From the activity to failure, jump on the Internet to see a lot of didn't finished

Time:11-29

No bug in logcat see have a local error
At com. Example. Myapplication. LoginActivity. OnCreate (LoginActivity. Java: 38)
The corresponding local

GetSupportFragmentManager (). The beginTransaction (). The add (R.i d.f ragment_container, fristFragment), show (fristFragment). The commit ();
The entire source code
Package com. Example. Myapplication;

The import androidx. Appcompat. App. AppCompatActivity;
The import androidx. Fragments. App. Fragments;
The import androidx. Fragments. App. FragmentTransaction;

The import android. Content. Intent;
The import android. OS. Bundle;
The import android. View. The view;
The import android. Widget. LinearLayout;
The import android. Widget. TextView;

The import fragments. FouthFragment;
The import fragments. FristFragment;
The import fragments. SecondFragment;
The import fragments. ThirdFragment;

Public class LoginActivity extends AppCompatActivity implements the View. An OnClickListener {
Private fragments [] mfragments;
Private FristFragment FristFragment;
Private SecondFragment SecondFragment;
Private ThirdFragment ThirdFragment;
Private FouthFragment FouthFragment;
Private int index;
Private int currentTabIndex;
Private static final ints FRAGMENT_frist=0;
Private static final ints FRAGMENT_second=1;
Private static final ints FRAGMENT_third=2;
Private static final ints FRAGMENT_fouth=3;
Private LinearLayout [] mTabs;


@ Override
Protected void onCreate (Bundle savedInstanceState) {
Super. OnCreate (savedInstanceState);
The setContentView (R.l ayout. Activity_login);
Mfragments=new fragments [] {fristFragment secondFragment, thirdFragment, fouthFragment};
GetSupportFragmentManager (). The beginTransaction (). The add (R.i d.f ragment_container, fristFragment), show (fristFragment). The commit ();
MTabs=new LinearLayout [mfragments length];
MTabs [FRAGMENT_frist]=the findViewById (R.i d.f ragment_frist);
MTabs [FRAGMENT_second]=the findViewById (R.i d.f ragment_second);
MTabs [FRAGMENT_third]=the findViewById (R.i d.f ragment_third);
MTabs [FRAGMENT_fouth]=the findViewById (R.i d.f ragment_fouth);


MTabs [FRAGMENT_frist] setOnClickListener (this);
MTabs [FRAGMENT_second] setOnClickListener (this);
MTabs [FRAGMENT_third] setOnClickListener (this);
MTabs [FRAGMENT_fouth] setOnClickListener (this);


MTabs [FRAGMENT_frist] setSelected (true);


}

@ Override
Public void onClick (View v)


Can know where is wrong for me have a look at it
thank you

CodePudding user response:

Do you change
FragmentManager FM=getSupportFragmentManager ();
FragmentTransaction transaction=FM. BeginTransaction ();
Transaction. The replace (R.i d.f ragment_container fristFragment);
Transaction.com mitAllowingStateLoss ();

//this section to remove
Show (fristFragment)
Let me see your best XML code

CodePudding user response:

The
1/f, reference Xia_ Yan response:

you change?FragmentManager FM=getSupportFragmentManager ();
FragmentTransaction transaction=FM. BeginTransaction ();
Transaction. The replace (R.i d.f ragment_container fristFragment);
Transaction.com mitAllowingStateLoss ();

//this section to remove
Show (fristFragment)
Let me see your best XML code

I wrote it according to your changed or not
At com. Example. Myapplication10. Main. OnCreate (44). The Main Java:
Transaction. The replace (R.i d.f ragment_frist fristFragment);

CodePudding user response:

The
1/f, reference Xia_ Yan response:

you change?FragmentManager FM=getSupportFragmentManager ();
FragmentTransaction transaction=FM. BeginTransaction ();
Transaction. The replace (R.i d.f ragment_container fristFragment);
Transaction.com mitAllowingStateLoss ();

//this section to remove
Show (fristFragment)
Let me see your best XML code

I am in the mainactivity got a button
To achieve click this button to enter the main interface

CodePudding user response:

What is language mistakes? Log that is also very important, don't send only one line

CodePudding user response:

If you're going to be fragments of jump what com. Making. 1079374315: GT: v1.1.3 use this dependency

CodePudding user response:

Initialization is empty now, no
  • Related