버튼이 보여지기는 하는데, 왜 클릭을 하면 position1로 넘어가질 않을까요ㅠㅠ.

아무리해도 모르겠어요ㅠㅠ

 

search_res.java

 

package com.cproject;

import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;

import net.htmlparser.jericho.Element;
import net.htmlparser.jericho.HTMLElementName;
import net.htmlparser.jericho.Source;

import android.app.Activity;
import android.os.Bundle;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.TextView;
import android.content.Context;
import android.content.Intent;
import android.widget.*;

public class search_res extends Activity{
 
 ArrayList<HashMap<String, String>> data;
 ListView list;
 TextView title, writer, company, position; 


 @Override
 public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  
  Intent i = getIntent();
  
  String search = i.getExtras().getString("search").toString();
  TextView kwd = (TextView) findViewById(R.id.search);
  setContentView(R.layout.search_list1);
  
  if(search.length()<1)
  {
   Toast.makeText(getApplicationContext(), "도서명, 저자 또는 출판사를 입력해주세요.", Toast.LENGTH_SHORT).show();
   
  }else{
   
   
   data = new ArrayList<HashMap<String, String>>();
   try {
    builPostList(search);
   } catch (MalformedURLException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
   } catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
   }
   

   list = (ListView) findViewById(R.id.listView1);
   
   SimpleAdapter sa = new SimpleAdapter(this, data, R.layout.search_list2, new String[] {"title", "writer", "company", "position"}, new int[]{R.id.title, R.id.writer, R.id.company, R.id.position});
   
   list.setAdapter(sa);
      
  }
     
 }
 
 private void builPostList(String search) throws MalformedURLException, IOException
 {
  String surl = "http://library.skhu.ac.kr/DLiWeb20/components/searchir/result.aspx?m_var=421&srv_id=31&qy_frm=QUICK&adf=&adt=&cl_id=ALL&rid_all=&st_f=&st_o=&pg=1&rpp=20&mc=300&dp_op=LIST&t_path=&qy_typ=KEYWORD&brch=ALL&qy_idx=TITL&qy_kwd="
    + URLEncoder.encode(search, "UTF-8");
  String nurl = null;

  try{
   //nurl = URLEncoder.encode(surl, "UTF-8");
   
   //URL url  = new URL("nurl);
   URL url  = new URL("surl);
   
   data.clear();
   
   InputStream html = url.openStream();
   Source source = new Source(new InputStreamReader(html,"UTF-8"));
   
   source.fullSequentialParse();
   
   Element table = (Element) source.getAllElements(HTMLElementName.TABLE).get(28);
   
   List<Element> trtag = table.getAllElements(HTMLElementName.TR);
   
   for(int i=1; i<trtag.size(); i+=2)
   {
    
    Element tr = (Element) trtag.get(i);
    
     if (tr.getAllElements(HTMLElementName.TD).size() < 2)
     continue;
    
    Element td = (Element) tr.getAllElements(HTMLElementName.TD).get(1);
    
    List<Element> sp = td.getAllElements(HTMLElementName.SPAN);
    
    HashMap<String, String> hm = new HashMap<String, String>();
    
    for(Iterator it = sp.iterator(); it.hasNext();)
    {
     Element le = (Element) it.next();
     
     String c = le.getAttributeValue("class");
     String t = le.getAttributeValue("title");
     String v = le.getContent().toString();//le.getAttributeValue("value");     
     if(v == null)
     {
      continue;
     }
     
     /*
     if(c.equals("result_title"))
     {
      String value = le.getAttributeValue("value").toString();
      hm.put("title", value);
      
      data.add(hm);
     }
     if(c != null && c.equals("result_title"))
     {
      String value = le.getContent().toString();//le.getAttributeValue("value").toString();
      TextView tv = new TextView(this);
      tv.setText(Html.fromHtml(value));
      hm.put("title", "도서명 : " + tv.getText().toString());
      }
     if (t == null)
      continue;
     if(t.equals("저자"))
     {
      String value = le.getContent().toString();//le.getAttributeValue("value").toString();
      hm.put("writer", "저자 : "  + value);
      
      //data.add(hm);
     }
     if(t.equals("출판사"))
     {
      String value = le.getContent().toString();//le.getAttributeValue("value").toString();
      hm.put("company", "출판사 : " + value);
      
      //data.add(hm);
     }

     if (tr.getAllElements(HTMLElementName.A).size() < 3)
      continue;
     Element po = (Element) td.getAllElements(HTMLElementName.A).get(2);
     
     hm.put("position",(po.getContent().toString()));
          
     View innerView = getLayoutInflater().inflate(R.layout.search_list2, null);
     Button psearch = (Button)innerView.findViewById(R.id.bt1);
     
     psearch.setOnClickListener(new OnClickListener(){
      
      public void onClick(View v){
       
       Intent i2 = new Intent(search_res.this, position1.class);
             startActivity(i2);
      }
     });
     
    }
    data.add(hm); 
    
   }
      
  }catch(UnsupportedEncodingException e){
   e.printStackTrace();
  }
 }
}

 

-----------------------------------------------------------------------------------------------------------

 

search_list2.xml

 

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:background="#00000000"
    android:gravity="center_vertical|center_horizontal">
   
<RelativeLayout
    android:id="@+id/relative"
    android:layout_height="wrap_content"
    android:layout_marginLeft="20dp"
    android:layout_marginRight="20dp"
    android:layout_marginBottom="7dp"
    android:layout_width="fill_parent">
   
    <TextView
        android:id="@+id/title"
        android:layout_margin="7dp"
        android:layout_gravity="center_horizontal"
        android:layout_alignParentTop="true"
        android:layout_alignParentLeft="true"
        android:text="도서명"
        android:layout_height="wrap_content"
        android:textColor="#FF000000"
       
       
       android:layout_width="fill_parent" android:textSize="13sp"/>
   
    <TextView
        android:id="@+id/writer"
        android:layout_margin="7dp"
        android:layout_gravity="center_horizontal"
        android:layout_alignParentLeft="true"
        android:text="저자"
        android:layout_height="wrap_content"
        android:layout_below="@+id/title"
        android:textColor="#FF000000" android:layout_width="fill_parent" android:textSize="13sp"/>
   
    <TextView
        android:id="@+id/company"
        android:layout_margin="7dp"
        android:layout_gravity="center_horizontal"
        android:layout_alignParentLeft="true"
        android:text="출판사"
        android:layout_height="wrap_content"
        android:layout_below="@+id/writer"
        android:textColor="#FF000000" android:layout_width="fill_parent" android:textSize="13sp"/>
  
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/tb"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_gravity="center_horizontal"
        android:orientation="vertical" >
       
    <TableRow
        android:id="@+id/tb1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:paddingTop="110dp"       
        android:orientation="horizontal" >
           
    <TextView
        android:id="@+id/position"
        android:layout_marginLeft="6dp"
        android:layout_gravity="center_horizontal"
        android:layout_alignParentLeft="true"
        android:text="소장위치"
        android:layout_height="wrap_content"
        android:layout_below="@+id/company"
        android:textColor="#FF000000" android:layout_width="fill_parent" android:textSize="13sp"/>
   
      <Button
        android:id="@+id/bt1"
        android:layout_width="wrap_content"
        android:layout_height="30dp"
        android:layout_gravity="center_horizontal"
        android:text="위치보기"/>
     
    </TableRow>
    </TableLayout>


</RelativeLayout>   
</LinearLayout>