How do I create a login screen and password in a fragment?

0

I'm creating an app for presentation in my school, nice as I have only this week to finish the app need to represent a trace of a particular bus, so for this I thought of a login screen and password, where in case instead of put a user, put the name of the line and in the password the number of the stop, clicking on search would lead me to the demonstrative result in another Activity, just to show how it would work. I created three tools inside my app now only this one is missing so I'm finished, I'm using a TabLayout with three tabs, which in this case are fragments. So I would like someone to give me a light because I've already reviewed the net and found nothing related. Thanks in advance

Remembering that I'm still a beginner in android programming

Here is the part code where I want to add the login and password

Java / Package / Screens / Screen1

public class tela1 extends Fragment {
    ListView lista;
    ArrayAdapter<String> adapter;

    public static tela1 novaInstancia() {return  new tela1();}
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View tela = inflater.inflate(R.layout.tela1, null);
        return tela;

    }

    @Override
    public String toString(){return "Localizar";}

Java / MainActivity

public class MainActivity extends AppCompatActivity implements TabLayout.OnTabSelectedListener {
    private TabLayout Guias;
    private ViewPager abreTela;
    int atualPosicao=0;

    @Override
    protected void onCreate(Bundle saveInstanceState){
        super.onCreate(saveInstanceState);
        setContentView(R.layout.activity_main);
        Toolbar toolbar = (Toolbar) findViewById(R.id.Ferramenta);
        setSupportActionBar(toolbar);
        //Abre páginas da guia
        abreTela = (ViewPager) findViewById(R.id.Paginas);
        carregaPaginas();
        //Configuração Guia
        Guias = (TabLayout) findViewById(R.id.Guias);
        Guias.setTabGravity(TabLayout.GRAVITY_FILL);
        Guias.setupWithViewPager(abreTela);
        Guias.addOnTabSelectedListener(this);

    }

    //Preencher páginas
    private void carregaPaginas()
    {
        QuadroAdaptador quadro=new QuadroAdaptador(getSupportFragmentManager());
        quadro.addPage(tela1.novaInstancia());
        quadro.addPage(tela2.novaInstancia());
        quadro.addPage(tela3.novaInstancia());
        abreTela.setAdapter(quadro);
    }

    @Override
    public void onTabSelected(TabLayout.Tab tab) {
        abreTela.setCurrentItem(atualPosicao=tab.getPosition());
    }

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

    }

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

    }

    public void tela3 (View view) {

        Intent intencao = new Intent(this, alvorada.class);
        startActivity(intencao);
    }

    public void tela3maracana (View view) {

        Intent intencao = new Intent(this,maracana.class);
        startActivity(intencao);
    }

    public void tela3res_salvacao (View view) {

        Intent intencao = new Intent(this, res_salvacao.class);
        startActivity(intencao);

    }

    public void telahorariosalvorada (View view){
        Intent intencao = new Intent(this, alvorada_horarios.class);
        startActivity(intencao);

    }
    public void telahorariomaracana (View view){
        Intent intencao = new Intent(this, Maracana_Horarios.class);
        startActivity(intencao);
    }

    public void telahorarioResSalvacao (View view){
        Intent intencao = new Intent(this,ResSalvacao_Horarios.class);
        startActivity(intencao);
    }


}

Layout / screen1.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent">

    <EditText
        android:id="@+id/onibus"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="122dp"
        android:ems="10"
        android:inputType="textPersonName"
        android:text="Ônibus"
        android:textColor="@android:color/darker_gray" />

    <EditText
        android:id="@+id/numerodaparada"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/onibus"
        android:layout_alignStart="@+id/onibus"
        android:layout_below="@+id/onibus"
        android:layout_marginTop="32dp"
        android:ems="10"
        android:inputType="textPersonName"
        android:text="Numero Da Parada"
        android:textColor="@android:color/darker_gray" />

    <Button
        android:id="@+id/buscar"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/numerodaparada"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="40dp"
        android:text="Buscar" />
</RelativeLayout>
    
asked by anonymous 17.04.2017 / 02:46

0 answers