Commit 4acd6f2a authored by Timothé KOBAK's avatar Timothé KOBAK

premiere page mais crash

parent 4e06a022
Pipeline #2721 canceled with stages
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings"> <component name="GradleSettings">
<option name="linkedExternalProjectsSettings"> <option name="linkedExternalProjectsSettings">
<GradleProjectSettings> <GradleProjectSettings>
......
<?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" /> <component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"> xmlns:tools="http://schemas.android.com/tools" >
<application <application
android:allowBackup="true" android:allowBackup="true"
...@@ -11,10 +11,16 @@ ...@@ -11,10 +11,16 @@
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/Theme.LeBonCoin" android:theme="@style/Theme.LeBonCoin"
tools:targetApi="31"> tools:targetApi="31" >
<activity
android:name=".galerie"
android:exported="false" />
<activity
android:name=".ajout"
android:exported="false" />
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
android:exported="true"> android:exported="true" >
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
......
package com.example.leboncoin package com.example.leboncoin
import androidx.appcompat.app.AppCompatActivity import android.content.Intent
import android.os.Bundle import android.os.Bundle
import android.widget.Button
import android.widget.EditText
import android.widget.LinearLayout
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
class MainActivity : AppCompatActivity() { class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) { public override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main) val l1 = LinearLayout(this)
l1.orientation = LinearLayout.VERTICAL
val t1 = TextView(this)
t1.text = "Bienvenue sur LeBonCoin!"
l1.addView(t1)
val t = EditText(this)
val b = Button(this)
b.text = "Acceder à la galerie"
b.height = 200
b.setOnClickListener {
val lancementSecondeActivite = Intent(
this@MainActivity,
galerie::class.java
)
startActivity(lancementSecondeActivite)
}
val c = Button(this)
c.text = "Ajouter un truc"
c.height = 200
c.setOnClickListener {
val lancementTroisiemeActivite = Intent(
this@MainActivity,
ajout::class.java
)
startActivity(lancementTroisiemeActivite)
}
l1.addView(t)
l1.addView(b)
l1.addView(c)
setContentView(l1)
} }
} }
\ No newline at end of file
package com.example.leboncoin
import android.hardware.Sensor
import android.hardware.SensorManager
import android.os.Bundle
import android.widget.LinearLayout
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
class ajout : AppCompatActivity() {
public override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val l1 = LinearLayout(this)
l1.orientation = LinearLayout.VERTICAL
val t1 = TextView(this)
t1.text = "Bienvenue sur LeBonCoin!"
l1.addView(t1)
setContentView(l1)
}
}
package com.example.leboncoin
import android.os.Bundle
import android.app.Activity
import android.hardware.Sensor
import android.hardware.SensorEvent
import android.hardware.SensorEventListener
import android.hardware.SensorManager
import android.util.Log
import android.widget.EditText
import android.widget.LinearLayout
class galerie : Activity(), SensorEventListener {
private var mSensorManager: SensorManager? = null
private var accelerometer: Sensor? = null
private var V: EditText? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val M1 = LinearLayout(this)
M1.orientation = LinearLayout.VERTICAL
V = EditText(this)
val C = EditText(this)
V!!.setText(" ")
C.setText("VITESSE")
M1.addView(C)
M1.addView(V)
setContentView(M1)
mSensorManager = getSystemService(SENSOR_SERVICE) as SensorManager
// on recupere l accelerometre a partir du SensorManager
accelerometer = mSensorManager!!.getDefaultSensor(Sensor.TYPE_ACCELEROMETER)
// on associe l ecouteur d’ evenements au SensorManager
mSensorManager!!.registerListener(this, accelerometer, SensorManager.SENSOR_DELAY_NORMAL)
}
override fun onAccuracyChanged(
sensor: Sensor,
accuracy: Int
) { // TODO Auto−generated method stub
}
override fun onSensorChanged(event: SensorEvent) { // TODO Auto−generated method stub
val gammaX = event.values[0]
val gammaY = event.values[1]
val gammaZ = event.values[2]
Log.d("Valeurs accelerometre", "$gammaX,$gammaY,$gammaZ")
V!!.setText(gammaX.toString())
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.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=".ajout1">
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.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=".test">
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment