2012-10-15 3 views
0

listview에서 url을 사용하여 xml에서 데이터를 가져 오는 응용 프로그램을 만들고 있습니다. 예를 들어 listview 항목 행을 사용하여 다른 활동을 호출하려고합니다. - 사용자가 첫 번째 listview를 클릭하면 행을 누른 다음 item.class를 호출해야합니다. 실제로 다음 활동에서 웹 URL을 사용하지 않으면 다른 활동을 호출 할 수 있지만, XML 파서를 사용하여 url에서 데이터를 가져 오는 활동을 호출하려는 경우에는 이 오류는 : - 불행히도 애플 리케이션이 중지되었습니다, 왜, 제발 누군가가 말해 줄 수있는이 문제를 해결할 수 있습니까?listview 항목 행을 사용하여 다른 활동을 호출하는 방법

First.java :

list.setOnItemClickListener(new OnItemClickListener() { 
public void onItemClick(AdapterView<?> parent, View view, 
       int position, long id) 
{ 
    if(position==0) 
    { 
      Intent in = new Intent(First.this, Item.class); 
     startActivity(in); 
    } 
} 

Item.java :

public class Item extends Activity { 
// All static variables 
static final String URL = "http://***.net/android/item.xml"; 
// XML node keys 
static final String KEY_NODE = "pick"; // parent node 
static final String KEY_TITLE = "title"; 
static final String KEY_DESC = "description"; 
    } 

Manifest.xml :

 <activity 
     android:name=".First" 
     android:label="@string/app_name" > 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 
      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
    </activity> 
    <activity android:name="Item"></activity> 
+0

당신이 URL에서 데이터를 가져 오는에 대한 스레드를 사용해야해야합니다. –

+2

당신은 logcat 오류를 게시 할 수 있습니까? –

+0

Munish, 첫 번째 활동의 listview 항목 행을 사용하여 다른 활동을 호출하려면이 활동을 별도로 수행 할 수 있습니다.이 문제가 발생하면 간단히 모든 모듈을 만들었습니다. 하나의 프로젝트, 문제를 직면하지 문제를 직면하지 또한 URL 데이터로 구성된 다른 활동을 호출 – Sam

답변

0

여기 생각 오류는 다음과 같습니다 <activity android:name="Item"></activity>

<activity android:name=".Item"></activity> 
+0

예 이것이 맞을 수도 있습니다 –

+0

나는 listview 행에서 직접 데이터 URL을 호출하기 전에이 코드를 사용하여 다음과 같은 간단한 활동을 호출했기 때문에 동의하지 않습니다. 일부 textviews 및 imageview에서 다음 활동을 호출하고 볼 수있었습니다. ..help – Sam

+0

다음 디버그를 얻는다면 : -ActivityThread.performLaunchActivity (ActivityThread $ Activ ityClientRecord, Intent) 행 : 2059 \t 소스를 찾을 수 없음 – Sam

관련 문제