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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T04:57:51+00:00 2026-06-13T04:57:51+00:00

I am working with android when I start the following activity I got a

  • 0

I am working with android when I start the following activity I got a force close on my android emulator. I think it is due to null value in getstringExtra() but i can’t find it properly. can any one say what is the bug in this activity

public class Cancel_parkActivity extends Activity implements LocationListener{


        String p_u_name;
        HttpPost httppost;
        StringBuffer buffer;
        HttpResponse response;
        HttpClient httpclient;
        List<NameValuePair> nameValuePairs;
        ProgressDialog dialog = null;
        LocationManager locManager;
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.cancel_park);

              Intent in = getIntent();
              p_u_name = in.getExtras().getString("KEY_USERNAME");

                  System.out.println(" Cancel_park : your name is"+p_u_name);

                    dialog = ProgressDialog.show(Cancel_parkActivity.this, "", 
                            "Cancel parking...", true);
                     new Thread(new Runnable() {
                            public void run() {
                                cancelpark();                          
                            }
                          }).start(); 

                    }

        public void cancelpark(){
             try{  
                 httpclient=new DefaultHttpClient();
                 httppost= new HttpPost("http://10.0.2.2/test_login/deletepark.php");

                 nameValuePairs = new ArrayList<NameValuePair>(2);

                String KEY_DELETE = "delete";
                 nameValuePairs.add(new BasicNameValuePair(KEY_DELETE,""));
                 nameValuePairs.add(new BasicNameValuePair("username",p_u_name.trim()));
                 httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
                ResponseHandler<String> responseHandler = new BasicResponseHandler();
                 final String response = httpclient.execute(httppost, responseHandler);
                 System.out.println("Response : " + response); 
                 runOnUiThread(new Runnable() {
                     public void run() {
                        System.out.println("Response from PHP : " + response);
                         dialog.dismiss();
                     }
                 });

                 if(response.equalsIgnoreCase("Success")){
                     runOnUiThread(new Runnable() {
                         public void run() {
                             Toast.makeText(Cancel_parkActivity.this,"Last parking canceled", Toast.LENGTH_SHORT).show();

                         }
                     });

//                   startActivity(new Intent(LoginActivity.this, MainActivity.class));
                 }else{
                     Toast.makeText(Cancel_parkActivity.this,"fucking", Toast.LENGTH_SHORT).show();

                 }

             }catch(Exception e){
                 dialog.dismiss();
                 System.out.println("Exception : " + e.getMessage());
             }
         }
         public void showAlert(){
             Cancel_parkActivity.this.runOnUiThread(new Runnable() {
                 public void run() {
                     AlertDialog.Builder builder = new AlertDialog.Builder(Cancel_parkActivity.this);
                     builder.setTitle("Parking Error.");
                     builder.setMessage("Try again?.")  
                            .setCancelable(false)
                            .setPositiveButton("OK", new DialogInterface.OnClickListener() {
                                public void onClick(DialogInterface dialog, int id) {
                                    Intent r = new Intent(getApplicationContext(),Park_HereActivity.class);
                                    startActivity(r);
                                }
                            });                     
                     AlertDialog alert = builder.create();
                     alert.show();               
                 }
             });

         }
        public void onLocationChanged(Location arg0) {
            // TODO Auto-generated method stub

        }
        public void onProviderDisabled(String provider) {
            // TODO Auto-generated method stub

        }
        public void onProviderEnabled(String provider) {
            // TODO Auto-generated method stub

        }
        public void onStatusChanged(String provider, int status, Bundle extras) {
            // TODO Auto-generated method stub

        }
    }

and i got nullpointer exception like this

10-20 17:42:50.044: E/AndroidRuntime(1983): FATAL EXCEPTION: main
10-20 17:42:50.044: E/AndroidRuntime(1983): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.oranz.epark/com.oranz.epark.Cancel_parkActivity}: java.lang.NullPointerException
10-20 17:42:50.044: E/AndroidRuntime(1983):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1955)
10-20 17:42:50.044: E/AndroidRuntime(1983):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1980)
10-20 17:42:50.044: E/AndroidRuntime(1983):     at android.app.ActivityThread.access$600(ActivityThread.java:122)
10-20 17:42:50.044: E/AndroidRuntime(1983):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1146)
10-20 17:42:50.044: E/AndroidRuntime(1983):     at android.os.Handler.dispatchMessage(Handler.java:99)
10-20 17:42:50.044: E/AndroidRuntime(1983):     at android.os.Looper.loop(Looper.java:137)
10-20 17:42:50.044: E/AndroidRuntime(1983):     at android.app.ActivityThread.main(ActivityThread.java:4340)
10-20 17:42:50.044: E/AndroidRuntime(1983):     at java.lang.reflect.Method.invokeNative(Native Method)
10-20 17:42:50.044: E/AndroidRuntime(1983):     at java.lang.reflect.Method.invoke(Method.java:511)
10-20 17:42:50.044: E/AndroidRuntime(1983):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
10-20 17:42:50.044: E/AndroidRuntime(1983):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
10-20 17:42:50.044: E/AndroidRuntime(1983):     at dalvik.system.NativeStart.main(Native Method)
10-20 17:42:50.044: E/AndroidRuntime(1983): Caused by: java.lang.NullPointerException
10-20 17:42:50.044: E/AndroidRuntime(1983):     at com.oranz.epark.Cancel_parkActivity.onCreate(Cancel_parkActivity.java:43)
10-20 17:42:50.044: E/AndroidRuntime(1983):     at android.app.Activity.performCreate(Activity.java:4465)
10-20 17:42:50.044: E/AndroidRuntime(1983):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
10-20 17:42:50.044: E/AndroidRuntime(1983):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1919)
10-20 17:42:50.044: E/AndroidRuntime(1983):     ... 11 more
  • 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-13T04:57:53+00:00Added an answer on June 13, 2026 at 4:57 am

    Check this line in your code:

    Cancel_parkActivity.java:43
    

    Maybe getIntent().getExtras() is null?

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

Sidebar

Related Questions

i am working on android and trying to read a value from my preference
I'm new to android but I've been working my way through the tutoials. Still
I just started working coverting my iOS app to Android. But I'm having the
Registration from device (android phone running 2.2) is not working. In one emulator im
I'm new on Android, and I'm trying to start an Activity from a MenuItem
I have got a small problem in an Android app I am working on
My Problem is Dom Parser is not working in Android 4.0 but it's working
I am currently working on android project where I am using a custom list
I am working on Android Application. Now I have requirement of search the entered
I am currently working on android project where I want to have a text

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.