欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

First project in android androidjavalogin 

程序员文章站 2022-04-28 21:20:16
...

Yesterday i learned how to program and make  application using 

 

Android in eclipse 
i just learned the basics of it .
1) how to design ,add buttons , layouts,textfeilds ,pictures...etc
2)how to jump from page to page using onClickListener and intent . 

 

Steps for creating new project.

 

First step is to create new android application

 

1.File->New->Android application project;

 

2.Write the Application name;

 

3.minimum required SDK and target SDK change it to android 4.0;

 

4.next->next

 

5.Configure launcher icon (change the icon of your application as you like, adding picture, change the shape…etc.

 

6. create activity you can choose anything you want.

 

7. next-> finish.

 

 

According to my understanding, I wrote a very simple login application named it Funny. Firstly if the user has an account and he/she inputs the right account then click the login yellow button-First project in android
            
    
    
        androidjavalogin this means login- It will jump to the next page and Welcome the user for entering the page.- First project in android
            
    
    
        androidjavalogin it means welcome to my page-

I used onClickListener and intent for doing this function.

 

Second If the user don’t have account, he/she will register for new account so I add another button for this function (gray button)-First project in android
            
    
    
        androidjavalogin this button means signup -. when the user click this button it will jump to the register page.
First project in android
            
    
    
        androidjavalogin 
 

First line means enter name ;

Second means enter the password;

Third enter your email address;

 

 

 

 

I made a very simple application because my laptop is too slow , every step really takes a long time .I hope that I will improve my application and make it more creative.

 

These are my pages.

 

First project in android
            
    
    
        androidjavalogin   First project in android
            
    
    
        androidjavalogin 
   
 


First project in android
            
    
    
        androidjavalogin 

When I finished this program I remember that I have to change the buttons in the first page to like the button in the register page but I found an error .

 

Unfortunately, Funny has stopped.

the error was because of unused linear veiw. 

 

 
 
 this is my code:

package com.example.funny;





public class Secondpage extends Activity{
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_second);
	}

}

 
 
 

package com.example.funny;


public class MainActivity extends Activity {
	Button login;
	Button signup;
	EditText account;
	TextView check;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		signup=(Button)super.findViewById(R.id.signup);
		login=(Button)super.findViewById(R.id.login);
		account=(EditText)super.findViewById(R.id.account);
		check=(TextView)super.findViewById(R.id.check);
		
	login.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if(account.getText().toString().equals("8888")){
				check.setText(account.getText());
				
				  
				  				Intent t=new Intent(MainActivity.this,Secondpage.class);			
				  				MainActivity.this.startActivity(t);
				}
				
			}
		});
	
	signup.setOnClickListener(new OnClickListener() {
		
		@Override
		public void onClick(View v) {
			// TODO Auto-generated method stub
		
			
			  
			  				Intent t=new Intent(MainActivity.this,Register.class);			
			  				MainActivity.this.startActivity(t);
		
			
		}
	});
	}

	
	
}

 

package com.example.funny;



public class Register extends Activity{

	
protected void onCreate(Bundle savedInstanceState) {
			super.onCreate(savedInstanceState);
			setContentView(R.layout.activity_register);
		}


}

 
 
I found some difficulties because Arabic language starts from right to left opposite to English .

  • First project in android
            
    
    
        androidjavalogin 
  • 大小: 15.6 KB
  • First project in android
            
    
    
        androidjavalogin 
  • 大小: 721 Bytes
  • First project in android
            
    
    
        androidjavalogin 
  • 大小: 847 Bytes
  • First project in android
            
    
    
        androidjavalogin 
  • 大小: 1.4 KB
  • First project in android
            
    
    
        androidjavalogin 
  • 大小: 2.9 KB
  • First project in android
            
    
    
        androidjavalogin 
  • 大小: 16.6 KB
  • First project in android
            
    
    
        androidjavalogin 
  • 大小: 12.8 KB