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>
당신이 URL에서 데이터를 가져 오는에 대한 스레드를 사용해야해야합니다. –
당신은 logcat 오류를 게시 할 수 있습니까? –
Munish, 첫 번째 활동의 listview 항목 행을 사용하여 다른 활동을 호출하려면이 활동을 별도로 수행 할 수 있습니다.이 문제가 발생하면 간단히 모든 모듈을 만들었습니다. 하나의 프로젝트, 문제를 직면하지 문제를 직면하지 또한 URL 데이터로 구성된 다른 활동을 호출 – Sam