난 항상 안드로이드를 배우려고 노력하고있어 나는 http://developer.android.com/resources/tutorials/views/hello-tabwidget.html에 설명 된 모든 단계를 따라 이클립스왜 충돌이 발생합니까? 어떻게 디버그합니까?
를 사용하고 있지만, 때 실제로 (내 LG 혁명에 코드를 실행 이제 과거 엑스 코드를 사용했습니다 Froyo 2.2.1), 나는 부서지고있다.
디버깅하는 방법을 모르겠지만 왜 이것이 충돌할지 모릅니다. 어떤 도움을 주시면 감사하겠습니다.
나는 (내가 만든 유일한 변경 먹으 렴하지만 난 그게 충돌한다고 생각하지 않습니다) 3 개 탭에 대해 동일한 이미지를 사용 여기 내 매니페스트 파일입니다 여기에 내 코드package com.oneorangetree.shit;
import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.TabHost;
public class HelloTabWidgetActivity extends TabActivity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// Resource object to get drawable
Resources res = getResources();
TabHost tabHost = getTabHost();
TabHost.TabSpec spec;
Intent intent;
intent = new Intent().setClass(this, ArtistsActivity.class);
spec = tabHost.newTabSpec("artists").setIndicator("Artists", res.getDrawable(R.drawable.ic_tab_artists)).setContent(intent);
tabHost.addTab(spec);
intent = new Intent().setClass(this, AlbumsActivity.class);
spec = tabHost.newTabSpec("albums").setIndicator("Albums", res.getDrawable(R.drawable.ic_tab_artists)).setContent(intent);
tabHost.addTab(spec);
intent = new Intent().setClass(this, SongsActivity.class);
spec = tabHost.newTabSpec("songs").setIndicator("Songs", res.getDrawable(R.drawable.ic_tab_artists)).setContent(intent);
tabHost.addTab(spec);
tabHost.setCurrentTab(2);
}
}
입니다
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.oneorangetree.shit"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8" />
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".HelloTabWidgetActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
난 당신이 몇 가지를 게시 할 때까지 아무런 답변을 얻을 것이라는 점을 보장 할 수 암호. – Peaches491
충돌을 찾는 가장 좋은 방법은 LogCat을 점검하는 것입니다. 기본적으로 안드로이드 시스템 로그입니다. 'SDK/tools' 폴더의 ddms 응용 프로그램이나'Window-> Add view-> other-> LogCat'을 통해 이클립스에서 찾을 수 있습니다. 거기에 예외가 있어야합니다 (AndroidRuntime 태그가 빨간색으로 표시됨). 당신이 그것을 가지고 게시 후 코드의 적절한 조각을 추가하십시오. –
내 질문에 대한 답변이 대답을 http://stackoverflow.com/questions/2209406/issues-with-android-tabhost-example – KevinDTimm