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 6857271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:59:43+00:00 2026-05-27T01:59:43+00:00

1.First Activity : This Activity has two EditTexts and two Buttons . I need

  • 0

1.First Activity :
This Activity has two EditTexts and two Buttons.
I need to give login id and password.Here
the Buttons contained logging in and cancel:

package com.samelayout;
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;
public class SameLayoutActivity extends Activity {
    /** Called when the activity is first created. */
    EditText Myusername;
    EditText Mypassword;
    Button btnlogin;
    Button btncancel;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        btnlogin=(Button)findViewById(R.id.loginbutton);
        btncancel=(Button)findViewById(R.id.cancelbutton);
        Myusername=(EditText)findViewById(R.id.username);
        Mypassword=(EditText)findViewById(R.id.password);    
        btnlogin.setOnClickListener(new OnClickListener()
        {           public void onClick(View v) {
                String str1=Myusername.getText().toString();
                String str2=Mypassword.getText().toString();
                Intent int1=new Intent(getApplicationContext(),Login.class);
                Bundle b= new Bundle();
                b.putString("userdata", str1);
                b.putString("userdata1", str2);
                int1.putExtras(b);
                int1.putExtras(b);
                //(int1);
                startActivityForResult(int1, 0);
            }
        });
    btncancel.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            // TODO Auto-generated method stub
            finish();
        }
    });  
    }
}

2.second Activity:
This Activity retrieves the data from the first Activity. I need to show user details to second xml file

package com.samelayout;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class Login extends Activity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.login);
        //Intent int1= getIntent();
        Bundle b=this.getIntent().getExtras();
        if(b!=null)
        {
            String str1=b.getString("userdata");
            String str2=b.getString("userdata1");
            TextView tv1=(TextView)findViewById(R.id.text1);
            TextView tv2=(TextView)findViewById(R.id.text2);
            tv1.setText(str1);
            tv2.setText(str2);
            setContentView(tv1);
            setContentView(tv2); }
    } }

3.main.xml here:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/Linearlayout"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:weightSum="1"
    android:background="@android:color/darker_gray" >

        <TextView android:layout_width="fill_parent" 
        android:text="Employee ID:" 
        android:layout_height="wrap_content" 
        android:textColor="#0000FF" 
        android:textSize="20sp"/>

        <EditText android:hint="enter ur ID" 
        android:singleLine="true"
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:id="@+id/username"/>

        <TextView android:layout_width="fill_parent" 
        android:text="Password:" 
        android:layout_height="wrap_content" 
        android:textColor="#0000FF" 
        android:textSize="20dip"/>

        <EditText android:singleLine="true" 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:id="@+id/password" 
        android:password="true"/>

        <Button 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:text="Submit" 
        android:id="@+id/loginbutton"/>

        <Button 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:text="Cancel" 
        android:id="@+id/cancelbutton"/>
      </LinearLayout>

4.needed output can be displayed here:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/Linearlayout"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:weightSum="1"
    android:background="@android:color/darker_gray" >

    <TextView 
        android:layout_width="fill_parent" 
        android:id="@+id/text1"
        android:text="Employee Name:" 
        android:layout_height="wrap_content" 
        android:textColor="#0000FF" 
        android:textSize="20sp"/>
    <TextView 
        android:layout_width="fill_parent" 
        android:id="@+id/text2"
        android:text="Employee password:" 
        android:layout_height="wrap_content" 
        android:textColor="#0000FF" 
        android:textSize="20sp"/>

    </LinearLayout>

5.this is my Logcat getting errors

11-22 12:04:27.298: W/KeyCharacterMap(334): No keyboard for id 0
11-22 12:04:27.298: W/KeyCharacterMap(334): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
11-22 12:04:37.738: D/AndroidRuntime(334): Shutting down VM
11-22 12:04:37.738: W/dalvikvm(334): threadid=1: thread exiting with uncaught exception (group=0x40015560)
11-22 12:04:37.758: E/AndroidRuntime(334): FATAL EXCEPTION: main
11-22 12:04:37.758: E/AndroidRuntime(334): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.samelayout/com.samelayout.Login}; have you declared this activity in your AndroidManifest.xml?
11-22 12:04:37.758: E/AndroidRuntime(334):  at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1405)
11-22 12:04:37.758: E/AndroidRuntime(334):  at android.app.Instrumentation.execStartActivity(Instrumentation.java:1379)
11-22 12:04:37.758: E/AndroidRuntime(334):  at android.app.Activity.startActivityForResult(Activity.java:2827)
11-22 12:04:37.758: E/AndroidRuntime(334):  at com.samelayout.SameLayoutActivity$1.onClick(SameLayoutActivity.java:41)
11-22 12:04:37.758: E/AndroidRuntime(334):  at android.view.View.performClick(View.java:2485)
11-22 12:04:37.758: E/AndroidRuntime(334):  at android.view.View$PerformClick.run(View.java:9080)
11-22 12:04:37.758: E/AndroidRuntime(334):  at android.os.Handler.handleCallback(Handler.java:587)
11-22 12:04:37.758: E/AndroidRuntime(334):  at android.os.Handler.dispatchMessage(Handler.java:92)
11-22 12:04:37.758: E/AndroidRuntime(334):  at android.os.Looper.loop(Looper.java:123)
11-22 12:04:37.758: E/AndroidRuntime(334):  at android.app.ActivityThread.main(ActivityThread.java:3683)
11-22 12:04:37.758: E/AndroidRuntime(334):  at java.lang.reflect.Method.invokeNative(Native Method)
11-22 12:04:37.758: E/AndroidRuntime(334):  at java.lang.reflect.Method.invoke(Method.java:507)
11-22 12:04:37.758: E/AndroidRuntime(334):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
11-22 12:04:37.758: E/AndroidRuntime(334):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
11-22 12:04:37.758: E/AndroidRuntime(334):  at dalvik.system.NativeStart.main(Native Method)
11-22 12:04:42.079: I/Process(334): Sending signal. PID: 334 SIG: 9
11-22 14:46:39.458: W/KeyCharacterMap(377): No keyboard for id 0
11-22 14:46:39.458: W/KeyCharacterMap(377): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
11-22 14:46:42.309: D/AndroidRuntime(377): Shutting down VM
11-22 14:46:42.309: W/dalvikvm(377): threadid=1: thread exiting with uncaught exception (group=0x40015560)
11-22 14:46:42.329: E/AndroidRuntime(377): FATAL EXCEPTION: main
11-22 14:46:42.329: E/AndroidRuntime(377): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.samelayout/com.samelayout.Login}; have you declared this activity in your AndroidManifest.xml?
11-22 14:46:42.329: E/AndroidRuntime(377):  at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1405)
11-22 14:46:42.329: E/AndroidRuntime(377):  at android.app.Instrumentation.execStartActivity(Instrumentation.java:1379)
11-22 14:46:42.329: E/AndroidRuntime(377):  at android.app.Activity.startActivityForResult(Activity.java:2827)
11-22 14:46:42.329: E/AndroidRuntime(377):  at com.samelayout.SameLayoutActivity$1.onClick(SameLayoutActivity.java:38)
11-22 14:46:42.329: E/AndroidRuntime(377):  at android.view.View.performClick(View.java:2485)
11-22 14:46:42.329: E/AndroidRuntime(377):  at android.view.View$PerformClick.run(View.java:9080)
11-22 14:46:42.329: E/AndroidRuntime(377):  at android.os.Handler.handleCallback(Handler.java:587)
11-22 14:46:42.329: E/AndroidRuntime(377):  at android.os.Handler.dispatchMessage(Handler.java:92)
11-22 14:46:42.329: E/AndroidRuntime(377):  at android.os.Looper.loop(Looper.java:123)
11-22 14:46:42.329: E/AndroidRuntime(377):  at android.app.ActivityThread.main(ActivityThread.java:3683)
11-22 14:46:42.329: E/AndroidRuntime(377):  at java.lang.reflect.Method.invokeNative(Native Method)
11-22 14:46:42.329: E/AndroidRuntime(377):  at java.lang.reflect.Method.invoke(Method.java:507)
11-22 14:46:42.329: E/AndroidRuntime(377):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
11-22 14:46:42.329: E/AndroidRuntime(377):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
11-22 14:46:42.329: E/AndroidRuntime(377):  at dalvik.system.NativeStart.main(Native Method)
11-22 14:48:22.648: D/AndroidRuntime(411): Shutting down VM
11-22 14:48:22.648: W/dalvikvm(411): threadid=1: thread exiting with uncaught exception (group=0x40015560)
11-22 14:48:22.657: E/AndroidRuntime(411): FATAL EXCEPTION: main
11-22 14:48:22.657: E/AndroidRuntime(411): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.samelayout/com.samelayout.Login}; have you declared this activity in your AndroidManifest.xml?
11-22 14:48:22.657: E/AndroidRuntime(411):  at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1405)
11-22 14:48:22.657: E/AndroidRuntime(411):  at android.app.Instrumentation.execStartActivity(Instrumentation.java:1379)
11-22 14:48:22.657: E/AndroidRuntime(411):  at android.app.Activity.startActivityForResult(Activity.java:2827)
11-22 14:48:22.657: E/AndroidRuntime(411):  at com.samelayout.SameLayoutActivity$1.onClick(SameLayoutActivity.java:38)
11-22 14:48:22.657: E/AndroidRuntime(411):  at android.view.View.performClick(View.java:2485)
11-22 14:48:22.657: E/AndroidRuntime(411):  at android.view.View$PerformClick.run(View.java:9080)
11-22 14:48:22.657: E/AndroidRuntime(411):  at android.os.Handler.handleCallback(Handler.java:587)
11-22 14:48:22.657: E/AndroidRuntime(411):  at android.os.Handler.dispatchMessage(Handler.java:92)
11-22 14:48:22.657: E/AndroidRuntime(411):  at android.os.Looper.loop(Looper.java:123)
11-22 14:48:22.657: E/AndroidRuntime(411):  at android.app.ActivityThread.main(ActivityThread.java:3683)
11-22 14:48:22.657: E/AndroidRuntime(411):  at java.lang.reflect.Method.invokeNative(Native Method)
11-22 14:48:22.657: E/AndroidRuntime(411):  at java.lang.reflect.Method.invoke(Method.java:507)
11-22 14:48:22.657: E/AndroidRuntime(411):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
11-22 14:48:22.657: E/AndroidRuntime(411):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
11-22 14:48:22.657: E/AndroidRuntime(411):  at dalvik.system.NativeStart.main(Native Method)
11-22 14:59:44.668: W/KeyCharacterMap(441): No keyboard for id 0
11-22 14:59:44.668: W/KeyCharacterMap(441): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
11-22 14:59:53.378: D/AndroidRuntime(441): Shutting down VM
11-22 14:59:53.388: W/dalvikvm(441): threadid=1: thread exiting with uncaught exception (group=0x40015560)
11-22 14:59:53.411: E/AndroidRuntime(441): FATAL EXCEPTION: main
11-22 14:59:53.411: E/AndroidRuntime(441): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.samelayout/com.samelayout.Login}; have you declared this activity in your AndroidManifest.xml?
11-22 14:59:53.411: E/AndroidRuntime(441):  at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1405)
11-22 14:59:53.411: E/AndroidRuntime(441):  at android.app.Instrumentation.execStartActivity(Instrumentation.java:1379)
11-22 14:59:53.411: E/AndroidRuntime(441):  at android.app.Activity.startActivityForResult(Activity.java:2827)
11-22 14:59:53.411: E/AndroidRuntime(441):  at com.samelayout.SameLayoutActivity$1.onClick(SameLayoutActivity.java:38)
11-22 14:59:53.411: E/AndroidRuntime(441):  at android.view.View.performClick(View.java:2485)
11-22 14:59:53.411: E/AndroidRuntime(441):  at android.view.View$PerformClick.run(View.java:9080)
11-22 14:59:53.411: E/AndroidRuntime(441):  at android.os.Handler.handleCallback(Handler.java:587)
11-22 14:59:53.411: E/AndroidRuntime(441):  at android.os.Handler.dispatchMessage(Handler.java:92)
11-22 14:59:53.411: E/AndroidRuntime(441):  at android.os.Looper.loop(Looper.java:123)
11-22 14:59:53.411: E/AndroidRuntime(441):  at android.app.ActivityThread.main(ActivityThread.java:3683)
11-22 14:59:53.411: E/AndroidRuntime(441):  at java.lang.reflect.Method.invokeNative(Native Method)
11-22 14:59:53.411: E/AndroidRuntime(441):  at java.lang.reflect.Method.invoke(Method.java:507)
11-22 14:59:53.411: E/AndroidRuntime(441):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
11-22 14:59:53.411: E/AndroidRuntime(441):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
11-22 14:59:53.411: E/AndroidRuntime(441):  at dalvik.system.NativeStart.main(Native Method)
11-22 15:04:53.512: I/Process(441): Sending signal. PID: 441 SIG: 9

6.android manifest file:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.samelayout"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="10" />

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name">
        <activity
            android:label="@string/app_name"
            android:name=".SameLayoutActivity" >
            <intent-filter >
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity

            android:name=".Login" >
            <intent-filter >
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

    </application>

</manifest>
  • 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-05-27T01:59:44+00:00Added an answer on May 27, 2026 at 1:59 am

    In SameLayoutActivity replace this,

     btnlogin.setOnClickListener(new OnClickListener()
            {           public void onClick(View v) {
                    String str1=Myusername.getText().toString();
                    String str2=Mypassword.getText().toString();
                    Intent int1=new Intent(SameLayoutActivity.this,Login.class);
                    Bundle b= new Bundle();
                    b.putString("userdata", str1);
                    b.putString("userdata1", str2);
                    int1.putExtras(b);
                    //(int1);
                    startActivityForResult(int1, 0);
                }
            });
    

    In your Login Activity, Replace this code, And try again and let me know what happen ..

      TextView tv1=(TextView)findViewById(R.id.text1);
      TextView tv2=(TextView)findViewById(R.id.text2);
    if(b!=null)
            {
                String str1=b.getString("userdata");
                String str2=b.getString("userdata1");
    
                tv1.setText(str1);
                tv2.setText(str2);
                }
        }
    

    Manifest file:

        <uses-sdk android:minSdkVersion="10" />
    
        <application
            android:icon="@drawable/ic_launcher"
            android:label="@string/app_name">
            <activity
                android:label="@string/app_name"
                android:name=".SameLayoutActivity" >
                <intent-filter >
                    <action android:name="android.intent.action.MAIN" />
    
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
            <activity android:name=".Login"> </activity>
        </application>
    
    </manifest>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question actually has two parts. The first part: I've been developing my first
In my project I have two activities or classes. In first activity I have
I've a workflow that has two receive activities in a pick activity. Whenever I
Hey, I have a TabHost with two tabs, each with an Activity. The first
I have an Android Honeycomb application with two activities; the first one has a
I have 3 activity in my application. My first activity (Main) has 2 button
In my App, first it shows a splash screen. After that another activity, then
First off, there's a bit of background to this issue available on my blog:
First let me say that I really feel directionless on this question. I am
Hi Ive written a simple android application with two xml pages, one has an

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.