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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:29:44+00:00 2026-06-06T00:29:44+00:00

Has anyone met this error? Right now i am trying to do switch from

  • 0

Has anyone met this error?

Right now i am trying to do switch from first tab to second tab of a tab host in android/eclipse.But after getting run the emulator shown as The application Tab_testing has stopped unexpectedly” please try again later

Can anyone find a solution to this?

Please find my sources below.

main class source

public class Tab_testingActivity extends TabActivity 
{
 /** Called when the activity is first created. */

@Override      
public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.main);

   Resources res = getResources();                 
   TabHost tabHost = getTabHost();  // The activity TabHost
   TabHost.TabSpec spec;  // Resusable TabSpec for each tab
   Intent intent;  // Reusable Intent for each tab

   intent = new Intent().setClass(this, Activity_1.class);


    spec = tabHost.newTabSpec("first").setIndicator("First").setContent(intent);
    tabHost.addTab(spec);


    intent = new Intent().setClass(this, Activity_2.class);
    spec = tabHost.newTabSpec("second").setIndicator("Second").setContent(intent);
    tabHost.addTab(spec);

    tabHost.setCurrentTab(0);

    }
    }

*Activity_1*

 public class Activity_1 extends Activity {
EditText get;
Button save;
SharedPreferences sharedPreferences;

@Override
protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.main1);

    get=(EditText)findViewById(R.id.editText1);
    save=(Button)findViewById(R.id.button1);

    save.setOnClickListener(new View.OnClickListener() {

    public void onClick(View v) {

if(get.getText().toString().equalsIgnoreCase("")){
  Toast.makeText(getApplicationContext(), "enter something", Toast.LENGTH_SHORT).show();
  }
else
{
 sharedPreferences=PreferenceManager.getDefaultSharedPreferences(Activity_1.this);
 Editor editor1 = sharedPreferences.edit();
 editor1.remove("answer");
 editor1.commit();

 sharedPreferences=PreferenceManager.getDefaultSharedPreferences(Activity_1.this);
 Editor editor = sharedPreferences.edit();
 Log.i("set value",""+get.getText().toString());
 editor.putString("answer",get.getText().toString());
 editor.commit();}
    }
});
} 
}

*Activity_2*

public class Activity_2 extends Activity {
TextView set;
SharedPreferences sharedPreferences;

@Override
protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.main2);

    set=(TextView)findViewById(R.id.textView1);
}

@Override
protected void onResume() 
{
 sharedPreferences = PreferenceManager.getDefaultSharedPreferences(Activity_2.this);
 String answer= sharedPreferences.getString("answer", "");

 Log.v("get value",""+answer);

if(answer.equalsIgnoreCase(null))
{
set.setText("nothing to display");
}
else
{
set.setText(answer);
}
super.onResume();
} 
}

logcat

06-15 15:23:13.995: D/AndroidRuntime(523): Shutting down VM
06-15 15:23:13.995: W/dalvikvm(523): threadid=1: thread exiting with uncaught exception (group=0x40015560)
06-15 15:23:14.015: E/AndroidRuntime(523): FATAL EXCEPTION: main
06-15 15:23:14.015: E/AndroidRuntime(523): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.and.roid.host/com.and.roid.host.Tab_testingActivity}: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.and.roid.host/com.and.roid.host.Activity_1}; have you declared this activity in your AndroidManifest.xml?
06-15 15:23:14.015: E/AndroidRuntime(523):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
06-15 15:23:14.015: E/AndroidRuntime(523):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
06-15 15:23:14.015: E/AndroidRuntime(523):  at android.app.ActivityThread.access$1500(ActivityThread.java:117)
06-15 15:23:14.015: E/AndroidRuntime(523):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
06-15 15:23:14.015: E/AndroidRuntime(523):  at android.os.Handler.dispatchMessage(Handler.java:99)
06-15 15:23:14.015: E/AndroidRuntime(523):  at android.os.Looper.loop(Looper.java:123)
06-15 15:23:14.015: E/AndroidRuntime(523):  at android.app.ActivityThread.main(ActivityThread.java:3683)
06-15 15:23:14.015: E/AndroidRuntime(523):  at java.lang.reflect.Method.invokeNative(Native Method)
06-15 15:23:14.015: E/AndroidRuntime(523):  at java.lang.reflect.Method.invoke(Method.java:507)
06-15 15:23:14.015: E/AndroidRuntime(523):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
06-15 15:23:14.015: E/AndroidRuntime(523):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
06-15 15:23:14.015: E/AndroidRuntime(523):  at dalvik.system.NativeStart.main(Native Method)
06-15 15:23:14.015: E/AndroidRuntime(523): Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.and.roid.host/com.and.roid.host.Activity_1}; have you declared this activity in your AndroidManifest.xml?
06-15 15:23:14.015: E/AndroidRuntime(523):  at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1405)
06-15 15:23:14.015: E/AndroidRuntime(523):  at android.app.ActivityThread.resolveActivityInfo(ActivityThread.java:1457)
06-15 15:23:14.015: E/AndroidRuntime(523):  at android.app.LocalActivityManager.startActivity(LocalActivityManager.java:277)
06-15 15:23:14.015: E/AndroidRuntime(523):  at android.widget.TabHost$IntentContentStrategy.getContentView(TabHost.java:654)
06-15 15:23:14.015: E/AndroidRuntime(523):  at android.widget.TabHost.setCurrentTab(TabHost.java:326)
06-15 15:23:14.015: E/AndroidRuntime(523):  at android.widget.TabHost.addTab(TabHost.java:216)
06-15 15:23:14.015: E/AndroidRuntime(523):  at com.and.roid.host.Tab_testingActivity.onCreate(Tab_testingActivity.java:27)
06-15 15:23:14.015: E/AndroidRuntime(523):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
06-15 15:23:14.015: E/AndroidRuntime(523):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
06-15 15:23:14.015: E/AndroidRuntime(523):  ... 11 more
  • 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-06T00:29:46+00:00Added an answer on June 6, 2026 at 12:29 am

    Simple. Just register your Activity_1.java in you rmanifest file.

    In below of your <application> tag just mention your Activity_1.java like below

    <activity android:name=".Activity_1" />
    

    If you’ve more than one activities in your application, you should register all the activites like above one. for example –

    <activity android:name=".Activity_1" />
    <activity android:name=".Activity_2" />
    <activity android:name=".Activity_3" />
    .
    .
    .
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Has anyone met this problem ? I've checked the output of phpinfo() ,and see
Has anyone else had this issue and found a working solution? I've enabled the
Has anyone had this problem? I deleted a column in the table editor and
has anyone else experienced this . I have SP1 but i have to kill
Has anyone else experienced this? I have uninstalled and reinstalled TortoiseSVN as well as
Has anyone run perl script given at http://oreilly.com/pub/h/974#code ? This is a famous one,
Has anyone else out there had this problem and found a possible solution. Im
Has anyone actually succeeded in doing this it seems like there are so many
Has anyone heard of Chaperon? is it effective in preventing code theft? Now i
Has anyone created a custom Silverlight Splash screen to replace the blue balls circular

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.