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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:17:52+00:00 2026-05-26T22:17:52+00:00

Can anyone tell where i am wrong because its just a simple process but

  • 0

Can anyone tell where i am wrong because its just a simple process but how its not retrieving the values i cant understand and do conditional check over the string variable…

Activity A:-

EditText e = (EditText) findViewById(R.id.editText1);
        EditText e1 = (EditText) findViewById(R.id.editText2);
        EditText e2 = (EditText) findViewById(R.id.editText3);
        EditText e3 = (EditText) findViewById(R.id.editText4);
        EditText e4 = (EditText) findViewById(R.id.editText5);
        EditText e5 = (EditText) findViewById(R.id.editText6);
        EditText e6 = (EditText) findViewById(R.id.editText7);

        SharedPreferences myPrefs = getSharedPreferences("myPrefs", Context.MODE_WORLD_READABLE);
        SharedPreferences.Editor editor = myPrefs.edit();
        editor.putString("text", e.getText().toString());
        SharedPreferences myPrefs1 = getSharedPreferences("myPrefs1", Context.MODE_WORLD_READABLE);
        SharedPreferences.Editor editor1 = myPrefs1.edit();
        editor1.putString("text1", e1.getText().toString());

    SharedPreferences myPrefs2 = getSharedPreferences("myPrefs2", Context.MODE_WORLD_READABLE);
        SharedPreferences.Editor editor2 = myPrefs.edit();
        editor2.putString("text2", e2.getText().toString());

SharedPreferences myPrefs3 = getSharedPreferences("myPrefs3", Context.MODE_WORLD_READABLE);
        SharedPreferences.Editor editor3 = myPrefs3.edit();
        editor3.putString("text3", e3.getText().toString());

SharedPreferences myPrefs4 = getSharedPreferences("myPrefs4", Context.MODE_WORLD_READABLE);
        SharedPreferences.Editor editor4 = myPrefs4.edit();
        editor4.putString("text4", e4.getText().toString());

        SharedPreferences myPrefs5 = getSharedPreferences("myPrefs5", Context.MODE_WORLD_READABLE);
        SharedPreferences.Editor editor5 = myPrefs5.edit();
        editor5.putString("text5", e5.getText().toString());

        SharedPreferences myPrefs6 = getSharedPreferences("myPrefs6", Context.MODE_WORLD_READABLE);
        SharedPreferences.Editor editor6 = myPrefs6.edit();
        editor6.putString("text6", e6.getText().toString());

Activity B:-In this activity i am accessing the values and doing the conditional check but only else condition is getting executed on both cases

public class CheckActivity extends Activity{
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        SharedPreferences myPrefs = getSharedPreferences("myPrefs",Context.MODE_PRIVATE); 
        String restoredText = myPrefs.getString("text", "");
        SharedPreferences myPrefs1 = getSharedPreferences("myPrefs1",Context.MODE_PRIVATE); 
        String restoredText1 = myPrefs1.getString("text1", "");
        SharedPreferences myPrefs2 = getSharedPreferences("myPrefs2",Context.MODE_PRIVATE); 
        String restoredText2 =myPrefs2.getString("text2", "");
        SharedPreferences myPrefs3 = getSharedPreferences("myPrefs3",Context.MODE_PRIVATE); 
        String restoredText3 =myPrefs3.getString("text3", "");
        SharedPreferences myPrefs4 = getSharedPreferences("myPrefs4",Context.MODE_PRIVATE); 
        String restoredText4 = myPrefs4.getString("text4", "");
        SharedPreferences myPrefs5 = getSharedPreferences("myPrefs5",Context.MODE_PRIVATE);  
        String restoredText5 = myPrefs5.getString("text5", "");
        SharedPreferences myPrefs6 = getSharedPreferences("myPrefs6",Context.MODE_PRIVATE); 
        String restoredText6 = myPrefs6.getString("text6", "");
    Intent i1 = new Intent();
    if((restoredText.length()>1)&&(restoredText1.length()>1)&&(restoredText2.length()>1)&&(restoredText3.length()>1)&&(restoredText4.length()>1)&&(restoredText5.length()>1)&&(restoredText6.length()>1))
        {
             i1.setClass(this,ShpoonkleActivity.class);
        }
        //if((restoredText.length()==0)||(restoredText1.length()==0)||(restoredText2.length()==0)||(restoredText3.length()==0)||(restoredText4.length()==0)||(restoredText5.length()==0)||(restoredText6.length()==0))
    else    
    {
            i1.setClass(this,Test.class);
    }
        startActivity(i1);
        finish();
    }
}
  • 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-26T22:17:53+00:00Added an answer on May 26, 2026 at 10:17 pm

    actually saving edittext’s text was creating ambiguity and hence was not executing well so i did this as shown below:-

    Activity B:-

    protected void onPause() {
            EditText ed = (EditText)findViewById(R.id.editText1);
            EditText ed1 = (EditText)findViewById(R.id.editText2);
            EditText ed2 = (EditText)findViewById(R.id.editText3);
            EditText ed3 = (EditText)findViewById(R.id.editText4);
            EditText ed4 = (EditText)findViewById(R.id.editText5);
            EditText ed5 = (EditText)findViewById(R.id.editText6);
            EditText ed6 = (EditText)findViewById(R.id.editText7);
    
            super.onPause();
            SharedPreferences myPrefs = getSharedPreferences("myPrefs", Context.MODE_WORLD_READABLE);
            SharedPreferences.Editor editor = myPrefs.edit();
            editor.putString("text", ed.getText().toString());
            editor.putString("text1", ed1.getText().toString());
            editor.putString("text2", ed2.getText().toString());
            editor.putString("text3", ed3.getText().toString());
            editor.putString("text4", ed4.getText().toString());
            editor.putString("text5", ed5.getText().toString());
            editor.putString("text6", ed6.getText().toString());
            editor.commit();
        }
    

    Activity A:-

    public class CheckActivity extends Activity{
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            SharedPreferences myPrefs = getSharedPreferences("myPrefs",Context.MODE_PRIVATE); 
            String restoredText = myPrefs.getString("text", "");
            String restoredText1 = myPrefs.getString("text1", "");
            String restoredText2 =myPrefs.getString("text2", "");
            String restoredText3 =myPrefs.getString("text3", "");
            String restoredText4 = myPrefs.getString("text4", "");
            String restoredText5 = myPrefs.getString("text5", "");
            String restoredText6 = myPrefs.getString("text6", "");
        Intent i1 = new Intent();
        if((restoredText.length()>0)&&(restoredText1.length()>0)&&(restoredText2.length()>0)&&(restoredText3.length()>0)&&(restoredText4.length()>0)&&(restoredText5.length()>0)&&(restoredText6.length()>0))
            {
                 i1.setClass(this,ShpoonkleActivity.class);
            }
            //if((restoredText.length()==0)||(restoredText1.length()==0)||(restoredText2.length()==0)||(restoredText3.length()==0)||(restoredText4.length()==0)||(restoredText5.length()==0)||(restoredText6.length()==0))
        else    
        {
                i1.setClass(this,Test.class);
        }
            startActivity(i1);
            finish();
        }
    }
    

    And it works awesome …thnx..

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

Sidebar

Related Questions

I have problem compilin this code..can anyone tell whats wrong with the syntax CREATE
Can anyone tell me what's wrong with this code? class Dataset < ActiveRecord::Base has_many
Can anyone tell me where I am going wrong... I am using the following
Can anyone tell me what's wrong with this robots.txt? http://bizup.cloudapp.net/robots.txt The following is the
can anyone tell me whats wrong in the following program that accepts 1 or
Can anyone tell me whats wrong in this method and why it gives a
Can anyone tell me whats wrong with this code? <?php $feedID = '28241415'; $oddsArray
Can anyone tell me how I can display a status message like 12 seconds
Can anyone tell me what is the memory usage overhead associated with PHP opcode
Can anyone tell me what exactly does this Java code do? SecureRandom random =

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.