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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:32:16+00:00 2026-05-30T20:32:16+00:00

guys i am working on android 2.2.I have a situation where when the user

  • 0

guys i am working on android 2.2.I have a situation where when the user enters the application he will allowed to use the default audio file provided.

Now there is a button when he clicks on it will go to login page.If he is not a registered user he can register himself and again login with the username and password.Once he logins with his username and password he will be allowed to download n number of audio files from the server.

So what i want to acheive is once the user is a registered user and logins and exits the application but again if the registered user wants to download some more files he should not be prompted with username and password since he is a registered user.

How to acheive this?

Code to login the registered user:

ArrayList<NameValuePair> nvp = new  ArrayList<NameValuePair>();

             nvp.add(new BasicNameValuePair("userid", userid.getText().toString()));
             nvp.add(new BasicNameValuePair("password", password.getText().toString()));
             String un = userid.getText().toString();
             String pass = password.getText().toString();

             System.out.println("user name is " + un);
             System.out.println("password is " +pass);
//           Log.e(""+sid.getText().toString(),"0"); 
//           Log.e(""+sname.getText().toString(),"0");
                try {
                HttpClient httpclient = new DefaultHttpClient();
                HttpPost httppost = new HttpPost("http://mywebsite.com/login.php");
                httppost.setEntity(new UrlEncodedFormEntity(nvp));
                HttpResponse response = httpclient.execute(httppost);
                HttpEntity entity = response.getEntity();
                is = entity.getContent();
                } catch(Exception e){
                    Log.e("log_tag", "Error in http connection"+e.toString());
                }
                try {
                    BufferedReader bf  = new BufferedReader(new InputStreamReader(is,"iso-8859-1"),8);
                    sb = new StringBuilder();
                    sb.append(bf.readLine()+ "\n");
                    String line="0";
                       while ((line = bf.readLine()) != null) {
                                      sb.append(line + "\n");
                        }
                        is.close();
                        result=sb.toString();
                    System.out.println("value of result " +result);

                    if(result.contains(auth)){

                        System.out.println("username and password is correct");

                        Intent authorised = new Intent(Login.this,BrowseFiles.class);
                        startActivity(authorised);
                    }else{

                        System.out.println("incorrect wrong wrong wrong");
                        error.setText("Incorrect username and password");
                    }


                }catch(Exception e){
                      Log.e("log_tag", "Error converting result "+e.toString());
                }
  • 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-30T20:32:17+00:00Added an answer on May 30, 2026 at 8:32 pm

    You can use the SharedPreference for your application and check it when you starts downloading .if it is setted then you can continue otherwise open Login/registartion page whatever you want

    EDIT:
    Once user is successfully login

    SharedPreferences share_pref=PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
          SharedPreferences.Editor editor = share_pref.edit();
          editor.putBoolean("Login", true);
    
          // Commit the edits!
          editor.commit();  
    

    then before downloading you can check this boolean value if it is true then do downloading else go to login screen

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

Sidebar

Related Questions

I have just started working on my first Android application and am going ok.
guys i am working on android 2.2 i am stuck where the user need
I have an image I am displaying to a user in my android application.
I'm working on developing a native android application to retrieve data for a user
How have you guys handled working with jQuery includes <script type=text/javascript src=jquery.js></script> in Asp.Net
Hi guys I'm working on a google apps application. Basically I've set it up
Hi guys i am working on an android app where i need to integrate
Hi guys i am working on drag and drop event in android via jquery
I want to get fling gesture detection working in my Android application. What I
Hi guys I am working on an application.Where there is a home screen with

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.