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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T06:57:35+00:00 2026-06-12T06:57:35+00:00

I’m loading the same page with different data. I’ve got it so it’s listing

  • 0

I’m loading the same page with different data. I’ve got it so it’s listing my items and when I click one, it’s sending the correct next page type and ID through. But it’s still loading my first pages SQLStatement. The right things are being logged out.

Do I need to clear it down or something first?

Here is my code:

public class LocationListView extends Activity {

String SQLStatement;
String itemID = "1001-0001021";
String Type;
;


    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_location_list_view);

        Bundle extras = getIntent().getExtras(); 
        String dataType;
        String dataID;

        if (extras != null) {
            dataType = extras.getString("Type");
            dataID = extras.getString("ID");

        } else {
            dataType = "notset";
            dataID = "notset";
        }


        File dbfile = new File(Global.currentDBfull); 
        SQLiteDatabase db = SQLiteDatabase.openOrCreateDatabase(dbfile, null);

        if(dataType == "notset") {

            SQLStatement = "select * from stationobjects where stationid= " + Global.StationID + " and objectid=0";
            Type = "Room";

        } else if(dataType == "Room") {

            SQLStatement = "select * from stationobjects where stationid= " + Global.StationID + "  and objectid=1001 and diagramid like '"+ itemID +"%'";
            Type = "Area";

            Context context = getApplicationContext();
            CharSequence text = "Hello toast!";
            int duration = Toast.LENGTH_SHORT;

            Toast toast = Toast.makeText(context, text, duration);
            toast.show();

        } else if(dataType == "Area") {

            Type = "Zone";
        } else if(dataType == "Zone") {


        } else {

            SQLStatement = "select * from stationobjects where stationid= " + Global.StationID + " and objectid=0";
            Type = "Room";
        }


        Cursor c = db.rawQuery(SQLStatement, null);  
        if(c.getCount() != 0) {

        Log.e("LocationListView", "Found Items");   

        c.moveToFirst();

      ArrayList<String> mItemName = new ArrayList<String>();
      final ArrayList<String> mItemID = new ArrayList<String>();

        c.moveToFirst();
        while(!c.isAfterLast()) {
             mItemName.add(c.getString(c.getColumnIndex("Name")));
             mItemID.add(c.getString(c.getColumnIndex("StationObjectID")));
             c.moveToNext();
        }

        final ListView listView = (ListView) findViewById(R.id.lvLocation);
        final ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
              android.R.layout.simple_list_item_1, android.R.id.text1, mItemName);

        int[] colors = {0, 0xFFFF0000, 0}; 
        listView.setDivider(new GradientDrawable(Orientation.RIGHT_LEFT, colors));
        listView.setDividerHeight(1);
        listView.setAdapter(adapter); 

        listView.setClickable(true);
        listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

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

            Object o = listView.getItemAtPosition(position);
            String StationObjectID = mItemID.get(position);
            Log.e("LocationListView", "" + o);
            Log.e("LocationListView", "" + StationObjectID);


            startActivityForResult(SwapPage, 0);

          }
        });

        } else {

            Log.e("LocationListView", "Not Found Items");   
            Context context = getApplicationContext();
            CharSequence text = "Sorry No data returned";
            int duration = Toast.LENGTH_LONG;

            Toast toast = Toast.makeText(context, text, duration);
            toast.show();
        }

        db.close();


    }




}
  • 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-12T06:57:36+00:00Added an answer on June 12, 2026 at 6:57 am

    The data from your Intent looks correct, the problem is that in Java you must compare Strings like this:

    if(dataType.equals("notset")) 
    

    not:

    if(dataType == "notset") 
    

    Detailed explanation: How do I compare strings in Java?

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

Sidebar

Related Questions

I'm making a simple page using Google Maps API 3. My first. One marker
I used javascript for loading a picture on my website depending on which small
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I am reading a book about Javascript and jQuery and using one of the
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I've tracked down a weird MySQL problem to the two different ways I was
i got an object with contents of html markup in it, for example: string

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.