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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T02:27:09+00:00 2026-06-06T02:27:09+00:00

THE QUESTION Is it possible to run one tab from a different Activity or

  • 0

THE QUESTION

Is it possible to run one tab from a different Activity or Java file than the other three, thus allowing me to connect the second Activity to the server that is running off of the first.

Some information on my app

What I have is a multiple tabbed app, with a few different layouts. One of them is an interactive graphical layout. On this tab most of it needs to be a custom view that I have set up to work already but I need a row of widgets on the bottom like buttons, sliders etc. I am now at the point where if I run the graphical layout by setting it as the main activity (android:name=".Tab3Activity") in the manifest the app will run and print out text when I click on the button how ever if I run it from the tab as I need it to run the app will crash when I click on the button. Here is the code I have currently

Tab set up

    th.setup();
    TabSpec specs = th.newTabSpec("tag0");
    specs.setContent(R.id.connecttionTab);
    specs.setIndicator("Connection Tab");
    th.addTab(specs);
    specs = th.newTabSpec("tag1");
    specs.setContent(R.id.tab1);
    specs.setIndicator("Zone Manager");
    th.addTab(specs);
    specs = th.newTabSpec("tag2");
    specs.setContent(R.id.tab2);
    specs.setIndicator("",res.getDrawable(R.drawable.ic_tab_vaccontrol));
    th.addTab(specs);
    //Intent intent = new Intent().setClass(this, Tab3Activity.class); tryed using this but
    //with this tab goes ontop of all the other ones and still doesnt work.
    TabSpec spec = th.newTabSpec("Tab3").setIndicator("Graphical Layout").setContent(R.id.tab3);
    th.addTab(spec);

Tab3Activity

public class Tab3Activity extends Activity 
{
    private Tab3 mTab3;
    @Override
    protected void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.tab3);
        mTab3 = (Tab3) findViewById(R.id.tab3_display);
    }

    public void onAddZone(View view)
    {
        mTab3.addZone();
    }
}

Tab3 (view class)

public class Tab3 extends View implements OnTouchListener
{
    public Tab3(Context context, AttributeSet attrs)
    {
        super (context, attrs);
        setFocusable(true);
        setFocusableInTouchMode(true); 
        setOnTouchListener(this);
        requestFocus();
    }
    @Override
    protected void onDraw(Canvas canvas)
    {
        super.onDraw(canvas);
        //drawings
        invalidate();
    }
    @Override
    public boolean onTouch(View v, MotionEvent event) 
    {
        //onTouch
        return true;
    }   
    public void addZone() 
    {
        //String w = "W~20~0~0~0~0~0";
        Log.d("ZoneSize", "Zone set");
        //MyApplication.preferences.edit().putString( "ZoneSize", w ).commit();
        //MyApplication.preferences.edit().putBoolean("ZoneSizeReady", true).commit();
    }
}

XML

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:id="@+id/myLayout"
    android:orientation="vertical"
    android:layout_height="match_parent" >

    <com.zone.manager.Tab3
        android:id="@+id/tab3_display"
        android:layout_width="fill_parent"
        android:layout_height="620dp" />

         <LinearLayout
            android:layout_width="match_parent"
            android:orientation="horizontal"
            android:layout_height="match_parent" >   

            <Button
                android:id="@+id/addZone"
                android:layout_width="wrap_content"
                android:onClick="onAddZone"
                android:layout_height="wrap_content"
                android:text="Add Zone" />

            <Button
                android:id="@+id/helpZone"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Help" />

            <SeekBar
                android:id="@+id/seekBar1"
                android:paddingTop="9dp"
                android:layout_width="179dp"
                android:layout_height="wrap_content" />

        </LinearLayout>
</LinearLayout>

Thanks for any help you may give to me!

  • 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-06T02:27:13+00:00Added an answer on June 6, 2026 at 2:27 am

    While we’re expecting you to post your crash log, I suggest you don’t use the old tab approach (unless, of course, you’re forced to by your client who wants exactly those tabs). Android’s ui patterns have severely evolved since that tab widget thing.

    The contemporary way to implement tabs is to use ActionBar and Fragments API, which have been around since Honeycomb but are available for earlier android versions as a support library you can download with your android sdk manager. Fragment-based approach will save you a lot of headache.

    As for your main question, it’s not quite clear what you’re trying to accomplish with launching something from different activities but if you need a long-running task to be launched from one activity and return the result to another, you may want to read up on Services (particularly, IntentService is most likely what you’re looking for)

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

Sidebar

Related Questions

I have one question. Is it possible to run unix command directly from java
Simple question : Is it possible to run two SharePoint instances on one server?
Hopefully a simple question. Is it possible to have more than one report inside
this maybe a noobish question so sorry, is it possible to run c programmes
Question Is it possible to get the version of the Java Plugin being used
Question: Is it possible to compile a program on linux using a .dll file?
Possible stupid question: let's say I have two apps contained within one project. Can
One simple question: is it possible to return a value in AsyncTask ? //AsyncTask
Its just a quick question: Is it possible to run a falsh based voice
I have one question about Android. I need to run one of my activities

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.