Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9205291
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:55:07+00:00 2026-06-17T23:55:07+00:00

I am using Linear Layout(Horizontal) for my Android application. I am using two buttons

  • 0

I am using Linear Layout(Horizontal) for my Android application. I am using two buttons for my screen which I have called as Chat and Draw. I want to display a second activity on clicking on Chat button in which I have an area for editText and a corresponding button called as Enter for entering the text.

In the DisplayMessageActivity class which I am using for Chat button, I have created the layout for editText and Enter button too. But however, on clicking on Chat I am not being able to see the area for editText and the button Enter.

Code in MainActivity.java :

public class MainActivity extends Activity {

public final static String EXTRA_MESSAGE = "com.example.appfirst.MESSAGE";

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
}

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


public void chatMessage(View view) {
    Intent intent_chat = new Intent(this, DisplayMessageActivity.class);
    startActivity(intent_chat);
}

public void drawing(View view) {
    Intent intent_draw = new Intent(this, DisplayMessageActivity.class);
    startActivity(intent_draw);
}

}

code in DisplayMessageActivity.java :

public class DisplayMessageActivity extends Activity {

@SuppressLint("NewApi")

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);        

}


@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case android.R.id.home:
        NavUtils.navigateUpFromSameTask(this);
        return true;
    }
    return super.onOptionsItemSelected(item);
}

}

What code should I write in the OnCreate function of DisplayMessageActivity class so that I am able to get the desired view ?

Can someone help me with the code. I am totally new to Android Development Framework. Thanks and Regards.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T23:55:08+00:00Added an answer on June 17, 2026 at 11:55 pm

    From your post i understand that u have 2 layouts 1 with 2 buttons "Chat" and "Draw".And when clicking chat u have to call another activity with Edittext and Enter button in it.If this is the case you simply call the Intent.

    Intent intent=new Intent(this,yourclass.class);
    startactivity(intent);
    

    In Oncreate of your DisplayMessage do the following:

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState); 
         setContentView(R.layout.YourXml.Xml);       
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have 4 buttons in a horizontal linear layout. I'd like the right edge
I have the following XML layout in my android application, using ScrollView: <?xml version=1.0
I want to create a layout for my android application using inheritance i.e. every
I have a complex layout situation in which an horizontal LinearLayout holds two other
I have a Linear Layout with 2 buttons of equal weights. So they occupy
How do I design an android application with two buttons next to each other
I am using a linear layout to display a pretty light initial screen. It
I have a problem with my Android application. When I'm using my hp touchpad,
I'm developing an app for Android using mvvmcross. In this application I want to
I have this as part of my layout: <LinearLayout android:layout_width=fill_parent android:layout_height=0dip android:orientation=horizontal android:layout_weight=0.15> <TextView

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.