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

  • Home
  • SEARCH
  • 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 6629355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:14:55+00:00 2026-05-25T22:14:55+00:00

Just when I thought I had this one cinched, I realized that I can

  • 0

Just when I thought I had this one cinched, I realized that I can only use the buttons in the activity in the same sequence they are written in the Activity.java (Ex: Cannot execute button 5 press, until 1,2,3,and 4 have all been pressed!)
How do I fix this?

Activity.Java:

public class TwoActivity extends Activity {

ProgressBar progressBar;
TextView textView41;
TextView textView42;
TextView textView43;


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

    progressBar = (ProgressBar)findViewById(R.id.progressbar_Horizontal);
    progressBar.setProgressDrawable(getResources().getDrawable(R.drawable.blue_progress));
    textView41 = (TextView)findViewById(R.id.dl41text);
    textView42 = (TextView)findViewById(R.id.dl42text);
    textView43 = (TextView)findViewById(R.id.dl43text);


    Button button1 = (Button) findViewById(R.id.button1);
    button1.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            startDownload();

        }
    });
}
private void startDownload() {
    String url = "http://dl.dropbox.com/u/43058382/steelers1.jpg";
    new DownloadFileAsync().execute(url);
}

class DownloadFileAsync extends AsyncTask<String, String, String> {

@Override
protected void onPreExecute() {
    progressBar.setProgress(0);
    progressBar.setVisibility(View.VISIBLE);
    textView41.setVisibility(View.VISIBLE);
    super.onPreExecute();
}

@Override
protected String doInBackground(String... aurl) {
    int count;

try {

URL url = new URL(aurl[0]);
URLConnection conexion = url.openConnection();
conexion.connect();

int lenghtOfFile = conexion.getContentLength();
Log.d("ANDRO_ASYNC", "Lenght of file: " + lenghtOfFile);

InputStream input = new BufferedInputStream(url.openStream());
OutputStream output = new FileOutputStream("/sdcard/steelers1.jpg");

byte data[] = new byte[1024];

long total = 0;

    while ((count = input.read(data)) != -1) {
        total += count;
        publishProgress(""+(int)((total*100)/lenghtOfFile));
        output.write(data, 0, count);
    }

    output.flush();
    output.close();
    input.close();
} catch (Exception e) {}
return null;

}
protected void onProgressUpdate(String... progress) {
    progressBar.setProgress(Integer.parseInt(progress[0]));
}

@Override
protected void onPostExecute(String unused) {
    progressBar.setVisibility(View.INVISIBLE);
    textView41.setVisibility(View.INVISIBLE);


    Button button2 = (Button) findViewById(R.id.button2);
    button2.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View w) {
            startDownload();

        }
    });
}
private void startDownload() {
    String url = "http://dl.dropbox.com/u/43058382/steelers2.jpg";
    new DownloadFileAsync2().execute(url);
}

class DownloadFileAsync2 extends AsyncTask<String, String, String> {

@Override
protected void onPreExecute() {
    progressBar.setProgress(0);
    progressBar.setVisibility(View.VISIBLE);
    textView42.setVisibility(View.VISIBLE);
    super.onPreExecute();
}

@Override
protected String doInBackground(String... aurl) {
    int count;

try {

URL url = new URL(aurl[0]);
URLConnection conexion = url.openConnection();
conexion.connect();

int lenghtOfFile = conexion.getContentLength();
Log.d("ANDRO_ASYNC", "Lenght of file: " + lenghtOfFile);

InputStream input = new BufferedInputStream(url.openStream());
OutputStream output = new FileOutputStream("/sdcard/steelers2.jpg");

byte data[] = new byte[1024];

long total = 0;

    while ((count = input.read(data)) != -1) {
        total += count;
        publishProgress(""+(int)((total*100)/lenghtOfFile));
        output.write(data, 0, count);
    }

    output.flush();
    output.close();
    input.close();
} catch (Exception e) {}
return null;

}
protected void onProgressUpdate(String... progress) {
    progressBar.setProgress(Integer.parseInt(progress[0]));
}

@Override
protected void onPostExecute(String unused) {
    progressBar.setVisibility(View.INVISIBLE);
    textView42.setVisibility(View.INVISIBLE);

    Button button3 = (Button) findViewById(R.id.button3);
    button3.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View w) {
            startDownload();

        }
    });
}
private void startDownload() {
    String url = "http://dl.dropbox.com/u/43058382/steelers3.jpg";
    new DownloadFileAsync3().execute(url);
}

class DownloadFileAsync3 extends AsyncTask<String, String, String> {

@Override
protected void onPreExecute() {
    progressBar.setProgress(0);
    progressBar.setVisibility(View.VISIBLE);
    textView43.setVisibility(View.VISIBLE);
    super.onPreExecute();
}

@Override
protected String doInBackground(String... aurl) {
    int count;

try {

URL url = new URL(aurl[0]);
URLConnection conexion = url.openConnection();
conexion.connect();

int lenghtOfFile = conexion.getContentLength();
Log.d("ANDRO_ASYNC", "Lenght of file: " + lenghtOfFile);

InputStream input = new BufferedInputStream(url.openStream());
OutputStream output = new FileOutputStream("/sdcard/steelers3.jpg");

byte data[] = new byte[1024];

long total = 0;

    while ((count = input.read(data)) != -1) {
        total += count;
        publishProgress(""+(int)((total*100)/lenghtOfFile));
        output.write(data, 0, count);
    }

    output.flush();
    output.close();
    input.close();
} catch (Exception e) {}
return null;

}
protected void onProgressUpdate(String... progress) {
    progressBar.setProgress(Integer.parseInt(progress[0]));
}

@Override
protected void onPostExecute(String unused) {
    progressBar.setVisibility(View.INVISIBLE);
    textView43.setVisibility(View.INVISIBLE);

    Button button16 = (Button) findViewById(R.id.button16);
    button16.setOnClickListener(new View.OnClickListener(){
        @Override
        public void onClick(View v){
            Intent myIntent = new
                    Intent(TwoActivity.this, ModdifyMyWiiActivity.class);
            TwoActivity.this.startActivity(myIntent);
        }
    });

    Button button18 = (Button) findViewById(R.id.button18);
    button18.setOnClickListener(new View.OnClickListener(){
        @Override
        public void onClick(View v){
            Intent myIntent = new
                    Intent(TwoActivity.this, ThreeActivity.class);
            TwoActivity.this.startActivity(myIntent);
        }
    });

    Button button19 = (Button) findViewById(R.id.button19);
    button19.setOnClickListener(new View.OnClickListener(){
        @Override
        public void onClick(View v){
            Intent myIntent = new
                    Intent(TwoActivity.this, FourActivity.class);
            TwoActivity.this.startActivity(myIntent);
        }
    });
}


    public boolean onCreateOptionsMenu(Menu menu) {
            MenuInflater inflater = getMenuInflater();
            inflater.inflate(R.menu.menu, menu);
            return true;

    }

    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
        case R.id.menuexit:
            final Intent intent = new Intent(Intent.ACTION_MAIN);
            intent.addCategory(Intent.CATEGORY_HOME);
            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            startActivity(intent);
            break;
        case R.id.menucontact:
            final Intent intent1 = new Intent(android.content.Intent.ACTION_SEND);
            intent1.setType("text/plain");
            intent1.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { "johnnyb15613@gmail.com" });
            intent1.putExtra(android.content.Intent.EXTRA_SUBJECT, "Transform Mii Help");
            final PackageManager pm = getPackageManager();
            final List<ResolveInfo> matches = pm.queryIntentActivities(intent1, 0);
            ResolveInfo best = null;
            for (final ResolveInfo info : matches)
              if (info.activityInfo.packageName.endsWith(".gm") ||
                  info.activityInfo.name.toLowerCase().contains("gmail")) best = info;
            if (best != null)
              intent1.setClassName(best.activityInfo.packageName, best.activityInfo.name);
            startActivity(intent1);

            break;
        }
        return true;

    }
}
}
}
}

And her is the layout.xml:

    <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:id="@+id/linearLayout1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/main_bg_hdpi" xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:weightSum="1">
    <ScrollView android:id="@+id/scrollView1" android:layout_centerHorizontal="true" android:layout_alignParentTop="true" android:layout_width="match_parent" android:layout_height="390dp">
        <RelativeLayout android:id="@+id/relativeLayout1" android:layout_width="fill_parent" android:orientation="vertical" android:weightSum="1" android:layout_height="wrap_content">
            <Button android:src="@drawable/fourone_files" android:background="@drawable/modfiles41" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/button1" android:layout_alignParentTop="true" android:layout_alignParentLeft="true" android:layout_marginTop="22dp"></Button>
            <Button android:src="@drawable/fourtwo_files" android:background="@drawable/modfiles42" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/button2" android:layout_alignTop="@+id/button1" android:layout_centerHorizontal="true"></Button>
            <Button android:src="@drawable/fourthree_files" android:background="@drawable/modfiles43" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/button3" android:layout_alignTop="@+id/button2" android:layout_alignParentRight="true"></Button>
            <Button android:background="@drawable/unused" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/button4" android:layout_below="@+id/button3" android:layout_alignParentLeft="true" android:layout_marginTop="22dp"></Button>
            <Button android:background="@drawable/unused" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/button5" android:layout_alignBottom="@+id/button4" android:layout_centerHorizontal="true"></Button>
            <Button android:background="@drawable/unused" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/button6" android:layout_alignBottom="@+id/button5" android:layout_alignParentRight="true"></Button>
            <Button android:background="@drawable/unused" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/button7" android:layout_below="@+id/button4" android:layout_alignParentLeft="true" android:layout_marginTop="22dp"></Button>
            <Button android:background="@drawable/unused" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/button8" android:layout_alignBottom="@+id/button7" android:layout_alignLeft="@+id/button5"></Button>
            <Button android:background="@drawable/unused" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/button9" android:layout_alignBottom="@+id/button8" android:layout_alignParentRight="true"></Button>
            <Button android:background="@drawable/unused" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/button10" android:layout_below="@+id/button7" android:layout_alignParentLeft="true" android:layout_marginTop="22dp"></Button>
            <Button android:background="@drawable/unused" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/button11" android:layout_alignBottom="@+id/button10" android:layout_alignLeft="@+id/button8"></Button>
            <Button android:background="@drawable/unused" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/button12" android:layout_alignTop="@+id/button11" android:layout_alignParentRight="true"></Button>
            <Button android:background="@drawable/unused" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/button13" android:layout_below="@+id/button10" android:layout_alignParentLeft="true" android:layout_marginTop="22dp"></Button>
            <Button android:background="@drawable/unused" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/button14" android:layout_alignBottom="@+id/button13" android:layout_alignLeft="@+id/button2"></Button>
            <Button android:background="@drawable/unused" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/button15" android:layout_alignBottom="@+id/button14" android:layout_alignParentRight="true"></Button>
            <TextView android:text="** Get your System Menu Version by accessing the Wii Options Menu " android:id="@+id/CustomFontText" android:layout_width="match_parent" android:layout_height="wrap_content" android:singleLine="true" android:ellipsize="marquee" android:marqueeRepeatLimit="marquee_forever" android:scrollHorizontally="true" android:paddingLeft="5dip" android:paddingRight="5dip" android:focusable="true" android:focusableInTouchMode="true" android:freezesText="true" android:textColor="@color/wiiblue" android:textStyle="bold" android:layout_below="@+id/button15" android:layout_marginTop="22dp"></TextView>
            <ProgressBar android:layout_width="fill_parent" android:layout_height="35dp" style="?android:attr/progressBarStyleHorizontal" android:id="@+id/progressbar_Horizontal" android:max="100" android:layout_below="@+id/button15" android:layout_marginTop="15dp" android:visibility="invisible" ></ProgressBar>
            <TextView android:id="@+id/dl41text" android:text="Downloading 4.1 Mod Pack..." android:layout_width="match_parent" android:layout_height="wrap_content" android:textColor="@color/white" android:textStyle="bold" android:gravity="center" android:visibility="invisible" android:layout_below="@+id/button15" android:layout_marginTop="22dp"></TextView>
            <TextView android:id="@+id/dl42text" android:text="Downloading 4.2 Mod Pack..." android:layout_width="match_parent" android:layout_height="wrap_content" android:textColor="@color/white" android:textStyle="bold" android:gravity="center" android:visibility="invisible" android:layout_below="@+id/button15" android:layout_marginTop="22dp"></TextView>
            <TextView android:id="@+id/dl43text" android:text="Downloading 4.3 Mod Pack..." android:layout_width="match_parent" android:layout_height="wrap_content" android:textColor="@color/white" android:textStyle="bold" android:gravity="center" android:visibility="invisible" android:layout_below="@+id/button15" android:layout_marginTop="22dp"></TextView>

        </RelativeLayout>

    </ScrollView>

/>

Menu does not show either! All help appreciated!

  • 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-25T22:14:56+00:00Added an answer on May 25, 2026 at 10:14 pm

    Why not create one Async class that can do 4 different types of downloads? This class would take as parameters: the button, the textview, and the url. Then you have 1/4 as much code. In the async, make all the buttons non clickable (setClickable(false)).

    At any rate, you need to assign an onclicklistener for all the buttons at OnCreate(). You could make a custom class and switch on the button type, or just do the individualized anonymous class route.

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

Sidebar

Related Questions

I thought I had this one pretty good, but I just keep running into
I thought I had this figured out but it turns out I'm just deleting
Just when I thought I had gotten the hang of Objective-C's memory-management this error
I had just thought I resolved a problem , but it seemed another one
Just wondering if you had any thoughts on this problem. I want to make
I probably just haven't thought this through, or perhaps I'm simply unaware of an
Just listening to this week's podcast and thought it would be nice to group
I thought that layout is just a widget that keeps more widgets inside. But
I thought that to clone a List you would just call: List<int> cloneList =
I never had to do this before and never even thought about this before.

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.