Subscribe via email

Enter your email address and get Latest Material :

Tag

%temp% Android Application to understand Activity Android Applicaton login button should remain disabled Android Program C Language GTU MCA Syllabus PPT/Notes C full ppt by keval nagaria C++ GTU MCA CPI/CGPA To Percentage Calculator Core JAVA GTU MCA Core Java Create Bootable USB flash Drive Using DISKPART utility Create USB Pen Drive Create an application that will create database with table of User credential. Create an application that will have spinner with list of animation names. On selecting animation name Create an application to call specific entered number by user in the EditText Create an application to make Insert Crimping DBMS GTU MCA Syllabus PPT/Note DISKPART DOS Command to Erase temp file DS GTU MCA Delete and retrieve operation on the database. Erase/Delete Temp file Ethernet FON GTU MCA FON Practical Solution FON Program Fundamental Of Networking GTU MCA PPT GTU Student FInd CPI/CGPA To Percentage Converter Intent Java Chapter Wise Slide Show For GTU MCA Student Sem-3 LAN Cable Online CPI/CGPA Converter/Calculator PL_SQL GTU MCA Syllabus PPT/Note RG45 Connector Read messages from the mobile and display it on the screen. SS(System Software) GTU MCA Understand Menu option. a. Create an application that will change color of the screen Understand resource folders : a. Create spinner with strings taken from resource folder b. On changing spinner value WTAD GTU MCA WTAD Practical Solution Web Technology And Application Development (WTAD) Windwos 7 USB Pen Drive application that will play a media file from the memory car application to send message between two emulators based on selected options from the menu. change image. delete temp file into C drive draw line on the screen as user drag his finger gtu mca android program open any URL inside the application and clicking on any link from that URl should not open Native browser but that URL should open the same screen. read file from asset folder and copy it in memory card. take picture using native application that animation should affect on the images displayed below. to pick up any image from the native application gallery and display it on the screen. update

Exercise : 2

To understand Activity, Intent
a. Create sample application with login module.(Check username and password)
b. On successful login, go to next screen. And on failing login, alert user using Toast.
c. Also pass username to next screen

Screen Shot:



XML :

main.xml :


    
        
        
            
        
        
        
        
        
    


JAVA :
SecondActivity.java :
package kmn.Second;

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

public class SecondActivity extends Activity implements OnClickListener
{
    /** @author GTU MCA PPT, www.gtumcappt.com */
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        Button login = (Button)findViewById(R.id.btnlogin);
        Button clear = (Button)findViewById(R.id.btnclear);
        login.setOnClickListener(this);
        clear.setOnClickListener(this);
    }
    public void onClick(View v)
    {
     EditText username = (EditText)findViewById(R.id.txtusername);
     EditText password =(EditText)findViewById(R.id.txtpassword);
     if(v.getId()==R.id.btnlogin)
     {
if(username.getText().toString().equals("keval") && password.getText().toString().equals("nagaria"))
      {
       //Toast.makeText(this, "ok", Toast.LENGTH_LONG).show();
       Intent i = new Intent(this,S2.class);
       i.putExtra("username", username.getText().toString());
       startActivity(i);
      }
      else
      {
       Toast.makeText(this, "Error", Toast.LENGTH_LONG).show();
      }
     }
     if(v.getId()==R.id.btnclear)
     {
      username.setText("");
      password.setText("");
     }
    }
}

S2.java :
package kmn.Second;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;

public class S2 extends Activity 
{
    /** @author GTU MCA PPT, www.gtumcappt.com */
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        Intent i = getIntent();
        //Toast.makeText(this, "Welcome",Toast.LENGTH_LONG).show();
        String username=i.getStringExtra("username");       
        TextView tv=new TextView(this);
        Button btnBack = new Button(this);
        btnBack.setText("Back");
        tv.setText("Welcome "+username+" !");
        tv.setTextColor(Color.rgb(255, 255, 100));            
        tv.setTextSize(25);
        LinearLayout ll = new LinearLayout(this);
  ll.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,      LayoutParams.FILL_PARENT));
        ll.setOrientation(LinearLayout.VERTICAL);
        ll.addView(tv);
        ll.addView(btnBack);
        setContentView(ll);
        
        btnBack.setOnClickListener(new Button.OnClickListener()
        {
         public void onClick(View v)
         {
          setContentView(R.layout.main);
         }        
        });
 }

}

Related Posts Plugin for WordPress, Blogger...