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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T14:21:40+00:00 2026-06-16T14:21:40+00:00

i have a little problem with my code here is my code public class

  • 0

i have a little problem with my code

here is my code

public class LihatInfo extends Activity {
   
   TextView error,br1;
   String i,id_kepadatan,returnString;
   
   
    /** Called when the activity is first created. */
   
   @Override
   
   
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.lihat_info);
       
        br1=(TextView)findViewById(R.id.berita1);
       
        
      
       
        
   }
   
   public void clickHandler(View view){
    Intent a = null;
    id_kepadatan = "1";
    switch (view.getId()){
    case R.id.lihatInfo:
        
ArrayList<NameValuePair> postParameters = new ArrayList<NameValuePair>();
        
        postParameters.add(new BasicNameValuePair("id_kepadatan", id_kepadatan));
           
        
/*            String valid = "1";*/      
        
        String response = null;
        
        try {
           
           response = CustomHttpClient.executeHttpPost("http://10.0.2.2/android/lihatInfo.php", postParameters);
           
           
           String result = response.toString();  
           //parse json data

              try{
                      returnString = "";


                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")
                              );

                              //Get an output to the screen
                              returnString += "\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{


               br1.setText(returnString);


              }


              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.cariPeta2:
        a = new Intent(this,MainActivity2.class);
        startActivity(a);
        break;
   case R.id.kembali2:
        a = new Intent(this, Menu.class);
        startActivity(a);
        break;
}
   }
    
    
}

what i want to ask is

  1. what the meaning of symbol += in line

    returnString += "\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");

  2. can i replace String returnString with this String[] returnString ? because i want to use ListView, not using TextView like my code above…..

that’s all i want to ask…..for every help, i will much appreciate it

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-16T14:21:42+00:00Added an answer on June 16, 2026 at 2:21 pm

    += Symbol is used for the appending text .

    ADD – AND assignment operator, It adds right operand to the left operand
    and assign the result to left operand

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

Sidebar

Related Questions

I have a little problem. Class ll: interface jj{ public class ll implements gg{
I have a little problem in coding in OO way. Here is my code:
I have following code: public class GameCanvas extends JPanel { private GridField[][] grid; private
This little bit of code will help me describe my problem: public class Car
i have a trouble and i need your help. Here's my code: public class
i have a little problem with my java socket code. I'm writing an android
I have a little problem. This is my code: stackPanelShapesContainer = new StackPanel(); InitializeStackPanle();
I have a little problem, I need to make directory from my c code
I have a little problem with Jquery getJSON function. my json here { entries:
I have a little problem with templates. Since it's easier to explain with code,

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.