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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T08:35:47+00:00 2026-05-31T08:35:47+00:00

In my app the first screen is a list and when you click once

  • 0

In my app the first screen is a list and when you click once it goes ok but if,my mistake or something, you click two or more times before it loads the application crashes. I’ve been doing a little research but I didn’t found anything. I post my code:

    @Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
    setContentView(R.layout.firstscreen);
    // Set title
    getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,
            R.layout.mainheader);

    // Get Arguments
    Bundle extras = getIntent().getExtras();
    if (extras != null) {
        app = extras.getString("app");
    }

    //Set simulation date   
    TextView date = (TextView) findViewById(R.id.date);
    date.setText(convertDateToString());
    // set the list adapter: ListView myList =
    ListView lv = (ListView) findViewById(R.id.list);
    DataBaseAccess ddbb = new DataBaseAccess();
    //Download the data from a database
    lv.setAdapter(new MyAdapter(this, R.layout.listitem, myLines,
            flowAlarm, precAlarm));
    lv.setTextFilterEnabled(true);
    lv.setOnItemClickListener(new OnItemClickListener() {

        public void onItemClick(AdapterView<?> parent, View view,
                int position, long id) {
            Intent i = new Intent(Main.this, ShowGraph.class);
            String[] obj = list.split(";");
            i.putExtra("object name", obj[position]);
            i.putExtra("app name", app);
            i.putExtra("app list", list);
            startActivity(i);

        }
    });

    // Set buttons clickable
    Button exit = (Button) findViewById(R.id.exit);
    exit.setOnClickListener(this);
    Button calendar = (Button) findViewById(R.id.calendar);
    calendar.setOnClickListener(this);
}

Does anyone knows why?

My LogCat:

02-29 13:51:27.975: E/AndroidRuntime(9082): FATAL EXCEPTION: main
02-29 13:51:27.975: E/AndroidRuntime(9082): java.lang.NullPointerException
02-29 13:51:27.975: E/AndroidRuntime(9082):at org.achartengine.chart.XYChart.toRealPoint(XYChart.java:699)
02-29 13:51:27.975: E/AndroidRuntime(9082):at org.achartengine.tools.Pan.apply(Pan.java:64)
02-29 13:51:27.975: E/AndroidRuntime(9082):at org.achartengine.TouchHandler.handleTouch(TouchHandler.java:106)
02-29 13:51:27.975: E/AndroidRuntime(9082):at org.achartengine.GraphicalView.onTouchEvent(GraphicalView.java:284)
02-29 13:51:27.975: E/AndroidRuntime(9082):at android.view.View.dispatchTouchEvent(View.java:3952)
02-29 13:51:27.975: E/AndroidRuntime(9082):at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1034)
02-29 13:51:27.975: E/AndroidRuntime(9082):at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1034)
02-29 13:51:27.975: E/AndroidRuntime(9082):at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1034)
02-29 13:51:27.975: E/AndroidRuntime(9082):at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1034)
02-29 13:51:27.975: E/AndroidRuntime(9082):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1034)
02-29 13:51:27.975: E/AndroidRuntime(9082):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1034)
02-29 13:51:27.975: E/AndroidRuntime(9082):     at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1711)
02-29 13:51:27.975: E/AndroidRuntime(9082):     at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1145)
02-29 13:51:27.975: E/AndroidRuntime(9082):     at android.app.Activity.dispatchTouchEvent(Activity.java:2096)
02-29 13:51:27.975: E/AndroidRuntime(9082):at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1695)
02-29 13:51:27.975: E/AndroidRuntime(9082):at android.view.ViewRoot.deliverPointerEvent(ViewRoot.java:2217)
02-29 13:51:27.975: E/AndroidRuntime(9082):at android.view.ViewRoot.handleMessage(ViewRoot.java:1901)
02-29 13:51:27.975: E/AndroidRuntime(9082):at android.os.Handler.dispatchMessage(Handler.java:99)
02-29 13:51:27.975: E/AndroidRuntime(9082):at android.os.Looper.loop(Looper.java:130)
02-29 13:51:27.975: E/AndroidRuntime(9082):at android.app.ActivityThread.main(ActivityThread.java:3701)
02-29 13:51:27.975: E/AndroidRuntime(9082):at java.lang.reflect.Method.invokeNative(Native Method)
02-29 13:51:27.975: E/AndroidRuntime(9082):at java.lang.reflect.Method.invoke(Method.java:507)
02-29 13:51:27.975: E/AndroidRuntime(9082):at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
02-29 13:51:27.975: E/AndroidRuntime(9082):at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:624)
02-29 13:51:27.975: E/AndroidRuntime(9082):at dalvik.system.NativeStart.main(Native Method)

The ShowGraph activity oncreate:

    @Override
public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    // Get arguments
    Bundle extras = getIntent().getExtras();
    if (extras != null) {
        object = extras.getString("object name");
        app = extras.getString("app name");
        list = extras.getString("app list");
    }
    // Set title
    requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
    setContentView(R.layout.main);
    getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,
            R.layout.headermenu);
    // Download the info from the database

     downloadInfo(app, object);

    // set the button listeners
    listeners();
    //Set checkbox listeners
    setCheckListeners();

    // Drag Meteo
    vg = (RelativeLayout) findViewById(R.id.graph);
    vg.setOnTouchListener(new View.OnTouchListener() {
        RelativeLayout vg1 = (RelativeLayout) findViewById(R.id.graph1);

        public boolean onTouch(View v, MotionEvent event) {
            switch (event.getAction()) {
            case MotionEvent.ACTION_MOVE:
                // int x = (int) event.getX() - offset_x;
                int y = (int) event.getY() - offset_y;
                int w = getWindowManager().getDefaultDisplay().getWidth();
                int h = vg.getHeight() - 40;
                if (y < 0)
                    y = 0;
                if (y > h)
                    y = h;
                RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(
                        new ViewGroup.MarginLayoutParams(
                                RelativeLayout.LayoutParams.FILL_PARENT,
                                RelativeLayout.LayoutParams.WRAP_CONTENT));
                lp.setMargins(0, y, 0, 0);
                selected_item.setLayoutParams(lp);
                int height = vg1.getHeight();
                RelativeLayout.LayoutParams lp2 = new RelativeLayout.LayoutParams(
                        new ViewGroup.MarginLayoutParams(
                                RelativeLayout.LayoutParams.FILL_PARENT,
                                RelativeLayout.LayoutParams.WRAP_CONTENT));
                lp2.setMargins(0, 0, 0, Math.abs(vg.getHeight() - y));
                // lp2.height = y-height;
                vg1.setLayoutParams(lp2);
                break;
            default:
                break;
            }
            return true;
        }
    });
    RelativeLayout img = (RelativeLayout) findViewById(R.id.vg);
    img.setOnTouchListener(new View.OnTouchListener() {

        public boolean onTouch(View v, MotionEvent event) {
            switch (event.getAction()) {
            case MotionEvent.ACTION_DOWN:
                offset_x = (int) event.getX();
                offset_y = (int) event.getY();
                selected_item = v;
                break;
            default:
                break;
            }
            return false;
        }
    });
}

I tried with the AsyncTask as I read here but is not working:

Android: Disable ListView once clicked?

  • 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-31T08:35:48+00:00Added an answer on May 31, 2026 at 8:35 am

    What I did to solve it was to add a ProgressDialog in order to prevent people clicking several times when the new activity was loading.

    MyDialog = ProgressDialog.show(ShowGraph.this, ""," Loading. Please wait ... ", true);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When I load my iPhone app it always loads a black screen first then
I created a facebook app and the login loads but once it does that
In my App, first it shows a splash screen. After that another activity, then
in my project my app first tries to connect to the internet, but now
I'm pretty new to iPhone development but I'm close to releasing my first app
i made a small test app with 2 screens. the first screen contains an
Here's my two scenarios. 1 - User opens app for the first time ever
I'm building my first android app - something that will display my tweets in
I am trying to send the item clicked in list to another screen but
In my opengl app, I am drawing the same polygon approximately 50k times but

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.