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

  • Home
  • SEARCH
  • 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 9111259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T03:27:43+00:00 2026-06-17T03:27:43+00:00

I should start off by noting I am extremely new to Android Development so

  • 0

I should start off by noting I am extremely new to Android Development so sorry if my question seems dumb. I am trying to query my SQLite Database in the application to dynamically create the content on the activity. Here is the query in my Database Helper file

    public Cursor getWhereToEatActivity (int LocationId)
{
    Cursor cursor = myDataBase.rawQuery("SELECT Location.locationId as _id,Location.title,Location.desc, location.address, location.hours, location.website, location.phone FROM " +
            "TripWhereToEat JOIN Trip ON TripWhereToEat.tripId = Trip.tripId JOIN Location ON " +
            "Location.locationId = TripWhereToEat.locationId where TripWhereToEat.tripId = ?",
            new String[] {Integer.toString(LocationId)});

    cursor.moveToFirst();
    return cursor;
}

Here is where the item is selected:

 @Override
              public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {

                LocationListitem locationItem = (LocationListitem)lvItems.getItemAtPosition(position);

                int locationId = locationItem.getLocationId();

                // Pass the ID into the next activity
                Map<String, String> parms = new HashMap<String, String>();
                parms.put("locationId", Integer.toString(locationId));
                if (listType.equals("whattosee")) {
                    // switchActivity(WhatToSeeActivity.class, parms);
                }
                if (listType.equals("wheretostay")) {
                    // switchActivity(WhereToStayActivity.class, parms);
                }
                if (listType.equals("wheretoeat")) {
                    switchActivity(WhereToEatActivity.class, parms);
                }
              }
            });

And here is the activity is switches to:

public class WhereToEatActivity extends FragmentActivityBase {

private int LocationId;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_where_to_eat);

    AndroidApplication app = (AndroidApplication)getApplication();

    DatabaseHelper myDbHelper = app.getDatabase(); // new DatabaseHelper(this);

    LocationId = Integer.valueOf(this.getParam("LocationId"));

    Cursor tripRecord = myDbHelper.getWhereToEatActivity(LocationId);

    tripRecord.moveToFirst();

    if (!tripRecord.isAfterLast()) {
        String name = tripRecord.getString(tripRecord.getColumnIndex("title"));
        String title = tripRecord.getString(tripRecord.getColumnIndex("desc"));
        String image = tripRecord.getString(tripRecord.getColumnIndex("image"));
        String address = tripRecord.getString(tripRecord.getColumnIndex("address"));

        ImageView mainImageView = (ImageView)findViewById(R.id.image);
        int resId = getResources().getIdentifier("com.integrativelogic.roadtrip:drawable/"+image, null, null); 
        Bitmap bitmap = BitmapFactory.decodeResource(getResources(),resId);
        if (bitmap != null)
            mainImageView.setImageBitmap (bitmap);    

        TextView nameView = (TextView)findViewById(R.id.name);
        nameView.setText(name);

        TextView titleView = (TextView)findViewById(R.id.title);

        titleView.setText(Html.fromHtml(title));
        titleView.setMovementMethod(LinkMovementMethod.getInstance());

        TextView addressView = (TextView)findViewById(R.id.address);
        addressView.setText(address);
    }

    tripRecord.close();
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.activity_main, menu);
    return true;
}
}

And this is the error I get from Logcat:

01-12 11:23:52.186: E/AndroidRuntime(15238): FATAL EXCEPTION: main
01-12 11:23:52.186: E/AndroidRuntime(15238): java.lang.RuntimeException: Unable to start  activity ComponentInfo{com.integrativelogic.roadtrip/com.integrativelogic.roadtrip.WhereToEatActivity}: java.lang.NumberFormatException: unable to parse '' as integer
01-12 11:23:52.186: E/AndroidRuntime(15238):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1821)
01-12 11:23:52.186: E/AndroidRuntime(15238):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1842)
01-12 11:23:52.186: E/AndroidRuntime(15238):    at android.app.ActivityThread.access$1500(ActivityThread.java:132)
01-12 11:23:52.186: E/AndroidRuntime(15238):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1038)
01-12 11:23:52.186: E/AndroidRuntime(15238):    at android.os.Handler.dispatchMessage(Handler.java:99)
01-12 11:23:52.186: E/AndroidRuntime(15238):    at android.os.Looper.loop(Looper.java:150)
01-12 11:23:52.186: E/AndroidRuntime(15238):    at android.app.ActivityThread.main(ActivityThread.java:4263)
01-12 11:23:52.186: E/AndroidRuntime(15238):    at java.lang.reflect.Method.invokeNative(Native Method)
01-12 11:23:52.186: E/AndroidRuntime(15238):    at java.lang.reflect.Method.invoke(Method.java:507)
01-12 11:23:52.186: E/AndroidRuntime(15238):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
01-12 11:23:52.186: E/AndroidRuntime(15238):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
01-12 11:23:52.186: E/AndroidRuntime(15238):    at dalvik.system.NativeStart.main(Native Method)
01-12 11:23:52.186: E/AndroidRuntime(15238): Caused by: java.lang.NumberFormatException: unable to parse '' as integer
01-12 11:23:52.186: E/AndroidRuntime(15238):    at java.lang.Integer.parseInt(Integer.java:362)
01-12 11:23:52.186: E/AndroidRuntime(15238):    at java.lang.Integer.parseInt(Integer.java:332)
01-12 11:23:52.186: E/AndroidRuntime(15238):    at java.lang.Integer.valueOf(Integer.java:506)
01-12 11:23:52.186: E/AndroidRuntime(15238):    at com.integrativelogic.roadtrip.WhereToEatActivity.onCreate(WhereToEatActivity.java:27)
01-12 11:23:52.186: E/AndroidRuntime(15238):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1072)
01-12 11:23:52.186: E/AndroidRuntime(15238):    at     android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1785)
  • 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-17T03:27:44+00:00Added an answer on June 17, 2026 at 3:27 am

    as you’re new I’ll explain a bit on the debugging process when you have a sudden crash of your app like this:

    1st part is read the last few lines of the LogCat output:

    Caused by: java.lang.NumberFormatException: unable to parse ” as integer

    so we know that is a problem trying to make an empty string be an integer. You can only create an integer from a String that contains numbers.

    a few lines below that one on the Log you’ll see

    at com.integrativelogic.roadtrip.WhereToEatActivity.onCreate(WhereToEatActivity.java:27)

    so then we know that it happens on the line 27 of your WhereToEatActivity, I’m not gonna count the lines of what you posted here but I’m assuming it’s this line

    LocationId = Integer.valueOf(this.getParam("LocationId"));
    

    so I guess it’s safe to assume that the reason you’re having this error is because there is no parameter “LocationId” or the parameter is empty.

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

Sidebar

Related Questions

I'm a total C n00b trying to teach myself C off K&R. My question
I'll start off with the code as it should be fairly self-explanatory: <commonControls:SearchTextBox x:Name=searchTextBox
First off i'll start by noting that its not my choice to use nvp's
I'm fairly new to Android development and am working on an app which allows
I should start off by saying that I am regretfully and painfully a noob
I'm trying to learn C and as a start, i set off writing a
OK, I should start this off by saying I'm not sure this is necessarily
i have uitextfield i wan that it should start entering text from top instead
I am coding a game which should start several mini-games when scanning a specific
I read a lot of posts that convinced me I should start writing unit

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.