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

The Archive Base Latest Questions

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

i am self_learner to android. I have two screens.The first screen contains one edittext

  • 0

i am self_learner to android.

I have two screens.The first screen contains one edittext and a button,the edittext is to get the input from the user and button is to call the tabhost’s activity which is on the second screen.

During run time, after getting input from the user,it should show the appropriate values (as per the user’s input) to any one of the tab of a tabhost which is on the second screen.

But here my problem is,its showing the answer on the separate screen,not on the tabhost format.

NOTE: In the below code i guess only the problem is on using the shared preference to store and display the data to tabhost.please can any one help me?

Please find code below

Demo_tabActivity.java

  public class Demo_tabActivity extends Activity 
     {

private static String NAMESPACE = "http://tempuri.org/";
   private static String METHOD_NAME = "FahrenheitToCelsius";
   private static String SOAP_ACTION = "http://tempuri.org/FahrenheitToCelsius";
   private static String URL = "http://www.w3schools.com/webservices/tempconvert.asmx?WSDL";

   Button btnFar;
   EditText txtFar,txtshow;


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

       txtFar = (EditText)findViewById(R.id.editText_in);

       btnFar = (Button)findViewById(R.id.button1);
       btnFar.setOnClickListener(new View.OnClickListener()
       {
       public void onClick(View v)
       {
           String b;

         //Initialize soap request + add parameters
         SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);       

         //Use this to add parameters
         request.addProperty("Fahrenheit",txtFar.getText().toString());

         //Declare the version of the SOAP request
         SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);

         envelope.setOutputSoapObject(request);
         envelope.dotNet = true;

         try 
         {   
             HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);

             //this is the actual part that will call the webservice
             androidHttpTransport.call(SOAP_ACTION, envelope);

             // Get the SoapResult from the envelope body.

             SoapPrimitive result = (SoapPrimitive)envelope.getResponse();

             SharedPreferences sharedPreferences;
              sharedPreferences=PreferenceManager.getDefaultSharedPreferences(Demo_tabActivity.this);
             Editor editor = sharedPreferences.edit();
             editor.putString("your", "b");
             editor.commit();

             if(result != null)
             {
                 b=result.toString();
                 Intent i = new Intent(getApplicationContext(),Tab_1.class);
                 i.putExtra("goto", b.toString());
                 startActivity(i);
             }
             else
             {
                 Toast.makeText(getApplicationContext(), "oops!..empty",Toast.LENGTH_SHORT).show();
             }

           }
         catch (Exception e)
         {
           e.printStackTrace();
           }
         }
       });   

   }
 }

Tab_1.java

   public class Tab_1 extends Activity 
    {
EditText tv;
String result;


     /** Called when the activity is first created. */

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

SharedPreferences sharedPreferences;
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(Tab_1.this);
String answer= sharedPreferences.getString("your","");

Bundle extras = getIntent().getExtras();

if(extras !=null)
{
    result = extras.getString("goto");

}
tv=(EditText)findViewById(R.id.editText_output);
tv.setText(result);
}
  }

Thanks for your precious time!!

  • 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:45:41+00:00Added an answer on June 6, 2026 at 12:45 am

    okay. let me explain it briefly first.

    When you call startActivity() it simply means you are trying to call Activity class. But it doesn’t mean that you will be able to have your tab bar in all the screens you navigate to. Because tabs are related to the tabActivity and which means its totally separate from the normal activity. So to have your Tabs visible in all the pages, you have to replace the views thus staying in the same tabActivity.

    So the first step is to get the next activity which you want to display as a view and add it to the tabs. This is what Activity Group is emant to do. Here is a very good example of how to understand ActivityGroup.

    ActivityGroup Example

    To make this more easier, Fragments are introduced. it does the same operation as Activity Group(to replace views). here are few examples,

    http://android.codeandmagic.org/2011/07/android-tabs-with-fragments/

    http://developer.android.com/resources/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentTabs.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is the situation: I have to create a program that would input another
I'm trying to self-study C using C Primer Plus from Stephen Prata and one
I m trying to create a tutorial video from ipad screen as done in
I am self learner to android. Right now i have five pages in an
def self.get(server) return unless server server = server.to_s if klass = @handlers[server] obj =
I have recently started applying for .Net jobs. I currently work in a sales
I'm using the Drupal Quiz module, and have setup some basic quizzes and stuff
I have an application, which displays me some data. I need to attach to
I have an application, which displays me some data. I need to attach to
I first learned about Data, context, and interaction (DCI) through this blog post .

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.