Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 19 of 19

Thread: hii

  1. #1
    Member
    Join Date
    Feb 2014
    Posts
    36
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default hii

    anyone help me since m beginner to android anyone can give me a code to display 3 edittext to display firstname,middle name and
    lastname in another activity on clicking button


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,186
    Thanks
    49
    Thanked 2,172 Times in 2,145 Posts

    Default Re: hii

    Moved to Android section.
    give me a code
    You'll get code faster if you use an internet Search engine to find it.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Member
    Join Date
    Feb 2014
    Posts
    36
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: hii

    plz but also give me code im getting error see i drag and drop three edit text and one button but wen m pressing button message is coming hello world in second activity y i wnna to display fname mname lastname

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,186
    Thanks
    49
    Thanked 2,172 Times in 2,145 Posts

    Default Re: hii

    im getting error
    Please copy the full text of the error message and paste it here. It has important info about the error.
    If you don't understand my answer, don't ignore it, ask a question.

  5. #5
    Member
    Join Date
    Feb 2014
    Posts
    36
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default problem big

    [
    MainActivity.java
    package com.example.application;

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

    public class MainActivity extends Activity implements OnClickListener { public static final String key1 = "mainacativity.key1";
    public static final String key2 = "mainacativity.key2";
    public static final String key3 = " mainacativity.key3";
    EditText e1;
    EditText e2;
    EditText e3;
    Button bt;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    e1=(EditText)findViewById(R.id.fname);
    e2=(EditText)findViewById(R.id.mname);
    e3=(EditText)findViewById(R.id.lname);
    bt=(Button)findViewById(R.id.btn);
    bt.setOnClickListener(this);

    }

    @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;
    }

    @Override
    public void onClick(View arg0) {
    // TODO Auto-generated method stub
    Intent i=new Intent(this,NextActivity1.class);
    String fname=e1.getText().toString();
    String Mname=e2.getText().toString();
    String Lname=e3.getText().toString();
    i.putExtra(key1, fname);
    i.putExtra(key2, Mname);
    i.putExtra(key3, Lname);
    startActivity(i);

    }

    }



















    ][
    NextActivity1.java
    package com.example.application;

    import android.os.Bundle;
    import android.app.Activity;
    import android.content.Intent;
    import android.graphics.Color;
    import android.view.Menu;
    import android.widget.TextView;

    public class NextActivity1 extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_next_activity1);
    Intent i=getIntent();
    String fname=i.getStringExtra(MainActivity.key1);
    String mname=i.getStringExtra(MainActivity.key2);
    String lname=i.getStringExtra(MainActivity.key3);
    TextView t1=new TextView(this);
    TextView t2=new TextView(this);
    TextView t3=new TextView(this);
    t1.setText("Welcome"+fname);
    t2.setText(" Welcome" +mname);
    t3.setText("welcome"+lname);
    t1.setTextSize(30);
    t2.setTextSize(30);
    t3.setTextSize(30);
    t1.setTextColor(Color.BLUE);
    t2.setTextColor(Color.BLUE);
    t3.setTextColor(Color.BLUE);
    setContentView(t1);
    setContentView(t2);
    setContentView(t3);




    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.next_activity1, menu);
    return true;
    }

    }









    ]

    when i click on button its fname lmname,lname not geting display in second activity
    Last edited by AJAY KAMBLE; March 27th, 2014 at 11:42 AM.

  6. #6
    Member
    Join Date
    Feb 2014
    Posts
    36
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: hii

    [
    MainActivity.java
    package com.example.application;

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

    public class MainActivity extends Activity implements OnClickListener { public static final String key1 = "mainacativity.key1";
    public static final String key2 = "mainacativity.key2";
    public static final String key3 = " mainacativity.key3";
    EditText e1;
    EditText e2;
    EditText e3;
    Button bt;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    e1=(EditText)findViewById(R.id.fname);
    e2=(EditText)findViewById(R.id.mname);
    e3=(EditText)findViewById(R.id.lname);
    bt=(Button)findViewById(R.id.btn);
    bt.setOnClickListener(this);

    }

    @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;
    }

    @Override
    public void onClick(View arg0) {
    // TODO Auto-generated method stub
    Intent i=new Intent(this,NextActivity1.class);
    String fname=e1.getText().toString();
    String Mname=e2.getText().toString();
    String Lname=e3.getText().toString();
    i.putExtra(key1, fname);
    i.putExtra(key2, Mname);
    i.putExtra(key3, Lname);
    startActivity(i);

    }

    }



















    ][
    NextActivity1.java
    package com.example.application;

    import android.os.Bundle;
    import android.app.Activity;
    import android.content.Intent;
    import android.graphics.Color;
    import android.view.Menu;
    import android.widget.TextView;

    public class NextActivity1 extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_next_activity1);
    Intent i=getIntent();
    String fname=i.getStringExtra(MainActivity.key1);
    String mname=i.getStringExtra(MainActivity.key2);
    String lname=i.getStringExtra(MainActivity.key3);
    TextView t1=new TextView(this);
    TextView t2=new TextView(this);
    TextView t3=new TextView(this);
    t1.setText("Welcome"+fname);
    t2.setText(" Welcome" +mname);
    t3.setText("welcome"+lname);
    t1.setTextSize(30);
    t2.setTextSize(30);
    t3.setTextSize(30);
    t1.setTextColor(Color.BLUE);
    t2.setTextColor(Color.BLUE);
    t3.setTextColor(Color.BLUE);
    setContentView(t1);
    setContentView(t2);
    setContentView(t3);




    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.next_activity1, menu);
    return true;
    }

    }









    ]

    when i click on button its fname lmname,lname not geting display in second activity

    --- Update ---

    anyone help wen i click on button nothing happen it not go to 2nd0r nextactivity just stay at that page only

  7. #7
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,186
    Thanks
    49
    Thanked 2,172 Times in 2,145 Posts

    Default Re: hii

    Please edit your post and wrap your code with code tags:
    [code=java]
    YOUR CODE HERE
    [/code]
    to get highlighting and preserve formatting.
    If you don't understand my answer, don't ignore it, ask a question.

  8. #8
    Member
    Join Date
    Feb 2014
    Posts
    36
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: hii

    since m new i dontknow plz u help

  9. #9
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,186
    Thanks
    49
    Thanked 2,172 Times in 2,145 Posts

    Default Re: hii

    Here are the steps:
    1) edit the post
    2) insert the following line before the code:
    [code]
    3) insert the following line after the code:
    [/code]
    4)save the post
    If you don't understand my answer, don't ignore it, ask a question.

  10. #10
    Member
    Join Date
    Feb 2014
    Posts
    36
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: hii

    wat dou mean by insert the line before the code i just simply copy paste in this tag
     

  11. #11
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,186
    Thanks
    49
    Thanked 2,172 Times in 2,145 Posts

    Default Re: hii

    I listed 4 steps, which step(s) are you having problems with?
    If you don't understand my answer, don't ignore it, ask a question.

  12. #12
    Member
    Join Date
    Feb 2014
    Posts
    36
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: hii

     
    MainActivity.java
    package com.example.application;
     
    import android.os.Bundle;
    import android.app.Activity;
    import android.content.Intent;
    import android.view.Menu;
    import android.view.View;
    import android.view.View.OnClickListener;
    import android.widget.Button;
    import android.widget.EditText;
     
    public class MainActivity extends Activity implements OnClickListener { public static final String key1 = "mainactivity.key1";
    public static final String key2 = "mainactivity.key2";
    public static final String key3 = " mainactivity.key3";
    EditText e1;
    EditText e2;
    EditText e3;
    Button bt;
     
     
    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    e1=(EditText)findViewById(R.id.fname);
    e2=(EditText)findViewById(R.id.mname);
    e3=(EditText)findViewById(R.id.lname);
    bt=(Button)findViewById(R.id.btn);
    bt.setOnClickListener(this);
     
    }
     
    @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;
    }
     
    @Override
    public void onClick(View arg0) {
    // TODO Auto-generated method stub
    Intent i=new Intent(this,NextActivity1.class);
    String fname=e1.getText().toString();
    String Mname=e2.getText().toString();
    String Lname=e3.getText().toString();
    i.putExtra(key1, fname);
    i.putExtra(key2, Mname);
    i.putExtra(key3, Lname);
    startActivity(i);
     
    }
     
    }
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    ][
    NextActivity1.java
    package com.example.application;
     
    import android.os.Bundle;
    import android.app.Activity;
    import android.content.Intent;
    import android.graphics.Color;
    import android.view.Menu;
    import android.widget.TextView;
     
    public class NextActivity1 extends Activity {
     
    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_next_activity1);
    Intent i=getIntent();
    String fname=i.getStringExtra(MainActivity.key1);
    String mname=i.getStringExtra(MainActivity.key2);
    String lname=i.getStringExtra(MainActivity.key3);
    TextView t1=new TextView(this);
    TextView t2=new TextView(this);
    TextView t3=new TextView(this);
    t1.setText("Welcome"+fname);
    t2.setText(" Welcome" +mname);
    t3.setText("welcome"+lname);
    t1.setTextSize(30);
    t2.setTextSize(30);
    t3.setTextSize(30);
    t1.setTextColor(Color.BLUE);
    t2.setTextColor(Color.BLUE);
    t3.setTextColor(Color.BLUE);
    setContentView(t1);
    setContentView(t2);
    setContentView(t3);
     
     
     
     
    }
     
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.next_activity1, menu);
    return true;
    }
     
    }
    Last edited by AJAY KAMBLE; March 27th, 2014 at 02:00 PM.

  13. #13
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,186
    Thanks
    49
    Thanked 2,172 Times in 2,145 Posts

    Default Re: hii

    Ok, that's a good first step.
    Now the code has lost all of its formatting. None of the statements are indented to show the logic. All the statements should NOT start in the first column.

    Also there are two separate java files mixed in together. It'd be better if each java file was in its own set of code tags.
    If you don't understand my answer, don't ignore it, ask a question.

  14. #14
    Member
    Join Date
    Feb 2014
    Posts
    36
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: hii

    when i click on button its fname ,mname,lname not geting display in second activity
     
    --- Update ---
     
    anyone help wen i click on button nothing happen it not go to 2nd0r nextactivity just stay at that page only

  15. #15
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,186
    Thanks
    49
    Thanked 2,172 Times in 2,145 Posts

    Default Re: hii

    Putting your comments in code tags makes them harder to read. It'd be better if they were not in code tags.
    If you don't understand my answer, don't ignore it, ask a question.

  16. #16
    Member
    Join Date
    Feb 2014
    Posts
    36
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: hii

     
    sir m getting not error in this above code but wen i click on button after entering in edittext fname ,mname and lname nothing happen its not moving to nextactivity simply remaining on mainactivity only wen i run my project wen start avd


    --- Update ---

    plz make any changes if any possible changes in the code so i can get in nextactivity fname ,mname,lname if possible


    --- Update ---

    sir so watto do now then

  17. #17
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,186
    Thanks
    49
    Thanked 2,172 Times in 2,145 Posts

    Default Re: hii

    Please remove the code tags from your comments and questions. code tags should only go with code.

    The code has lost all of its formatting. None of the statements are indented to show the logic. All the statements should NOT start in the first column.

    Also there are two separate java files mixed in together. It'd be better if each java file was in its own set of code tags.
    If you don't understand my answer, don't ignore it, ask a question.

  18. #18
    Member
    Join Date
    Feb 2014
    Posts
    36
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: hii

     
    MainActivity.java
    package com.example.application;
     
    import android.os.Bundle;
    import android.app.Activity;
    import android.content.Intent;
    import android.view.Menu;
    import android.view.View;
    import android.view.View.OnClickListener;
    import android.widget.Button;
    import android.widget.EditText;
     
    public class MainActivity extends Activity implements OnClickListener { public static final String key1 = "mainacativity.key1";
    public static final String key2 = "mainacativity.key2";
    public static final String key3 = " mainacativity.key3";
    EditText e1;
    EditText e2;
    EditText e3;
    Button bt;
     
     
    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    e1=(EditText)findViewById(R.id.fname);
    e2=(EditText)findViewById(R.id.mname);
    e3=(EditText)findViewById(R.id.lname);
    bt=(Button)findViewById(R.id.btn);
    bt.setOnClickListener(this);
     
    }
     
    @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;
    }
     
    @Override
    public void onClick(View arg0) {
    // TODO Auto-generated method stub
    Intent i=new Intent(this,NextActivity1.class);
    String fname=e1.getText().toString();
    String Mname=e2.getText().toString();
    String Lname=e3.getText().toString();
    i.putExtra(key1, fname);
    i.putExtra(key2, Mname);
    i.putExtra(key3, Lname);
    startActivity(i);
     
    }
     
    }


    --- Update ---

     
     
     
    NextActivity1.java
    package com.example.application;
     
    import android.os.Bundle;
    import android.app.Activity;
    import android.content.Intent;
    import android.graphics.Color;
    import android.view.Menu;
    import android.widget.TextView;
     
    public class NextActivity1 extends Activity {
     
    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_next_activity1);
    Intent i=getIntent();
    String fname=i.getStringExtra(MainActivity.key1);
    String mname=i.getStringExtra(MainActivity.key2);
    String lname=i.getStringExtra(MainActivity.key3);
    TextView t1=new TextView(this);
    TextView t2=new TextView(this);
    TextView t3=new TextView(this);
    t1.setText("Welcome"+fname);
    t2.setText(" Welcome" +mname);
    t3.setText("welcome"+lname);
    t1.setTextSize(30);
    t2.setTextSize(30);
    t3.setTextSize(30);
    t1.setTextColor(Color.BLUE);
    t2.setTextColor(Color.BLUE);
    t3.setTextColor(Color.BLUE);
    setContentView(t1);
    setContentView(t2);
    setContentView(t3);
     
     
     
     
    }
     
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.next_activity1, menu);
    return true;
    }
     
    }
     
     
     
     
     
     
     
     
     
    ]

  19. #19
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,186
    Thanks
    49
    Thanked 2,172 Times in 2,145 Posts

    Default Re: hii

    The code has lost all of its formatting. None of the statements are indented to show the logic. All the statements should NOT start in the first column.

    I guess one out of three is better than none.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. HII
    By srishti19 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: April 19th, 2013, 07:33 AM
  2. hii
    By abhijit@92 in forum Member Introductions
    Replies: 3
    Last Post: November 26th, 2012, 06:02 AM
  3. hii friends....
    By khader in forum Member Introductions
    Replies: 2
    Last Post: July 15th, 2010, 07:09 AM
  4. Hii everyone
    By Rain in forum Member Introductions
    Replies: 2
    Last Post: April 8th, 2010, 03:09 AM