Bonjour,
j'ai mon application qui crash à chaque fois que j'ouvre le phone dialer.
CODE XML
Code XML : Sélectionner tout - Visualiser dans une fenêtre à part
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150 <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/main_content" android:fitsSystemWindows="true" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" > <FrameLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/main_frame" > </FrameLayout> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Appel Maintenant" android:layout_gravity="bottom|left" android:id="@+id/button_appel"/> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Chat avec agent" android:layout_gravity="bottom|right" android:id="@+id/button_product_chat"/> <android.support.design.widget.AppBarLayout android:layout_width="match_parent" android:layout_height="256dp" android:fitsSystemWindows="true"> <android.support.design.widget.CollapsingToolbarLayout android:id="@+id/collapse_toolbar" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_scrollFlags="scroll|exitUntilCollapsed" android:fitsSystemWindows="true"> <ImageView android:layout_width="match_parent" android:layout_height="match_parent" android:scaleType="centerCrop" android:id="@+id/imageView4" android:fitsSystemWindows="true" app:layout_collapseMode="pin"/> <android.support.v7.widget.Toolbar android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:id="@+id/Mytolbar" app:layout_collapseMode="parallax"/> <ImageButton android:id="@+id/imageButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="15dp" android:layout_marginTop="500dp" android:layout_gravity="bottom|end" app:srcCompat="@drawable/ic_camera_alt_black_24dp" /> </android.support.design.widget.CollapsingToolbarLayout> </android.support.design.widget.AppBarLayout> <android.support.v4.widget.NestedScrollView android:layout_gravity="fill_vertical" app:layout_behavior="@string/appbar_scrolling_view_behavior" android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:id="@+id/product_page" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:paddingTop="24dp"> <TextView android:id="@+id/product_content_title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/imageView4" android:layout_marginLeft="10dp" android:layout_marginTop="5dp" android:text="Canada" android:textColor="#000" android:textSize="22dp" android:textStyle="bold" /> <TextView android:id="@+id/product_content_descri" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/product_content_title" android:layout_marginLeft="10dp" android:layout_marginTop="5dp" android:text="Congo"/> <TextView android:id="@+id/product_price" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/product_content_title" android:layout_marginLeft="10dp" android:layout_marginTop="5dp" android:text="Congo"/> <TextView android:id="@+id/product_nombreview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/product_content_title" android:layout_marginLeft="10dp" android:layout_marginTop="5dp" android:text="Congo"/> <TextView android:id="@+id/product_date" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/product_content_title" android:layout_marginLeft="10dp" android:layout_marginTop="5dp" android:text="Congo"/> </LinearLayout> </android.support.v4.widget.NestedScrollView> </android.support.design.widget.CoordinatorLayout>
Pouvez-vous m'aider à résoudre ce problème, le Logcat ne me montre pas où est l'erreur
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99 package com.example.programmer.bmarketversion3; import android.Manifest; import android.content.Intent; import android.content.pm.PackageManager; import android.net.Uri; import android.support.annotation.NonNull; import android.support.design.widget.BottomNavigationView; import android.support.v4.app.ActivityCompat; import android.support.v4.app.Fragment; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.FrameLayout; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.TextView; public class Product_content2 extends AppCompatActivity { ImageView imageView; TextView txt_titre,txt_description,txt_prix,txt_view,txt_date; ImageButton imageButton; Button button; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_product_content2); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true); imageButton = (ImageButton)findViewById(R.id.imageButton); imageView= (ImageView)findViewById(R.id.imageView4); txt_titre = (TextView)findViewById(R.id.product_content_title); txt_description = (TextView)findViewById(R.id.product_content_descri); txt_prix = (TextView)findViewById(R.id.product_price); txt_view = (TextView)findViewById(R.id.product_nombreview); txt_date = (TextView)findViewById(R.id.product_date); imageView.setImageResource(getIntent().getIntExtra("image_id",00)); txt_titre.setText("Titre : "+getIntent().getStringExtra("titre")); txt_description.setText("Description : "+getIntent().getStringExtra("description")); txt_prix.setText("Prix : "+getIntent().getStringExtra("prix")); txt_view.setText("Nombre de Vue : "+getIntent().getStringExtra("vue")); txt_date.setText("Date Postee : "+getIntent().getStringExtra("date")); //Button devrant ouvrir le call dialer button = (Button)findViewById(R.id.button_appel); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(Intent.ACTION_DIAL); intent.setData(Uri.parse("tel " + "0123456789")); if (ActivityCompat.checkSelfPermission(Product_content2.this, Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) { return; } startActivity(intent); } }); imageButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(Product_content2.this,PhotoVoirLesPhotos.class); startActivity(intent); } }); } @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id== android.R.id.home){ this.finish(); } return super.onOptionsItemSelected(item); } }
Partager