1

私はJdeveloper 11.1.2.4.0を使用してスプラッシュスクリーンを作成しています.. http://www.androidaspect.com/2012/12/android-splash-screen-tutorial.htmlに記載されている各手順に従いました

しかし、それでも問題を解決できません。

これが私のsplash.javaです(メインアクティビティ)

package mobile;

import android.app.Activity;

import android.content.Intent;

import android.os.Bundle;

import android.view.Window;


public class Splash extends Activity {
     private long ms=0;
     private long splashTime=2000;
     private boolean splashActive = true;
     private boolean paused=false;

    /**
     * @param savedInstanceState
     */

     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);

        //Hides the titlebar
         this.requestWindowFeature(Window.FEATURE_NO_TITLE);

         setContentView(R.layout.Splash);

        Thread mythread = new Thread() {
             public void run() {
                 try {
                     while (splashActive && ms < splashTime) {
                         if(!paused)
                             ms=ms+100;
                         sleep(100);
                     }
                 } catch(Exception e) {}
                 finally {
                    Intent intent;
                    intent = new Intent(Splash.this, Home.class);
                    startActivity(intent);
                 }
             }
         };
         mythread.start();
     }
 }

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.company.splash_screen">
  <uses-sdk/>

  <application android:icon="@drawable/adfmf_icon"
    android:label="@string/app_name" android:name="oracle.adfmf.Application">
    <activity android:screenOrientation="fullSensor" android:name=".Splash"      android:noHistory="true" android:label="@string/app_name" android:theme="@android:style/Theme.NoTitleBar"
              android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|screenLayout|fontScale|uiMode|orientation" android:windowSoftInputMode="adjustPan" >
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
       <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
    </activity>


        <activity
             android:name=".Home"
             android:label="@string/title_activity_home" >
         </activity>


    <activity android:name="oracle.adfmf.AMXActivity" android:theme="@android:style/Theme.NoTitleBar" android:windowSoftInputMode="adjustPan"></activity>
    <activity android:name="oracle.adfmf.RemoteURLActivity" android:theme="@android:style/Theme.NoTitleBar" android:windowSoftInputMode="adjustPan"></activity>
    <activity android:name="oracle.adfmf.LocalHTMLActivity" android:theme="@android:style/Theme.NoTitleBar" android:windowSoftInputMode="adjustPan"></activity>
    <activity android:name="oracle.adfmf.phonegap.AdfSpringboardPhoneGapActivity" android:theme="@android:style/Theme.NoTitleBar" android:windowSoftInputMode="adjustPan"></activity>
    <activity android:name="oracle.adfmf.SettingsActivity" android:theme="@android:style/Theme.NoTitleBar" android:windowSoftInputMode="adjustPan"></activity>
    <activity android:name="oracle.adfmf.navbar.MoreTabActivity" android:theme="@android:style/Theme.NoTitleBar" android:windowSoftInputMode="adjustPan"></activity> 
    <activity android:name="oracle.adfmf.BlankActivity" android:theme="@android:style/Theme.NoTitleBar" android:windowSoftInputMode="adjustPan"></activity>
    <receiver android:name="com.google.android.gcm.GCMBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND" >
      <intent-filter>
        <action android:name="com.google.android.c2dm.intent.RECEIVE" />
        <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
        <category android:name="com.company.splash_screen" />
      </intent-filter>
    </receiver>
    <service android:name=".GCMIntentService" />
  </application>

  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
  <uses-permission android:name="android.permission.CAMERA" />
  <uses-permission android:name="android.permission.VIBRATE" />
  <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
  <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
  <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
  <uses-permission android:name="android.permission.READ_PHONE_STATE" />
  <uses-permission android:name="android.permission.INTERNET" />
  <uses-permission android:name="android.permission.RECEIVE_SMS" />
  <uses-permission android:name="android.permission.RECORD_AUDIO" />
  <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
  <uses-permission android:name="android.permission.READ_CONTACTS" />
  <uses-permission android:name="android.permission.WRITE_CONTACTS" />   
  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />   
  <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
  <uses-permission android:name="android.permission.GET_ACCOUNTS" />
  <permission android:name="com.company.splash_screen.permission.C2D_MESSAGE" android:protectionLevel="signature" />
  <uses-permission android:name="com.company.splash_screen.permission.C2D_MESSAGE" />
  <!-- App receives GCM messages. -->
  <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
  <!-- GCM connects to Google Services. -->
  <uses-permission android:name="android.permission.INTERNET" /> 
  <!-- GCM requires a Google account. -->
  <uses-permission android:name="android.permission.GET_ACCOUNTS" />
  <!-- Keeps the processor from sleeping when a message is received. -->
  <uses-permission android:name="android.permission.WAKE_LOCK" /> 

</manifest>

res/layout/ フォルダーに、splash.xml があります。

<?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="fill_parent"
     android:layout_height="fill_parent"
     android:orientation="vertical" >

    <ImageView
         android:id="@+id/image"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:src="@drawable/background" />

    <ProgressBar
         android:id="@+id/progressBar1"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_below="@id/image"
         android:layout_gravity="center_horizontal" >
     </ProgressBar>

</LinearLayout> 

および home.xml (2 番目のアクティビティ)

<?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:orientation="vertical" >

    <TextView
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_gravity="center"
         android:layout_marginTop="20dip"
         android:text="HomeScreen"
         android:textAppearance="?android:attr/textAppearanceLarge" />

</LinearLayout>

両方の .java ファイル (splash.java & home.java) で setContentView(R.layout.Splash); にエラーが表示されます。および setContentView(R.layout.Home); 応答...

4

2 に答える 2