Bonjour, aux codeuses et codeurs
voici mon code erreur
et voici le code mon fichier java
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 E/AndroidRuntime: FATAL EXCEPTION: main Process: insecte.programme.ulision, PID: 18752 java.lang.RuntimeException: Unable to start activity ComponentInfo{insecte.programme.ulision/insecte.programme.ulision.ui.home.D_Holometabola.Lepidoptera_ORDER.PlaceDetailsActivity}: java.lang.NullPointerException at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3449) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:223) at android.app.ActivityThread.main(ActivityThread.java:7656) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947) Caused by: java.lang.NullPointerException at java.util.Objects.requireNonNull(Objects.java:220) at insecte.programme.ulision.ui.home.D_Holometabola.Lepidoptera_ORDER.PlaceDetailsActivity.init(PlaceDetailsActivity.java:63) at insecte.programme.ulision.ui.home.D_Holometabola.Lepidoptera_ORDER.PlaceDetailsActivity.onCreate(PlaceDetailsActivity.java:35) at android.app.Activity.performCreate(Activity.java:8000) at android.app.Activity.performCreate(Activity.java:7984) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1309) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3422) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:223) at android.app.ActivityThread.main(ActivityThread.java:7656) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947) I/Process: Sending signal. PID: 18752 SIG: 9 Disconnected from the target VM, address: 'localhost:64015', transport: 'socket'
si vous pouvais m'aider à résoudre mon problème détail par détail afin que je puisse comprendre les erreurs et surtout pouvoir rectifier , ce serai cool merci .
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 public class PlaceDetailsActivity extends AppCompatActivity { private ImageView placeImageView; private TextView placeNameTextView, placeDescriptionTextView, placeCityTextView, placePhoneTextView, placeAddressTextView, placeRatingCountTextView; private LinearLayout phoneLinearLayout; private RatingBar placeRatingBar; private String placeType; private PlaceModel placeModel; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_place_details); init(); setViewsValues(); } @Override public void onBackPressed(){ sendToMain(); } @Override public boolean onOptionsItemSelected(@NonNull MenuItem item) { if (item.getItemId() == android.R.id.home) { sendToMain(); } return super.onOptionsItemSelected(item); } private void sendToMain(){ Intent intent = new Intent(this, Lepidopteres__Deux.class); intent.putExtra("type", placeType); startActivity(intent); finish(); } private void init(){ Gson gson = new Gson(); // getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setTitle(R.string.details_header); placeImageView = findViewById(R.id.place_imageView); placeNameTextView = findViewById(R.id.placeName_textView); placeDescriptionTextView = findViewById(R.id.placeDesc_textView); placeCityTextView = findViewById(R.id.placeCity_textView); placePhoneTextView = findViewById(R.id.placePhone_textView); placeAddressTextView = findViewById(R.id.placeAddress_textView); phoneLinearLayout = findViewById(R.id.phone_linearLayout); placeRatingBar = findViewById(R.id.place_RatingBar); placeRatingCountTextView = findViewById(R.id.ratingCount_textView); placeType = getIntent().getStringExtra("type"); String placeAsString = getIntent().getStringExtra("placeObj"); placeModel = gson.fromJson(placeAsString, PlaceModel.class); } private void setViewsValues(){ if(placeType.equals("historical")) { phoneLinearLayout.setVisibility(View.GONE); } else { placePhoneTextView.setText(placeModel.getPhone()); } placeImageView.setImageResource(placeModel.getImageResID()); placeNameTextView.setText(placeModel.getName()); placeDescriptionTextView.setText(placeModel.getDescription()); placeCityTextView.setText(placeModel.getCity()); placeAddressTextView.setText(placeModel.getAddress()); placeRatingBar.setRating(placeModel.getRate()); placeRatingCountTextView.setText(String.valueOf(placeModel.getRate())); } }
Partager