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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T03:30:24+00:00 2026-06-16T03:30:24+00:00

I am working on an app and am getting a strange error. Two out

  • 0

I am working on an app and am getting a strange error. Two out of the three devices that have been used so far to test the app work perfectly when the log in button is tapped and a new activity is started. The two phones that work are both running on Ice Cream Sandwhich and the third phone (the one that is giving me trouble) is running on JellyBean.

When the log in button is tapped using the JellyBean phone this is what happens.

Java (Register Page)

           // Register button
            TextView main_body_register_button = new TextView(this);
             main_body_register_button.setBackgroundResource(R.drawable.register_btn);
             main_body_register_button.setOnClickListener(new View.OnClickListener() {
                    public void onClick(View v) {
                        // Post to the MySQL database
                        class sendtask extends AsyncTask<String, Void, String> {
                            protected String doInBackground(String... url) {
                                HttpClient httpClient = new DefaultHttpClient();
                                    HttpPost httpPost = new HttpPost("http://website.com/register.php");  
                                        List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();  
                                            nameValuePairs.add(new BasicNameValuePair("number", ""+main_body_phone_input.getText().toString()));

                                            try {
                                                httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
                                            } catch (UnsupportedEncodingException e) {
                                                e.printStackTrace();
                                            } 
                                            try {
                                                httpClient.execute(httpPost);
                                            } catch (ClientProtocolException e) {
                                                e.printStackTrace();
                                            } catch (IOException e) {
                                                e.printStackTrace();
                                            }
                                                return "";
                            }
                                protected void onPostExecute(String result) {
                                    if (main_body_phone_input.getText().toString().compareTo("012-345-6789")==0) {
                                        // Phone number: Empty
                                        Intent base_account_register = new Intent(base_account_register.this,base_account_register.class);
                                        startActivity(base_account_register);
                                    } else if (main_body_phone_input.getText().toString().compareTo("012-345-6789")!=0) {
                                        // Switch to main page
                                        Intent TellATextActivity = new Intent(base_account_register.this,TellATextActivity.class);
                                         ownAddress  = ""+main_body_phone_input.getText().toString();
                                        startActivity(TellATextActivity);
                                    }
                                }
                        }
                            new sendtask().execute("Registration form");
                        // End
                    }
             });
           // END

Java (OnCreate TellATextActivity)

   public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Global variables
    Bundle bundle = getIntent().getExtras();
    final String ownAddress  = bundle.getString("session_number");

       // MAIN
       TextView main_message = new TextView(this);
            // Select and parse the most recent message
            Uri uriSMS = Uri.parse("content://sms/");
            Cursor cur = getContentResolver().query(uriSMS, null, null, null, null);

            // EDIT IN          
            if (cur != null && cur.moveToFirst()) {
             do {
              // Inflate your data
             } while (cur.moveToNext());
            }
             cur.close()
            // END

            // EDIT OUT
            cur.moveToNext();
            cur.moveToNext();
            // END

            String body = cur.getString(cur.getColumnIndex("body"));
            String add = cur.getString(cur.getColumnIndex("address"));
             reply_address = "" +add;
            String time = cur.getString(cur.getColumnIndex("date"));
            String protocol = cur.getString(cur.getColumnIndex("protocol"));
            String contactName = "";

            Uri personUri = Uri.withAppendedPath( ContactsContract.PhoneLookup.CONTENT_FILTER_URI, Uri.encode(add));
                Cursor c = getContentResolver().query(personUri, new String[] { PhoneLookup.DISPLAY_NAME }, null, null, null );  
                    if( c.moveToFirst() ) {
                        int nameIndex = c.getColumnIndex(PhoneLookup.DISPLAY_NAME);  
                        contactName = c.getString(nameIndex);
                    }
                    c.close();
                    cur.close();
            String out = "";
            Date d = new Date(Long.valueOf(time));
            // End

            // Determine status of message
            if (protocol == null)
                out = ""+body;
            else 
                out = ""+body;
            // End

            // Create output
            main_message.setHeight(400);
            main_message.setWidth(510);
            main_message.setPadding(10,15,10,0);
            main_message.setTextSize(23);
            main_message.setTextColor(Color.rgb(100,100,100));
            main_message.setText(out);
            // End
        // END

        TextView bottom_reply = new TextView(this);
         bottom_reply.setBackgroundResource(R.drawable.reply);
         bottom_reply.setOnClickListener(new View.OnClickListener() {
             public void onClick(View v) {
                 // Compose a reply
                 Intent intent = new Intent(Intent.ACTION_SENDTO);
                 intent.setData(Uri.parse("smsto:" +reply_address));
                 intent.putExtra("compose_mode", true);
                 startActivity(intent);
             }
         });
        // END

     }

AndroidManifest.xml

    <activity
        android:name=".TellATextActivity"
        android:label="@string/app_name"
        android:configChanges="orientation|keyboardHidden"
        android:screenOrientation="portrait" >
         <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:mimeType="vnd.android-dir/mms-sms" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <action android:name="android.intent.action.SENDTO" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:scheme="sms" />
            <data android:scheme="smsto" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.SEND" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:mimeType="text/plain" />
        </intent-filter>
    </activity>

Crash Report

java.lang.RuntimeException: Unable to start activity 
ComponentInfo{tellatext.sms.app/tellatext.sms.app.TellATextActivity}: 
android.database.CursorIndexOutOfBoundsException: Index 1 requested, with a size of 1
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2049)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2083)
at android.app.ActivityThread.access$600(ActivityThread.java:134)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1233)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4697)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.database.CursorIndexOutOfBoundsException: Index 1 requested, with a size of 1
at android.database.AbstractCursor.checkPosition(AbstractCursor.java:407)
at android.database.AbstractWindowedCursor.checkPosition(AbstractWindowedCursor.java:136)
at android.database.AbstractWindowedCursor.getString(AbstractWindowedCursor.java:50)
at android.database.CursorWrapper.getString(CursorWrapper.java:114)
at tellatext.sms.app.TellATextActivity.onCreate(TellATextActivity.java:82)
at android.app.Activity.performCreate(Activity.java:4539)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2013)
... 11 more

Would anyone be able to point me in the right direction here? I have exhausted all of my options and need someone else’s perspective on the issue.

Thank you.

  • 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-16T03:30:26+00:00Added an answer on June 16, 2026 at 3:30 am

    The problem was occuring when someone was using the app with less than 3 text messages in their inbox. By moving the inbox cursor to a spot without a text message the app as crashing because the spot didn’t exist.

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

Sidebar

Related Questions

I have an application that has been getting strange errors when canceling out of
I have been working on getting a mail app to work from a tutorial
Hey guys, I'm getting a really strange error. I have a program that needs
Getting something really strange that I just can't work out. I have 3 methods
I'm working on a GWT app, and keep getting the error shown below. I
I've been working with app engine for quite some time, I know that there
I've been trying to get a basic app working that doesnt use an XIB.
I'm having issues getting a simple server/client socket app working in C# between two
I'm working on an ASP.NET project and I've started getting this really strange error
We have a working app and server that uses C2DM to push messages to

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.