Problem with Tabs and Adapter

0

I have a problem here.

I have this code

Home screen:

publicclassInicialextendsAppCompatActivity{privateImageButtonbutton,button2;protectedvoidonCreate(BundlesavedInstanceState){super.onCreate(savedInstanceState);setContentView(R.layout.activity_inicial);button=(ImageButton)findViewById(R.id.imageButton8);button.setOnClickListener(newView.OnClickListener(){@OverridepublicvoidonClick(Viewv){Intentit=newIntent(Inicial.this,MainActivity1.class);startActivity(it);}});button2=(ImageButton)findViewById(R.id.imageButton5);}}

MainActivity:

publicclassMainActivityextendsAppCompatActivity{@OverrideprotectedvoidonCreate(BundlesavedInstanceState){super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);Toolbartoolbar=(Toolbar)findViewById(R.id.toolbar);setSupportActionBar(toolbar);TabLayouttabLayout=(TabLayout)findViewById(R.id.tab_layout);tabLayout.addTab(tabLayout.newTab().setText("Praça XV - Araribóia"));
    tabLayout.addTab(tabLayout.newTab().setText("Araribóia - Praça XV"));
    tabLayout.addTab(tabLayout.newTab().setText("Tempo de viagem"));
    tabLayout.setTabGravity(TabLayout.GRAVITY_FILL);

    final ViewPager viewPager = (ViewPager) findViewById(R.id.pager);
    final PagerAdapter adapter = new PagerAdapter
            (getSupportFragmentManager(), tabLayout.getTabCount());
    viewPager.setAdapter(adapter);
    viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
    tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
        @Override
        public void onTabSelected(TabLayout.Tab tab) {
            viewPager.setCurrentItem(tab.getPosition());
        }

        @Override
        public void onTabUnselected(TabLayout.Tab tab) {

        }

        @Override
        public void onTabReselected(TabLayout.Tab tab) {

        }
    });
}}

PageAdapter

class PagerAdapter extends FragmentStatePagerAdapter {
    int mNumOfTabs;
public PagerAdapter(FragmentManager fm, int NumOfTabs) {
    super(fm);
    this.mNumOfTabs = NumOfTabs;
}

@Override
public Fragment getItem(int position) {

    switch (position) {
        case 0:
            TabFragment1 tab1 = new TabFragment1();
            return tab1;
        case 1:
            TabFragment2 tab2 = new TabFragment2();
            return tab2;
        case 2:
            TabFragment3 tab3 = new TabFragment3();
            return tab3;
        default:
            return null;
    }
}

    @Override
    public int getCount() {
        return mNumOfTabs;
    }
}

All with their respective xml.

Now with the photos, I want to click on another station, for example PRACA XV - CHARITAS and open a screen equal to the second photo but, of course, with different times and etc.

Now I want to add another button in the INITIAL SCREEN so that when the user presses it open another screen identical to this MAIN ACTIVITY only with other information. Like it was a MAIN ACTIVITY2.

I copied and pasted it by changing the id's and giving it a direct crash.

What can it be?

ERROR CODE WHEN CRASH

06-08 09: 06: 45,398 7073-7073 / com.aplicativos.facilita.teste E / AndroidRuntime: FATAL EXCEPTION: main                                                                               Process: com.aplicativos.facilita.teste, PID: 7073                                                                               android.content.ActivityNotFoundException: Unable to find explicit activity class {com.aplicativos.facilita.teste / com.aplicativos.facilita.teste.MainActivity1}; have you declared this activity in your AndroidManifest.xml?                                                                                   at android.app.Instrumentation.checkStartActivityResult (Instrumentation.java:1628)                                                                                   at android.app.Instrumentation.execStartActivity (Instrumentation.java:1424)                                                                                   at android.app.Activity.startActivityForResult (Activity.java:3424)                                                                                   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:3385)                                                                                   at android.support.v4.app.FragmentActivity.startActivityForResult (FragmentActivity.java:859)                                                                                   at android.app.Activity.startActivity (Activity.java:3627)                                                                                   at android.app.Activity.startActivity (Activity.java:3595)                                                                                   at $ 2.onClick (Initial.java:44)                                                                                   at android.view.View.performClick (View.java:4438)                                                                                   at android.view.View $ PerformClick.run (View.java:18422)                                                                                   at android.os.Handler.handleCallback (Handler.java:733)                                                                                   at android.os.Handler.dispatchMessage (Handler.java:95)                                                                                   at android.os.Looper.loop (Looper.java:136)                                                                                   at android.app.ActivityThread.main (ActivityThread.java:5001)                                                                                   at java.lang.reflect.Method.invokeNative (Native Method)                                                                                   at java.lang.reflect.Method.invoke (Method.java:515)                                                                                   at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run (ZygoteInit.java:785)                                                                                   at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:601)                                                                                   at dalvik.system.NativeStart.main (Native Method)

    
asked by anonymous 08.06.2017 / 14:29

0 answers