Click here to Skip to main content
15,885,985 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
activity.xml
XML
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android">
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/LinearLayout1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:c&gt;

    <textview>
        android:id="@+id/textView1"
        android:layout_width="wrap_c/&gt;

    <textview>
        android:id="@+id/textView2"
        android:layout_width="wrap_c/&gt;

    <edittext>
        android:id="@+id/editText1"
        android:layout_width="279dp"
        android:layout_height="wrap_c/&gt;

    <textview>
        android:id="@+id/textView3"
        android:layout_width="wrap_c/&gt;

    <edittext>
        android:id="@+id/editText2"
        android:layout_width="279dp"
        android:layout_height="wrap_c&gt;

        <requestfocus />
    </edittext>

    &lt;Button
        android:id="@+id/button2"
        android:layout_width="wrap_c/&gt;

    <checkbox>
        android:id="@+id/checkBox1"
        android:layout_width="wrap_c/&gt;

    &lt;Button
        android:id="@+id/button3"
        android:layout_width="wrap_c/&gt;

    &lt;Button
        android:id="@+id/button1"
        android:layout_width="wrap_c/&gt;

</checkbox></textview></edittext></textview></textview></linearlayout>





MainActivity.java
package com.example.personaltracker;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.TextView;


public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        
        final TextView PET = (TextView) findViewById(R.id.textView1);
        TextView Username = (TextView) findViewById(R.id.textView2);
        TextView Password = (TextView) findViewById(R.id.textView3);
        Button forgotpassword = (Button) findViewById(R.id.button3);
        final EditText username = (EditText) findViewById(R.id.editText1);
        final EditText password = (EditText) findViewById(R.id.editText2);
        Button register = (Button) findViewById(R.id.button1);
        CheckBox stayloggedin = (CheckBox) findViewById(R.id.checkBox1);
        Button login = (Button) findViewById(R.id.button2);
        
        login.setOnClickListener(new OnClickListener(){

			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				Intent intent = new Intent(getBaseContext(),main_page.class);
				startActivity(intent);
			}
        	
        });
        
        register.setOnClickListener(new OnClickListener(){

			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				Intent intent = new Intent(getBaseContext(),register.class);
				startActivity(intent);
			}
        	
        });
        
        forgotpassword.setOnClickListener(new OnClickListener(){

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent intent = new Intent(getBaseContext(),forgot_password.class);
				startActivity(intent);
			}
        	
        });
  
        
        
    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }
    
}
Posted
Updated 23-Sep-14 0:59am
v2
Comments
Member 11096292 23-Sep-14 6:58am    
this is not a homework or assignment, i just interested in designing an app

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900