이 코드를 사용하여 문제가 발생했지만이 오류를 해결하려고했지만 여전히 운이 없습니다. 나는 목록보기에서 항목을 내가 발견 된이 코드는 이제여러 활동을 클릭 할 때 클릭 가능
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
switch(position)
{
case 0: Intent newActivity = new Intent(this, superleague.class);
startActivity(newActivity);
break;
case 1: Intent newActivity = new Intent(this, youtube.class);
startActivity(newActivity);
break;
case 2: Intent newActivity = new Intent(this, olympiakos.class);
startActivity(newActivity);
break;
case 3: Intent newActivity = new Intent(this, karaiskaki.class);
startActivity(newActivity);
break;
case 4: Intent newActivity = new Intent(this, reservetickets.class);
startActivity(newActivity);
break;
}
}
내가 내 프로젝트에서이 배치 시간을 찾았을 클릭하고 어디에서 문제가 나는대로하지만 때 시작하는 새로운 활동을 부탁합니다 이것에 새로운 그것의 작은 것들을 해결하는 데 시간을내어 당신이 도울 수 있기를 바랍니다.
package com.mybasicapp;
import android.app.Dialog;
import android.app.ListActivity;
import android.content.DialogInterface;
import android.content.DialogInterface.OnCancelListener;
import android.content.DialogInterface.OnDismissListener;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ListView;
import android.widget.Toast;
public class menu extends ListActivity implements onListItemClickListner{
ImageButton ImagebuttonOpenDialog;
String KEY_TEXTPSS = "TEXTPSS";
static final int CUSTOM_DIALOG_ID = 0;
ListView dialog_ListView;
String[] listContent = {
"FORD", "BMW", "AUDI", "JAGUAR",
"MERCEDES", "RENAULT", "ROVER", "SAAB", "BENTLEY",
"VOLVO", "VAUXHALL", "SEAT"};
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ListView lv = getListView();
lv.setTextFilterEnabled(true);
lv.setOnListItemClickListener(new OnListItemClickListener() {
public void onListItemClick(AdapterView<?> parent, View view,
int position, long id) {
switch(position)
{
case 0: Intent newActivity = new Intent(this,
Pickmodel.class);
startActivity(newActivity);
break;
case 1: Intent newActivity = new Intent(this,
Pickmodel.class);
startActivity(newActivity);
break;
case 2: Intent newActivity = new Intent(this,
Pickmodel.class);
startActivity(newActivity);
break;
case 3: Intent newActivity = new Intent(this,
Pickmodel.class);
startActivity(newActivity);
break;
case 4: Intent newActivity = new Intent(this,
Pickmodel.class);
startActivity(newActivity);
break;
}
}
ImagebuttonOpenDialog = (ImageButton)findViewById(R.id.imgbtn1);
ImagebuttonOpenDialog.setOnClickListener(new Button.OnClickListener(){
public void onClick(View arg0) {
showDialog(CUSTOM_DIALOG_ID);
}});
}
@Override
protected Dialog onCreateDialog(int id) {
Dialog dialog = null;
switch(id) {
case CUSTOM_DIALOG_ID:
dialog = new Dialog(menu.this);
dialog.setContentView(R.layout.custom);
dialog.setTitle("Custom Dialog");
dialog.setCancelable(true);
dialog.setCanceledOnTouchOutside(true);
dialog.setOnCancelListener(new OnCancelListener(){
public void onCancel(DialogInterface dialog) {
// TODO Auto-generated method stub
Toast.makeText(menu.this,
"OnCancelListener",
Toast.LENGTH_LONG).show();
}});
dialog.setOnDismissListener(new OnDismissListener(){
public void onDismiss(DialogInterface dialog) {
// TODO Auto-generated method stub
Toast.makeText(menu.this,
"OnDismissListener",
Toast.LENGTH_LONG).show();
}});
//Prepare ListView in dialog
dialog_ListView = (ListView)dialog.findViewById(R.id.dialoglist);
ArrayAdapter<String> adapter
= new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, listContent);
dialog_ListView.setAdapter(adapter);
dialog_ListView.setOnItemClickListener(new OnItemClickListener(){
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
// TODO Auto-generated method stub
Toast.makeText(menu.this,
parent.getItemAtPosition(position).toString() + " clicked",
Toast.LENGTH_LONG).show();
dismissDialog(CUSTOM_DIALOG_ID);
}});
break;
}
return dialog;
}
@Override
protected void onPrepareDialog(int id, Dialog dialog, Bundle bundle) {
// TODO Auto-generated method stub
super.onPrepareDialog(id, dialog, bundle);
switch(id) {
case CUSTOM_DIALOG_ID:
//
break;
}
}
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
// TODO Auto-generated method stub
}
}
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
// TODO Auto-generated method stub
}
내가 PRINT 로그 CAT
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/customdialog"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="20dp"
android:minWidth="300dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/popcar" />
<ListView
android:id="@+id/dialoglist"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<ImageButton
android:id="@+id/imageButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/kj" />
</LinearLayout>
무엇이 문제입니까? Logcat은 프로젝트가 실행되지 않아도 무언가를 알려줍니다. 왜 이걸 달릴 수 없니? –
어떻게 logcat을 복사합니까? – coolcat
가지고 계신 오류가 무엇입니까? 이클립스가 당신에게주는 메시지는 무엇입니까? – Gustek