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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T04:30:02+00:00 2026-06-15T04:30:02+00:00

everyone i have a problem with my project here is my search.java code import

  • 0

everyone

i have a problem with my project

here is my search.java code

import java.util.ArrayList;

import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;




import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.TextView;

public class Search extends Activity {

   TextView error,br2;
   Spinner namjal2;
   String i,returnString2,jln;
   String[] jalan = {"A.Yani", "Ambengan", "Anjasmoro","Baliwerti","Basuki Rahmat","Bintoro","Ciliwung","Citarum","Citandui","Darmo Daya","Darmokali","Dharmawangsa","Dinoyo","Embong Kemiri","Embong Malang"};


    /** Called when the activity is first created. */

   @Override


    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.search);

        br2=(TextView)findViewById(R.id.berita2);
        namjal2=(Spinner)findViewById(R.id.namjalSearch);
        ArrayAdapter<String> aa = new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item, jalan);
        aa.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
         namjal2.setAdapter(aa);




   }

   public void clickHandler(View view){
    Intent a = null;
    switch (view.getId()){
    case R.id.find:
        jln = jalan[namjal2.getSelectedItemPosition()];
ArrayList<NameValuePair> postParameters = new ArrayList<NameValuePair>();

postParameters.add(new BasicNameValuePair("nama_jalan", jln));


/*            String valid = "1";*/      

        String response = null;

        try {

           response = CustomHttpClient.executeHttpPost("http://192.168.1.3/android/searchInfo.php", postParameters);


           String result = response.toString();  
           //parse json data

              try{
                      returnString2 = "";


                JSONArray jArray = new JSONArray(result);
                      for(int i=0;i<jArray.length();i++){

                              JSONObject json_data = jArray.getJSONObject(i);
                              Log.i("log_tag","id_kepadatan: "+json_data.getInt("id_kepadatan")+
                                      ", username: "+json_data.getString("username")+
                                      ", nama_jalan: "+json_data.getString("nama_jalan")+
                                      ", status: "+json_data.getString("status")+
                                      ", tanggal: "+json_data.getString("tanggal")+
                                      ", waktu: "+json_data.getString("waktu")+
                                      ", keterangan: "+json_data.getString("keterangan")
                              );
                              if(result.equals(null)){
                              //Get an output to the screen
                             returnString2 += "Data tidak ada";
                              }
                              else{
                              returnString2 += "\n" + json_data.getString("nama_jalan") + " mengalami "+ json_data.getString("status")+ " pada "+ json_data.getString("tanggal")+ " waktu "+ json_data.getString("waktu")+ " karena "+ json_data.getString("keterangan");
                              }
                      }
              }


              catch(JSONException e){
                      Log.e("log_tag", "Error parsing data "+e.toString());
              }

              try{


               br2.setText(returnString2);


              }


              catch(Exception e){

               Log.e("log_tag","Error in Display!" + e.toString());;          

              }   

         }

               catch (Exception e) {

          Log.e("log_tag","Error in http connection!!" + e.toString());     

         }
        break;

   case R.id.back:
        a = new Intent(this, Menu.class);
        startActivity(a);
        break;
}
   }


}

and here is my search.xml

<?xml version="1.0" encoding="utf-8"?>
<ScrollView
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:fillViewport="true">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"  
    android:background="#ffffff"  
   > 

  <LinearLayout
          xmlns:android="http://schemas.android.com/apk/res/android"
          android:orientation="vertical"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:padding="10dip"
          >
  <TextView android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:textColor="#372c24"
                android:text="PENCARIAN BERITA TERBARU"/>
    <TextView android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:textColor="#372c24"
                android:text="Masukkan Nama Jalan"/>

          <Spinner
                android:id="@+id/namjalSearch" 
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="16dip"
                android:layout_marginBottom="20dip"
                android:singleLine="true"/>
    <Button android:id="@+id/find" 
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="250dip"
                android:text="Find"
                android:onClick="clickHandler"/>
    <TextView
                android:id="@+id/berita2"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:textColor="#372c24"
                />  
    <RelativeLayout
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent">
          <TextView
                android:id="@+id/textBack" 
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="25dip"
                android:layout_marginTop="130dip"
                android:layout_marginLeft="190dip"
                android:textColor="#372c24"
                android:text="BACK"/>
        <ImageButton
                android:id="@+id/back"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="125dip"
                android:layout_marginLeft="258dip"
                android:src="@drawable/back"
                android:background="@null" 
                android:onClick="clickHandler"/>
        <Button android:id="@+id/cariPeta" 
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="125dip"
                android:text="Cari Peta"
                android:onClick="clickHandler"/>
            </RelativeLayout>
    </LinearLayout>
</RelativeLayout>
</ScrollView>

my goal is when i click the “cariPeta” button, it will show the map from the street which choosen

for example, if spinner pointing one name of the street (ex : “A.Yani” street) … then, when i click “cariPeta” button,,,it will show the map of “A.Yani” street in google map

my problem is, i dont know what code should i write….can you tell me? i will much appreciate it because this project is very important to me

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-15T04:30:03+00:00Added an answer on June 15, 2026 at 4:30 am

    Ok let me guide you.
    You need to write click event of button.
    On click of that button getSelectedIndex of spinner (there is a readymade method for it in spinner obj).

    After receiving index value fetch text from string array.

    Then Map will come in picture. But to deal with the map you need pair of lat/long.

    Using lat/long you can show any point on map.

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

Sidebar

Related Questions

Hello again everyone, This time I have a problem with Intent & Extras. here's
hey everyone, here is the site SEE BELOW I have a slight jquery problem
I have a problem in my project with the .designer which as everyone know
Hello everyone I have a problem. I want to do a GridView with a
Good day everyone! I have a problem regarding my date. It needs to be
Hi everyone my problem today is I have a couple of buttons that slide
Salutations everyone, I have a somewhat strange problem with my repo. Initial I only
Good day everyone. I have been having the same problem all day at work
hello everyone i have a problem with my 3-tiers application i don't know how
everyone, I've started working yesterday on the Euler Project in Clojure and I have

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.