Home > Mobile >  Android studio white, help bosses why I code app will keeps stoping playing according to others
Android studio white, help bosses why I code app will keeps stoping playing according to others

Time:09-26

Package com. Example. Huodongdenglu. Utils;

import android.os.Bundle;
The import android. Widget. LinearLayout;
The import android. Widget. TextView;

The import androidx. The annotation. NonNull;
import androidx.appcompat.app.AppCompatActivity;
The import androidx. Fragments. App. Fragments;
The import androidx. Fragments. App. FragmentManager;
The import androidx. Fragments. App. FragmentPagerAdapter;
The import androidx. Viewpager. Widget. The viewpager;

The import com. Example. Huodongdenglu. R;
The import com. Example. Huodongdenglu. Fragments. ActivityFragment;
The import com. Example. Huodongdenglu. Fragments. MasageFragment;
The import com. Example. Huodongdenglu. Fragments. UserFragment;

import java.util.ArrayList;
Import the Java. Util. List;

The import butterknife. Butterknife;
The import butterknife. InjectView;

Public class Main2Activity extends AppCompatActivity {

@ InjectView (R.i d.m ain_tv_title)
TextView mainTvTitle;
@ InjectView (R.i d.m ain_viewpager)
ViewPager mainViewpager;
@ InjectView (R.i d.m ain_bottom)
LinearLayout mainBottom;

Private List MFragment=new ArrayList (a);

@ Override
Protected void onCreate (Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
The setContentView (R.l ayout. Activity_main4);
ButterKnife. Inject (this);
InitData ();
}

Private void initData () {

MFragments. Add (new ActivityFragment ());
MFragments. Add (new MasageFragment ());
MFragments. Add (new UserFragment ());

MainViewpager. SetAdapter (new MyPagerAdaper (getSupportFragmentManager ()));
}
The class MyPagerAdaper extends FragmentPagerAdapter {
Public MyPagerAdaper (@ NonNull FragmentManager FM) {
Super (FM);
}

@ NonNull
@ Override
Public fragments the getItem (int position) {
Return mFragments. Get (position);
}

@ Override
Public int getCount () {
return 3;
}
}
}


Since this can't run, seek a solution

CodePudding user response:

Debugging when you look at the Android Studio on the error message in the LogCat, don't understand the words, you put the wrong details

CodePudding user response:

. Main2Activity... {
.
The setContentView (R.l ayout. Activity_main4);
.
}
There are "R.l ayout. Activity_main2?" " For the try?

CodePudding user response:

You compile error or run error is this?

CodePudding user response:

See the log! See the log! See the log!
New blog: https://blog.csdn.net/weimingjue/article/details/87921494

CodePudding user response:

Eldest brother, the log stick out

CodePudding user response:

Stick the error log out, you only part of the source is the habit of asking questions is not good
  • Related