Vorrei visualizzare una schermata splash, perņ non parte proprio l' applicazione!!!
E poi questa parte....l' ho inserita nel layout_main.xmlcodice:package dario.retografo.geolocalizzato; import android.app.Activity; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.view.View; import android.widget.ImageView; public class MainActivity extends Activity { private static final int STOPSPLASH = 0; //time in milliseconds private static final long SPLASHTIME = 3000; private ImageView splash; //handler for splash screen private Handler splashHandler = new Handler() { /* (non-Javadoc) @see android.os.Handler#handleMessage(android.os.Message) */ @Override public void handleMessage(Message msg) { switch (msg.what) { case STOPSPLASH: //remove SplashScreen from view splash.setVisibility(View.GONE); break; } super.handleMessage(msg); } }; /** Called when the activity is first created. */ @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.activity_main); splash = (ImageView) findViewById(R.id.splashscreen); Message msg = new Message(); msg.what = STOPSPLASH; splashHandler.sendMessageDelayed(msg, SPLASHTIME); } }
Il manifest:codice:<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <ImageView android:id="@+id/splashscreen" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/retografo" android:layout_gravity="center"/> </LinearLayout>
codice:<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="dario.retografo.geolocalizzato" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="15" /> <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:name=".MainActivity" android:label="@string/title_activity_main" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest>

LinkBack URL
About LinkBacks
Rispondi quotando
Ultima modifica di maurilios; 27-08-12 alle 