title: How to display a listview and a webview in one Activity?
body: <p>So I'm trying to implement two API in one Activity, and display both the listview and a webview for my second API in the same Activity. I managed to get the listview down. This is part of the MainActivity where I'm trying to call both run both API's through the onClick method</p>
  
  <pre><code>    @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.twit_list);
      activity = this;
  
      Key = getStringFromManifest("CONSUMER_KEY");
      Secret = getStringFromManifest("CONSUMER_SECRET");
  
      txtSearch = (EditText) findViewById(R.id.txtSearch);
      searchbtn = (Button) findViewById(R.id.searchbtn);
      save = (Button) findViewById(R.id.save);
      savedSearches = (Button)findViewById(R.id.savedSearches);
  
      searchbtn.setOnClickListener(new View.OnClickListener(){
          @Override
      public void onClick(View view){
  
              downloadSearches();
              new GoogleSearch();
  
  
          }
      });
      save.setOnClickListener(new Button.OnClickListener() {
          @Override
          public void onClick(View v) {
              saveSearch();
  
          }
      });
  
      savedSearches.setOnClickListener(new Button.OnClickListener(){
          @Override
      public void onClick(View v){
              openSavedSearches();
          }
      });
  
  }
  </code></pre>
  
  <p>This is the GoogleSearch Api 
       public void onCreate(Bundle savedInstanceState){
          super.onCreate(savedInstanceState);
          setContentView(R.layout.twit_list);</p>
  
  <pre><code>    txtSearch = (EditText)webView.findViewById(R.id.txtSearch);
      searchbtn = (Button) webView.findViewById(R.id.searchbtn);
      webView = (WebView)webView.findViewById(R.id.webView);
  
      searchbtn.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              String item = txtSearch.getText().toString();
              new JsonSearchTask(item).execute();
          }
      });
  }
  
      private class JsonSearchTask extends AsyncTask&lt;Void, Void, Void&gt; {
  
          String searchResult = "";
          String search_url =   "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&amp;q=";
          String search_query;
  
          JsonSearchTask(String item){
  
              try {
                  search_item = URLEncoder.encode(item, "utf-8");
              } catch (UnsupportedEncodingException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              }
  
              search_query = search_url + search_item;
          }
  
          @Override
          protected Void doInBackground(Void... arg0) {
  
              try {
                  searchResult = ParseResult(sendQuery(search_query));
              } catch (JSONException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              } catch (IOException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              }
  
              return null;
          }
  
          @Override
          protected void onPreExecute() {
  
              searchbtn.setEnabled(false);
              searchbtn.setText("Wait...");
              super.onPreExecute();
          }
  
          @Override
          protected void onPostExecute(Void result) {
  
              webView.loadData(searchResult,
                      "text/html",
                      "UTF-8");
  
              searchbtn.setEnabled(true);
              searchbtn.setText("Search");
  
              super.onPostExecute(result);
          }
  
      }
  
  private String sendQuery(String query) throws IOException{
      String result = "";
  
      URL searchURL = new URL(query);
  
      HttpURLConnection httpURLConnection = (HttpURLConnection) searchURL.openConnection();
  
      if(httpURLConnection.getResponseCode() == HttpURLConnection.HTTP_OK){
          InputStreamReader inputStreamReader = new InputStreamReader(httpURLConnection.getInputStream());
          BufferedReader bufferedReader = new BufferedReader(
                  inputStreamReader,
                  8192);
  
          String line = null;
          while((line = bufferedReader.readLine()) != null){
              result += line;
          }
  
          bufferedReader.close();
      }
  
      return result;
  }
  
  private String ParseResult(String json) throws JSONException{
      String parsedResult = "";
  
      JSONObject jsonObject = new JSONObject(json);
      JSONObject jsonObject_responseData = jsonObject.getJSONObject("responseData");
      JSONArray jsonArray_results = jsonObject_responseData.getJSONArray("results");
  
      //parsedResult += "Google Search APIs (JSON) for : &lt;b&gt;" + search_item + "&lt;/b&gt;&lt;br/&gt;";
      //parsedResult += "Number of results returned = &lt;b&gt;" + jsonArray_results.length() + "&lt;/b&gt;&lt;br/&gt;&lt;br/&gt;";
  
      for(int i = 0; i &lt; jsonArray_results.length(); i++){
  
          JSONObject jsonObject_i = jsonArray_results.getJSONObject(i);
  
          String iTitle = jsonObject_i.getString("title");
          String iContent = jsonObject_i.getString("content");
          String iUrl = jsonObject_i.getString("url");
  
          parsedResult += "&lt;a href='" + iUrl + "'&gt;" + iTitle + "&lt;/a&gt;&lt;br/&gt;";
          parsedResult += iContent + "&lt;br/&gt;&lt;br/&gt;";
      }
  
      return parsedResult;
  }
  </code></pre>
  
  <p>xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical" android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:id = "@+id/activitymain"
  &gt;
  
  
  
  
  &lt;RelativeLayout
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="horizontal"&gt;
      &lt;EditText
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:id = "@+id/txtSearch"/&gt;
      &lt;Button
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_below="@+id/txtSearch"
          android:text="Search"
          android:id="@+id/searchbtn" /&gt;
      &lt;Button
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_below="@+id/txtSearch"
          android:layout_toRightOf="@+id/searchbtn"
          android:layout_toEndOf="@+id/searchbtn"
          android:id="@+id/save"
          android:text="     Save     " /&gt;
  
      &lt;Button
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="Saved Searches"
          android:id="@+id/savedSearches"
          android:layout_alignTop="@+id/save"
          android:layout_toRightOf="@+id/save"
          android:layout_toEndOf="@+id/save" /&gt;
  &lt;/RelativeLayout&gt;
  
  
  
  &lt;ListView
      android:layout_width="match_parent"
      android:layout_height="174dp"
      android:id = "@android:id/list"
      android:background="#FF498CDE"&gt;
  
  &lt;/ListView&gt;
  
  &lt;WebView
      android:layout_width="match_parent"
      android:layout_height="202dp"
      android:id="@+id/webView"
      android:layout_gravity="center_horizontal" /&gt;
  </code></pre>
  
  <p></p>
  
  <p>Basically I want to run both api's when I click the search button.
  Please someone point me in the right direction, I'm completely new to this.
  Thanks</p>