title: vertical listview android application?
body: <p>i am making a weather application and i want to display its details in a listview and i am having problems it is giving me errors i dont understand i have been trying to fix it and i cant think of any other way .please i need help i hope i explained the question well</p>
  
  <p>this is my error</p>
  
  <pre><code> java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.helloworldng.bip/com.helloworldng.bip.navigate.Search}: java.lang.InstantiationException: class com.helloworldng.bip.navigate.Search has no zero argument constructor
              at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2426)
              at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2601)
              at android.app.ActivityThread.access$800(ActivityThread.java:178)
              at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1470)
              at android.os.Handler.dispatchMessage(Handler.java:111)
              at android.os.Looper.loop(Looper.java:194)
              at android.app.ActivityThread.main(ActivityThread.java:5637)
              at java.lang.reflect.Method.invoke(Native Method)
              at java.lang.reflect.Method.invoke(Method.java:372)
              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:959)
              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)
       Caused by: java.lang.InstantiationException: class com.helloworldng.bip.navigate.Search has no zero argument constructor
              at java.lang.Class.newInstance(Class.java:1597)
              at android.app.Instrumentation.newActivity(Instrumentation.java:1071)
              at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
              at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2601)
              at android.app.ActivityThread.access$800(ActivityThread.java:178)
              at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1470)
              at android.os.Handler.dispatchMessage(Handler.java:111)
              at android.os.Looper.loop(Looper.java:194)
              at android.app.ActivityThread.main(ActivityThread.java:5637)
              at java.lang.reflect.Method.invoke(Native Method)
              at java.lang.reflect.Method.invoke(Method.java:372)
              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:959)
              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)
       Caused by: java.lang.NoSuchMethodException: &lt;init&gt; []
              at java.lang.Class.getConstructor(Class.java:531)
              at java.lang.Class.getDeclaredConstructor(Class.java:510)
              at java.lang.Class.newInstance(Class.java:1595)
              at android.app.Instrumentation.newActivity(Instrumentation.java:1071)
              at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
              at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2601)
              at android.app.ActivityThread.access$800(ActivityThread.java:178)
              at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1470)
              at android.os.Handler.dispatchMessage(Handler.java:111)
              at android.os.Looper.loop(Looper.java:194)
              at android.app.ActivityThread.main(ActivityThread.java:5637)
              at java.lang.reflect.Method.invoke(Native Method)
              at java.lang.reflect.Method.invoke(Method.java:372)
              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:959)
              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)
  </code></pre>
  
  <p>this is the first class</p>
  
  <pre><code>package com.helloworldng.bip.navigate;
  
  import java.io.BufferedReader;
  import java.io.IOException;
  import java.io.InputStream;
  import java.io.InputStreamReader;
  import java.net.HttpURLConnection;
  import java.net.URL;
  import java.util.ArrayList;
  import java.util.HashMap;
  import java.util.List;
  import java.util.Map;
  import java.util.Vector;
  
  import org.json.JSONArray;
  import org.json.JSONException;
  import org.json.JSONObject;
  import android.app.ListActivity;
  import android.app.ProgressDialog;
  import android.content.ContentValues;
  import android.content.Context;
  import android.database.Cursor;
  import android.net.Uri;
  import android.util.Log;
  import android.os.Bundle;
  import android.os.Handler;
  import android.text.format.Time;
  import android.util.Log;
  
  import android.view.View;
  import android.widget.AdapterView;
  import android.widget.BaseAdapter;
  import android.widget.ListAdapter;
  import android.widget.ListView;
  import android.widget.SimpleAdapter;
  import android.widget.Toast;
  
  
  import com.helloworldng.bip.GetTrafficReportTask;
  import com.helloworldng.bip.R;
  import com.helloworldng.bip.data.BIPContract;
  
  
  public class Search extends ListActivity {
  
      private final String LOG_TAG = GetTrafficReportTask.class.getSimpleName();
  
  
      public static  final String BIP_STATE = "state";
      public static  final String BIP_CITY = "city";
      public static  final String BIP_DESC = "description";
      public static  final String BIP_STATUS = "status";
      private static final String URL_CATEGORY = "http://www.helloworldng.com/bip/get_traffic.php";
      private final Context mContext;
  
      //public FetchWeatherTask(Context context, ArrayAdapter&lt;String&gt; forecastAdapter) {
      public Search(Context context) {
          mContext = context;
          //mForecastAdapter = forecastAdapter;
      }
  
      private BaseAdapter mAdapter;
      private ListView lv;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.droptrafic);
          lv = getListView();
          lv.setDivider(null);
  
          final Handler handler = new Handler();
          Runnable refresh = new Runnable() {
              @Override
              public void run() {
                  handler.postDelayed(this, 60 * 1000);
              }
          };
          handler.postDelayed(refresh, 60 * 1000);
      }
  
      private void getTrafficDataFromJson(String forecastJsonStr)
              throws JSONException {
  
          try {
              JSONArray trafficArray = new JSONArray(forecastJsonStr);
              //JSONArray trafficArray = forecastJson.getJSONArray(BIP_TRAFFIC);
  
              // Insert the new weather information into the database
              Vector&lt;ContentValues&gt; cVVector = new Vector&lt;ContentValues&gt;(trafficArray.length());
  
              Time dayTime = new Time();
              dayTime.setToNow();
  
              dayTime = new Time();
  
              for (int i = 0; i &lt; trafficArray.length(); i++) {
                  String state;
                  String status;
                  JSONObject dayTraffic = trafficArray.getJSONObject(i);
  
                  state = dayTraffic.getString(BIP_STATE);
                  status = dayTraffic.getString(BIP_STATUS);
  
                  final ListAdapter adapter = new SimpleAdapter(this, (List&lt;? extends Map&lt;String, ?&gt;&gt;) dayTraffic,
                          R.layout.single_drop, new String[] { state,status
                  }, new int[] { R.id.title, R.id.desc});
  
                  setListAdapter(adapter);
                  ListView lv = getListView();
              }
  
          } catch (JSONException e) {
              Log.e(LOG_TAG, e.getMessage(), e);
              e.printStackTrace();
          }
          //return null;
      }
  
      protected Void doInBackground(String... params) {
  
          // If there's no zip code, there's nothing to look up.  Verify size of params.
          if (params.length == 0) {
              return null;
          }
          String locationQuery = params[0];
  
          // These two need to be declared outside the try/catch
          // so that they can be closed in the finally block.
          HttpURLConnection urlConnection = null;
          BufferedReader reader = null;
  
          // Will contain the raw JSON response as a string.
          String forecastJsonStr = null;
  
          String format = "json";
          String units = "metric";
          int numDays = 7;
          String app_id = "b7940b102bb44bb3c5accd21eb44da00";
  
  
          try {
              // Construct the URL for the OpenWeatherMap query
              // Possible parameters are avaiable at OWM's forecast API page, at
              // http://openweathermap.org/API#forecast
              final String FORECAST_BASE_URL =
                      "http://www.helloworldng.com/bip/get_traffic.php";
              final String QUERY_PARAM = "q";
              final String FORMAT_PARAM = "mode";
              final String UNITS_PARAM = "units";
              final String DAYS_PARAM = "cnt";
              final String APPID = "appid";
  
              Uri builtUri = Uri.parse(FORECAST_BASE_URL);
  
              URL url = new URL(builtUri.toString());
              Log.e("Today Traffic", url.toString());
              // Create the request to OpenWeatherMap, and open the connection
              urlConnection = (HttpURLConnection) url.openConnection();
              urlConnection.setRequestMethod("GET");
              urlConnection.connect();
  
              // Read the input stream into a String
              InputStream inputStream = urlConnection.getInputStream();
              StringBuffer buffer = new StringBuffer();
              if (inputStream == null) {
                  // Nothing to do.
                  return null;
              }
              reader = new BufferedReader(new InputStreamReader(inputStream));
  
              String line;
              while ((line = reader.readLine()) != null) {
                  // Since it's JSON, adding a newline isn't necessary (it won't affect parsing)
                  // But it does make debugging a *lot* easier if you print out the completed
                  // buffer for debugging.
                  buffer.append(line + "\n");
              }
  
              if (buffer.length() == 0) {
                  // Stream was empty.  No point in parsing.
                  return null;
              }
              forecastJsonStr = buffer.toString();
              Log.e(LOG_TAG + " Manual", forecastJsonStr);
              getTrafficDataFromJson(forecastJsonStr);
          } catch (IOException e) {
              Log.e(LOG_TAG, "Error ", e);
              // If the code didn't successfully get the weather data, there's no point in attempting
              // to parse it.
              // return null;
          } catch (JSONException e) {
              Log.e(LOG_TAG, e.getMessage(), e);
              e.printStackTrace();
          } finally {
              if (urlConnection != null) {
                  urlConnection.disconnect();
              }
              if (reader != null) {
                  try {
                      reader.close();
                  } catch (final IOException e) {
                      Log.e(LOG_TAG, "Error closing stream", e);
                  }
              }
          }
          return null;
      }
  
  }
  </code></pre>
  
  <p>this is the listview xml layout</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent" android:layout_height="match_parent"
      android:orientation="vertical"&gt;
  
      &lt;ListView
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:id="@+id/listView" /&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>this is the first xml class single_drop</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent" android:layout_height="match_parent"&gt;
  
      &lt;TextView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:textAppearance="?android:attr/textAppearanceLarge"
          android:text="Heavy Traffic"
          android:id="@+id/status" /&gt;
  
      &lt;TextView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:textAppearance="?android:attr/textAppearanceLarge"
          android:text="state"
          android:id="@+id/desc"
          android:layout_alignParentTop="true"
          android:layout_centerHorizontal="true" /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>