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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:13:22+00:00 2026-05-26T15:13:22+00:00

I’m having a problem with my activity intent launcher. It seems that when I

  • 0

I’m having a problem with my activity intent launcher. It seems that when I run this code

Intent intent = new Intent(Intent.ACTION_VIEW);
                intent.setClass(this, contentScreen.class);
                startActivity(intent);
                finish();

in my autoGO method, it runs two activities, and I know this as my logcat tells me this:

11-03 11:16:16.542: INFO/ActivityManager(58): Displayed activity three.three/.contentScreen: 2030 ms (total 3391 ms)
11-03 11:16:16.713: INFO/ActivityManager(58): Displayed activity three.three/.contentScreen: 1596 ms (total 1596 ms)

My flow is basically on this activity if a particular value in the database is true, it will automatically run autoGO which in autoGO starts a new intent and takes me to that class. However it would seem somewhere I am starting two activities. As a result I have two activities of the same type open, but this is unwanted. What could be the reason for this?

Here is the autoGO method:

public void autoGO(View arg1) throws IOException,
XmlPullParserException {

    EditText username = (EditText) findViewById(R.id.widget40);
    EditText password = (EditText) findViewById(R.id.widget37);

    SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
    //gainString(remembered);
    setUserPass();
    System.out.println(Compare[1]);
    System.out.println(Compare[2]);
    request.addProperty("User", Compare[1]);
    request.addProperty("Password", Compare[2]);
    autoSign = false;
    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
            SoapEnvelope.VER11);
    envelope.dotNet = true;
    envelope.setOutputSoapObject(request);
    AndroidHttpTransport httpTransport = new AndroidHttpTransport(URL);
    httpTransport.debug = true;
    httpTransport.call(SOAP_ACTION, envelope); // send request
    SoapObject result = (SoapObject) envelope.getResponse(); // get
    System.out.println(result);

    int Conversion = Integer.parseInt(result.getProperty(0).toString());
    System.out.println(Conversion);
    if (Conversion > 0) {

        try{

            sqlDB=openOrCreateDatabase(DBNAME1,Context.MODE_PRIVATE,null);
            System.out.println("open or create database");
            //sqlDB.execSQL("UPDATE " + Table1 + " SET NAME = '" + sUserName + "' WHERE NAME = '" + remembered[1] + "'");
            System.out.println("URL updated");
            //sqlDB.execSQL("UPDATE " + Table1 + " SET PASSWORD = '" + sPassword + "' WHERE PASSWORD = '" + remembered[2]+ "'");
            sqlDB.execSQL("UPDATE " + Table1 + " SET URL = '" + "http://" + result.getProperty(2).toString()+ "'");
            System.out.println("HERE IS THE NEW URL " + "http://" + result.getProperty(2).toString());

            contentScreen co = new contentScreen();
            co.signAuto(true);

            Intent intent = new Intent(Intent.ACTION_VIEW);
                intent.setClass(this, contentScreen.class);
                startActivity(intent);
                finish();
        }


             catch (Exception e1) {
                // TODO Auto-generated catch block
                 System.out.println("Problem "+ e1.getMessage());
                e1.printStackTrace();
            }
            finally
            {
                sqlDB.close();

            }

    } else {
        username.setTextSize(10);
        username.setText("Invalid username or passcode!");
    }
}

Here is the full code:

    public class Activity1 extends Activity {
/** Called when the activity is first created. */
JoshTwoActivity main;
Activity1 Activity1;
Activity2 two;

boolean checkTick = false;
private static final String NAMESPACE = "http://tempuri.org/";
private static final String URL = "http://xxxxxxxxxxxxxxxxxxxxxx/Webservice/xxxxxxxxxxxe.asmx?WSDL";
private static final String SOAP_ACTION = "http://tempuri.org/ValidateUser";
private static final String METHOD_NAME = "ValidateUser";
static String[] Compare = {"First time login, please enter name","pass","http://default.com"};

boolean tickBoxes [] = {false, false};
private String[] remembered = { "", "", "", "" };
View arg3;
Boolean autoSign = false;
SQLiteDatabase sqlDB;

private static String DBNAME1= "database1.db";
private static String DBNAME2= "database2.db";
private static String Table1= "People";
private static String Table2= "options";


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

    final EditText username = (EditText) findViewById(R.id.widget40);
    final EditText password = (EditText) findViewById(R.id.widget37);

    obtainDetails();
    getValues();


    final CheckBox checkBox = (CheckBox) findViewById(R.id.widget35);
    checkBox.setOnCheckedChangeListener(new OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton arg0, boolean arg1) {
            if (checkBox.isChecked()) {
                tickBoxes[0]=true;
                updateFields();

            }
            if (!checkBox.isChecked()) {

                tickBoxes[0]=false;
                updateFields();
            }
        }
    });
    // NEW SAVE CHECKBOX IS HERE
    final CheckBox saveBox = (CheckBox) findViewById(R.id.widget36);
    saveBox.setOnCheckedChangeListener(new OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton arg0, boolean arg1) {
            if (saveBox.isChecked()) {
                tickBoxes[1]=true;
                updateFields();

            }
            if (!saveBox.isChecked()) {
                tickBoxes[1]=false;
                System.out.println(tickBoxes[1]);
                updateFields();
            }
        }
    });
    // FOR LOOP TO GO HERE, AND ALSO REMOVAL OF CHECKTICK
    for (int i = 0; i < tickBoxes.length; i++) {
        if (tickBoxes[1]) {
            saveBox.setChecked(true);

            if(!tickBoxes[0]){

            try {
                //gainString(remembered);

                setUserPass();

                username.setText(remembered[1]);
                System.out.println(remembered[1]);
                password.setText(remembered[2]);

            } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            }

            // SET THE TEXT HERE IF NEEDED
        }
        if (tickBoxes[0]) {
            checkBox.setChecked(true);
            try {
                autoSign = true;
                System.out.println(autoSign);
                autoGO(arg3);
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (XmlPullParserException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }

    }

    final Button buttonEXIT = (Button) findViewById(R.id.widget41);
    buttonEXIT.setOnClickListener(new ViewStub.OnClickListener() {
        @Override
        public void onClick(View arg3) {
            username.setText("");
            password.setText("");
            checkBox.setChecked(false);
            saveBox.setChecked(false);
            updateFields();

        }
    });

    layoutControl();

}

public void destory(boolean newterminate) {
    main.sessionDestroy(newterminate);
}

public void layoutControl() {


    final Button buttonLOGIN = (Button) findViewById(R.id.widget34);
    buttonLOGIN.setOnClickListener(new ViewStub.OnClickListener() {
        @Override
        public void onClick(View arg1) {
            // TODO Auto-generated method stub
            try {
                validateUser(arg1);
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (XmlPullParserException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
    });

    final Button signUP = (Button) findViewById(R.id.widget32);
    signUP.setOnClickListener(new ViewStub.OnClickListener() {
        @Override
        public void onClick(View arg4) {
            // TODO Auto-generated method stub
            // startActivity(launchBrowser);
            Intent myIntent = new Intent(arg4.getContext(), login.class);
            startActivityForResult(myIntent, 0);
            finish();
        }
    });

}
public void updateFields()
{
    String one;
    String two;


    if(tickBoxes[0]){
        one = "true";
        two = "false";
    }
    else{
        one = "false";
        two = "true";
    }

    String three;
    String four;
    if(tickBoxes[1])
    {
        three = "true";
        four = "false";
    }
    else
    {
        three = "false";
        four = "true";
    }
    System.out.println("badadfasdfa" +one);
    System.out.println("badadfasdfa" +two);

    try{
        sqlDB= openOrCreateDatabase(DBNAME2,Context.MODE_PRIVATE,null);



        System.out.println("values updated");
        sqlDB.execSQL("UPDATE " + Table2 + " SET SaveP= '" + three + "' WHERE SaveP = '" + four + "'");
        sqlDB.execSQL("UPDATE " + Table2 + " SET Signauto= '" + one+ "' WHERE Signauto = '" + two+ "'");
        sqlDB.close();
    }
    catch(Exception e)
    {
        e.printStackTrace();
    }
    finally
    {
        sqlDB.close();
    }

}

public void validateUser(View arg1) throws IOException,
        XmlPullParserException {
    EditText username = (EditText) findViewById(R.id.widget40);
    EditText password = (EditText) findViewById(R.id.widget37);

    String sUserName, sPassword;
    sUserName = username.getText().toString();
    sPassword = password.getText().toString();
    System.out.println(sPassword + " USERJHJERJ");
    if(!autoSign){
    if (sUserName.length() <= 2 || sPassword.length() <= 2) {
        username.setTextSize(10);
        username.setText("enter both fields!");

    } else {
        SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); // set
        request.addProperty("User", sUserName); // variable name, value. I
                                                // got
        request.addProperty("Password", sPassword);

        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
                SoapEnvelope.VER11); // put all required data into a soap
        // envelope
        envelope.dotNet = true;
        envelope.setOutputSoapObject(request); // prepare request
        AndroidHttpTransport httpTransport = new AndroidHttpTransport(URL);
        httpTransport.debug = true;
        httpTransport.call(SOAP_ACTION, envelope); // send request

        System.out.println("HERE IS THE ENVELOPE "
                + envelope.getInfo("User", "Password"));
        SoapObject result = (SoapObject) envelope.getResponse(); // get
        System.out.println(result);

        // String checkPass =
        int Conversion = Integer.parseInt(result.getProperty(0).toString());
        System.out.println(Conversion);
        if (Conversion > 0) {
            try{

            sqlDB=openOrCreateDatabase(DBNAME1,Context.MODE_PRIVATE,null);
            System.out.println("open or create database");
            sqlDB.execSQL("UPDATE " + Table1 + " SET NAME = '" + sUserName + "' WHERE NAME = '" + Compare[1] + "'");
            System.out.println("username updated");
            sqlDB.execSQL("UPDATE " + Table1 + " SET PASSWORD = '" + sPassword + "' WHERE PASSWORD = '" + Compare[2]+ "'");
            sqlDB.execSQL("UPDATE " + Table1 + " SET URL = '" + "http://" + result.getProperty(2).toString() + "' WHERE URL = '" + Compare[0] + "'");
            Intent myIntent = new Intent(arg1.getContext(),
                    contentScreen.class);

            startActivityForResult(myIntent, 0);
            finish();
            }
            /*eStrings[0] = result.getProperty(0).toString();
            eStrings[1] = sUserName;
            eStrings[2] = sPassword;
            eStrings[3] = "http://" + result.getProperty(2).toString();*/

             catch (Exception e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
                System.out.println(e1.toString() + "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");
            }
            finally
            {
                sqlDB.close();
            }
        } else {
            username.setTextSize(10);
            username.setText("Invalid username or passcode!");
        }

    }}
    //}else{

    //}

}

public void autoGO(View arg1) throws IOException,
XmlPullParserException {

    EditText username = (EditText) findViewById(R.id.widget40);
    EditText password = (EditText) findViewById(R.id.widget37);

    SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
    //gainString(remembered);
    setUserPass();
    System.out.println(Compare[1]);
    System.out.println(Compare[2]);
    request.addProperty("User", Compare[1]);
    request.addProperty("Password", Compare[2]);
    autoSign = false;
    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
            SoapEnvelope.VER11);
    envelope.dotNet = true;
    envelope.setOutputSoapObject(request);
    AndroidHttpTransport httpTransport = new AndroidHttpTransport(URL);
    httpTransport.debug = true;
    httpTransport.call(SOAP_ACTION, envelope); // send request
    SoapObject result = (SoapObject) envelope.getResponse(); // get
    System.out.println(result);

    int Conversion = Integer.parseInt(result.getProperty(0).toString());
    System.out.println(Conversion);
    if (Conversion > 0) {

        try{

            sqlDB=openOrCreateDatabase(DBNAME1,Context.MODE_PRIVATE,null);
            System.out.println("open or create database");
            //sqlDB.execSQL("UPDATE " + Table1 + " SET NAME = '" + sUserName + "' WHERE NAME = '" + remembered[1] + "'");
            System.out.println("URL updated");
            //sqlDB.execSQL("UPDATE " + Table1 + " SET PASSWORD = '" + sPassword + "' WHERE PASSWORD = '" + remembered[2]+ "'");
            sqlDB.execSQL("UPDATE " + Table1 + " SET URL = '" + "http://" + result.getProperty(2).toString()+ "'");
            System.out.println("HERE IS THE NEW URL " + "http://" + result.getProperty(2).toString());

            contentScreen co = new contentScreen();
            co.signAuto(true);

            Intent intent = new Intent(Intent.ACTION_VIEW);
                intent.setClass(this, contentScreen.class);
                startActivity(intent);
                finish();
        }


             catch (Exception e1) {
                // TODO Auto-generated catch block
                 System.out.println("Problem "+ e1.getMessage());
                e1.printStackTrace();
            }
            finally
            {
                sqlDB.close();

            }

    } else {
        username.setTextSize(10);
        username.setText("Invalid username or passcode!");
    }
}


public void getValues()
{
    try{
    sqlDB= this.openOrCreateDatabase(DBNAME2,MODE_PRIVATE,null);
    Cursor r=sqlDB.rawQuery("SELECT Signauto,SaveP FROM "+Table2, null);
    System.out.println("COUNT : " + r.getCount());
    Integer sign=r.getColumnIndex("Signauto");
    Integer save=r.getColumnIndex("SaveP");
    int j=0;
    if(r.moveToFirst()){
    do
    {
        System.out.println("sign values are"+r.getString(sign));
        System.out.println("save values are"+r.getString(save));

        //int a[]=new int[tickBoxes.length];
        j++;

            if(r.getString(sign).equals("true"))
            {
                tickBoxes[0]=true;
                System.out.println("values of tickbox"+tickBoxes[0]);
            }
            else
            {
                tickBoxes[0]=false;
            }
            if(r.getString(save).equals("true"))
            {
                tickBoxes[1]=true;
                System.out.println("values of tickbox"+tickBoxes[1]);
            }
            else
            {
                tickBoxes[1]=false;
            }

    }
    while(r.moveToNext());
    if(j==0)
    {
        System.out.println("No data found");
    }

    }
    r.close();
    //sqlDB.close();
    }
    catch(Exception e)
    {
        e.printStackTrace();
    }
    finally
    {
        sqlDB.close();
    }
}

public String[] setUserPass()
{
    try{
        sqlDB= this.openOrCreateDatabase(DBNAME1,MODE_PRIVATE,null);
        Cursor r=sqlDB.rawQuery("SELECT NAME, PASSWORD, URL FROM " +Table1, null);
        System.out.println("COUNT : " + r.getCount());
        Integer uname=r.getColumnIndex("NAME");
        Integer pwd=r.getColumnIndex("PASSWORD");
        Integer url=r.getColumnIndex("URL");

        if(r.moveToFirst())
        {
            do{
        remembered[1]=r.getString(uname);
        System.out.println("remembered 1"+remembered[1]);
        remembered[2]=r.getString(pwd);
        remembered[0]=r.getString(url);
        System.out.println("newnewnew " + r.getString(url));
            }
            while(r.moveToNext());
        }
        r.close();
    }
    catch(Exception e)
    {
        e.printStackTrace();
        System.out.println("BBBBBBBBBBBBBBBBBBBB" + e.toString());
    }
    finally{
        sqlDB.close();
    }
    return remembered;

}

public String[] obtainDetails(){
    try{
        sqlDB= this.openOrCreateDatabase(DBNAME1,MODE_PRIVATE,null);
        Cursor r=sqlDB.rawQuery("SELECT NAME, PASSWORD, URL FROM " +Table1, null);
        System.out.println("COUNT : " + r.getCount());
        Integer uname=r.getColumnIndex("NAME");
        Integer pwd=r.getColumnIndex("PASSWORD");
        Integer url=r.getColumnIndex("URL");
        if(r.moveToFirst())
        {
            do{
        Compare[1]=r.getString(uname);
        System.out.println("remembered 1"+remembered[1]);
        Compare[2]=r.getString(pwd);
        Compare[0]=r.getString(url);
            }
            while(r.moveToNext());
        }
        r.close();
    }
    catch(Exception e)
    {
        e.printStackTrace();
        System.out.println("CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC" + e.toString());
    }
    finally{
        sqlDB.close();
    }
    return Compare;
}

}

  • 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-26T15:13:22+00:00Added an answer on May 26, 2026 at 3:13 pm

    I think it’s because of setRequestedOrientation: by default android recreates activity upon orientation change. You can assign specific orientation for your activity in the application Manifest file.

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into

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.