Aller au contenu
View in the app

A better way to browse. Learn more.

Forum de Frandroid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

je tourne en rond erreur sur erreur

Featured Replies

Posté(e)

Bonjour , aux codeuses et codeurs

voici mon code d'erreur que android studio me donne

<code>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'</code>

et voici le code mon fichier java.xml

<code>
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()));
    }
}</code>

si vous pouvais aider à résoudre mon problème pas à pas afin que je puisse bien résoudre mo problème car je suis gros débutant et très isolé .  ce serai cool merci

Posté(e)
  • Auteur

j'ai supprimé 
les lignes 

//        setViewsValues();
//        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
//        getSupportActionBar().setTitle(R.string.details_header);

l'activité s'ouvre mais vide , comment avoir les données.
autre question à la place d'ouvrir une activité et il possible d'ouvrir un fragment  à la place et comment dois je procéder  . merci

Posté(e)
  • Auteur

y a personne qui veut m'écrire pour me dire une petite solution 

Posté(e)
  • Auteur

😭y a personne qui veut m'écrire pour me dire une petite solution 

Rejoignez la conversation

Vous pouvez poster maintenant et vous enregistrez plus tard. Si vous avez un compte, connectez-vous maintenant pour poster.

Invité
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Répondre à ce sujet…

Account

Navigation

Rechercher

Rechercher

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.