2013-03-27 7 views
0

기본적으로 내 응용 프로그램에서 화면에 내 토스트를 표시 할 수 없다. 다른 응용 프로그램에 토스트 코드를 복사했는데 코드가 제대로 작동한다. 어떤 이유로 작동하지 않을 수있다. 이 하나. 내 응용 프로그램을 다시 스플래시 화면으로 옮겨서 아무것도 할 수 없지만 onCreate 메서드에서 토스트를 호출하지만 여전히 아무것도 호출하지 않았습니다. 나는 내가 생각할 수있는 모든 것을 시도했다. 누군가가 저에게 뭐가 잘못 됐는지 말해 주시겠습니까? 어떤 도움이라도 대단히 감사합니다. 사람에게 유용토스트가 왜 작동하지 않습니까?

public class Splash extends Activity{ 

    @Override 
    public void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.splash_layout); 
     setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); 

     Toast t1 = Toast.makeText(this, "hello world", Toast.LENGTH_LONG); 
     t1.show(); 

    }//end onCreate  
} // end splash 

매니페스트는 경우에 아래에 기재되어 있습니다, 여분의 활동은 주 메뉴에서 시작하지만 시도하고 그것을 간단하게하기 위해 시작 acitivity에서 메인 메뉴를 시작하는 의도를 잘라 필자된다 와 무슨 잘못

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="com.example.bluetoothdms" 
    android:versionCode="1" 
     android:versionName="1.0" > 

<uses-sdk 
    android:minSdkVersion="11" 
    android:targetSdkVersion="17" /> 

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> 

<application 
    android:allowBackup="true" 
    android:icon="@drawable/ic_launcher" 
    android:label="@string/app_name" 
    android:theme="@style/AppTheme" 
    android:largeHeap="true"> 
    <activity 
     android:name="com.example.bluetoothdms.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="com.example.bluetoothdms.MainMenu" 
     android:label="@string/app_name" > 
    </activity> 
    <activity 
     android:name="com.example.bluetoothdms.Bluetooth_Content" 
     android:label="@string/app_name" > 
    </activity> 
    <activity 
     android:name="com.example.bluetoothdms.DMS_Content" 
     android:label="@string/app_name" > 
    </activity> 
    <activity 
     android:name="com.example.bluetoothdms.FAQ" 
     android:label="@string/app_name" > 
    </activity> 
    <activity 
     android:name="com.example.bluetoothdms.File_Opener"> 
    </activity> 
</application> 

+10

브로큰 토스터? –

+0

아직 앱/프래그먼트 라이프 사이클의 가시 단계에 있지 않기 때문에'onCreate' 내에서 축하를 할 수 있습니까? – TronicZomB

+1

예, 당신은 할 수 ... –

답변

0

인스턴스화 Toast을 파악하는

Toast t1 = new Toast(context); 
t1.makeText(....); 
t1.show() 

또는 사용

Toast.makeText(...).show(); 
+0

당신이 이미 묘사 한 두 가지 방법을 시도했지만, ive는 모든 것을 시도했습니다. – user2052283

관련 문제