Problème affichage 2ème activité
Bonjour à tous,
Je débute en Android (java,SQL,XML compris) donc pour me faire la main, je me développe une petite appli depuis une semaine.
Hors après moult péripétie j'arrive à faire ce lancer toutes les activités que je souhaite mais hélas malgré des fichiers XML bien remplis, pas moyen de les voir sur mon téléphone
Et pas moyen de trouver l'origine de l'erreur. Quelqu'un voit où j'ai cafouillé pour que l'affichage de mes activité ne ce lance pas ?
Le activity_main.xml
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
| <?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<Button
android:id="@+id/buttonrecette"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="top"
android:layout_weight="20"
android:text="@string/recette"
android:onClick="pagerectte"
android:textSize="40sp"
android:background="@drawable/frigtop"/>
<Button
android:id="@+id/buttonfrigo"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:layout_weight="20"
android:text="@string/frigo"
android:onClick="pagefrigo"
android:textSize="40sp"
android:background="@drawable/frig"
/>
<Button
android:id="@+id/buttonBDD"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="bottom"
android:layout_weight="20"
android:text="@string/basededonnee"
android:onClick="pagebdd"
android:textSize="40sp"
android:background="@drawable/frigbottom"/>
</LinearLayout> |
le Mainactivity.java
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| package com.example.cryingfrigo;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void pagerectte(View view) {
startActivity(new Intent(this, recettepage.class)); /* Réagir au clic */
}
public void pagefrigo(View view) {
startActivity(new Intent(this, frigo.class)); /* Réagir au clic */
}
public void pagebdd(View v) {
startActivity(new Intent(this, bddpage.class)); /* Réagir au clic */
}
} |
l'une des pages qui ne s'affiche pas : bddpage.xml
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
| <?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/frigbottom">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
app:layout_constraintTop_toTopOf="parent">
<LinearLayout
android:id="@+id/layrecherche"
android:layout_width="match_parent"
android:layout_height="40dp"
android:orientation="horizontal">
<AutoCompleteTextView
android:id="@+id/Recherche"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:hint="@string/nomrecherche" />
<SearchView
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/layrecherche">
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="70dp"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_gravity="end|right"
android:layout_marginEnd="20dp"
android:orientation="vertical">
<android.support.design.widget.FloatingActionButton
android:id="@+id/buttonajout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
app:srcCompat="@android:drawable/ic_menu_add" />
</LinearLayout>
</RelativeLayout>
</android.support.constraint.ConstraintLayout> |
bddpage.java
Code:
1 2 3 4 5 6 7 8 9 10 11
| package com.example.cryingfrigo;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class bddpage extends AppCompatActivity{
protected void onCreated(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.bddpage);
}
} |
le AndroidManifest.xml
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.cryingfrigo">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".recettepage"
android:label="recettepage"
android:parentActivityName=".MainActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".MainActivity"/>
</activity>
<activity android:name=".frigo"
android:label="frigo"
android:parentActivityName=".MainActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".MainActivity"/>
</activity>
<activity android:name=".bddpage"
android:label="bddpage"
android:parentActivityName=".MainActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".MainActivity"/>
</activity>
</application>
</manifest> |
le fichier string.xml
Code:
1 2 3 4 5 6 7
| <resources>
<string name="app_name">cryingfrigo</string>
<string name="frigo">Frigo</string>
<string name="recette">Recette</string>
<string name="basededonnee">Base de donnée</string>
<string name="nomrecherche">Recherche</string>
</resources> |