0
버튼을 좋아하는 페이지에서 목록보기를 만들려고하지만 응용 프로그램을 디버깅 할 때 이름이있는 검은 색 페이지 만 표시됩니다. 나는 메인 페이지 한 mainfest.xml 드 2 자바 한 XML이ListView가 작동하지 않습니다.
페이지 1 :
package tm.andrioid.com;
import android.app.Activity;
import android.app.Dialog;
import android.app.ListActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.View;
import android.widget.Button;
import android.app.Activity;
import android.os.Bundle;
import android.content.Intent;
import android.widget.Button;
public class indexActivity extends Activity
{
public void onCreate(Bundle icicle)
{
super.onCreate(icicle);
setContentView(R.layout.main);
Button bprodukter = (Button) findViewById(R.id.bprodukter);
bprodukter.setOnClickListener(new View.OnClickListener() {
public void onClick(View arg0) {
Intent i = new Intent(indexActivity.this, produkter.class);
startActivity(i);
}
});
}``
}
페이지 2 자바 :
tm.andrioid.com;
import android.app.Activity;
import android.app.Dialog;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.app.Activity;
import android.os.Bundle;
import android.widget.Button;
public class produkter extends ListActivity {
String classes[] = { "indexActivity", "Data", "Intim", "Hörlurar", "Prylar",
"Mat", "Sex", "Sju"};
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setListAdapter(new ArrayAdapter<String>(produkter.this,
android.R.layout.simple_list_item_1));
}
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
// TODO Auto-generated method stub
super.onListItemClick(l, v, position, id);
String saker = classes[position];
try{
Class ourClass = Class.forName("tm.android.com." + saker);
Intent ourIntent = new Intent(produkter.this, ourClass);
startActivity(ourIntent);
}catch(ClassNotFoundException e){
e.printStackTrace();
}
}
}
주요 XML :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="tm.andrioid.com"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="15" />
<application
android:icon="@drawable/tmm"
android:label="@string/app_name" >
<activity
android:name=".splash"
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=".indexActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="tm.android.com.INDEXACTIVITY" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".produkter"
android:label="@string/app_name" >
<intent-filter>
<action android:name="tm.android.com.PRODUKTER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
예, 내 목록보기를 볼 수는 있지만 설정할 수있는 indexActivity를 클릭 할 수 없습니다. 너 왜 그랬는지 알아? 모든 도움을 주셔서 감사합니다 – Emil
어떤 ClassNotFoundException을 받고 있습니까? –
아니, 아니야. 나는 그것을 어디에서 발견해야합니까? 디버깅 중입니까? – Emil