nini29 Posted December 10, 2010 Share Posted December 10, 2010 Bonjour, Je souhaiterais lancer une mapactivity depuis une activity. Mais à chaque fois j'ai le message "forcer la fermeture" qui s'affiche. J'ai suivi le topic suivant mais mon erreur reste. voici mon manifest : <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.android.google.apis" android:versionCode="1" android:versionName="1.0"> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"></uses-permission> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission> <uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION"></uses-permission> <uses-permission android:name="android.permission.INTERNET"></uses-permission> <application android:icon="@drawable/icon" android:label="@string/app_name"> <uses-library android:name="com.google.android.maps" /> <activity android:name="com.example.android.google.apis.com.example.android.apis.principal" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> <uses-sdk android:minSdkVersion="3" /> </manifest> voici mon code principal : public class principal extends Activity implements OnClickListener{ /** Called when the activity is first created. */ ImageButton button1; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); button1 = (ImageButton) findViewById(R.id.button1); button1.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent intent = new Intent(principal.this, map.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); } }); Et enfin le xml : <?xml version="1.0" encoding="utf-8"?> <AbsoluteLayout android:orientation="vertical" android:id="@+id/widget0" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/fond" android:layout_marginTop="0px" android:layout_marginBottom="0px" xmlns:android="http://schemas.android.com/apk/res/android" > <ImageButton android:id="@+id/button1" android:layout_width="70px" android:layout_height="70px" android:scaleType="fitXY" android:background="@android:color/transparent" android:src="@drawable/logo1" android:layout_x="70px" android:layout_y="70px" > </ImageButton> </AbsoluteLayout> Sinon ma seconde class est définie ainsi : public class map extends MapActivity implements View.OnClickListener, LocationListener{ Merci d'avance de votre aide. Link to comment Share on other sites More sharing options...
Profete162 Posted December 10, 2010 Share Posted December 10, 2010 "forcer la fermeture" est toujours suivi de plein d'infos dans le logcat! Je te conseille vivement d'activer cet outil dans eclipse! Link to comment Share on other sites More sharing options...
nini29 Posted December 11, 2010 Author Share Posted December 11, 2010 Merci ça ma bien servi A mon manifest j'ai ajouté : <activity android:name="com.example.android.google.apis.com.example.android.apis.map" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> Du coup ça marche, mais j'ai deux "exécutable" sur mon téléphone un qui redirige vers le menue et l'autre comme un raccourcis vers la carte. Pour résoudre ce problème enlever <category android:name="android.intent.category.LAUNCHER" /> Si ça peut aider tant mieux Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.