1
C, C++, C#, Java, Visual Basic, HTML, PHP, CSS, Javascript, Ajax, Joomla, MySql y más / Re: No consigo que abra el link de youtube mi app en Java
« en: 03 de Enero 2024, 16:14 »
Song.java
ERRORES EN LOGCAT -->
Código: [Seleccionar]
package com.example.musicreminder;
import android.os.Parcel;
import android.os.Parcelable;
public class Song implements Parcelable {
private String name;
private String artist;
private String reason;
private String youtubeLink; // Nuevo campo
private String listenDate; // Nuevo campo
public Song(String name, String artist, String reason, String youtubeLink, String listenDate) {
this.name = name;
this.artist = artist;
this.reason = reason;
this.youtubeLink = youtubeLink;
this.listenDate = listenDate;
}
public String getName() {
return name;
}
public String getArtist() {
return artist;
}
public String getReason() {
return reason;
}
public String getYoutubeLink() {
return youtubeLink;
}
public String getListenDate() {
return listenDate;
}
// Métodos Parcelable
protected Song(Parcel in) {
name = in.readString();
artist = in.readString();
reason = in.readString();
youtubeLink = in.readString();
listenDate = in.readString();
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(name);
dest.writeString(artist);
dest.writeString(reason);
dest.writeString(youtubeLink);
dest.writeString(listenDate);
}
public static final Creator<Song> CREATOR = new Creator<Song>() {
@Override
public Song createFromParcel(Parcel in) {
return new Song(in);
}
@Override
public Song[] newArray(int size) {
return new Song[size];
}
};
}
ERRORES EN LOGCAT -->
Código: [Seleccionar]
2024-01-03 15:49:43.250 21063-21063 ViewRootIm...tActivity] com.example.musicreminder I ViewPostIme pointer 1
2024-01-03 15:49:43.260 21063-21063 AndroidRuntime com.example.musicreminder D Shutting down VM
2024-01-03 15:49:43.267 21063-21063 AndroidRuntime com.example.musicreminder E FATAL EXCEPTION: main
Process: com.example.musicreminder, PID: 21063
java.lang.IllegalStateException: Could not find method openYoutubeLink(View) in a parent or ancestor Context for android:onClick attribute defined on view class androidx.appcompat.widget.AppCompatImageButton with id 'btnYoutubeLink'
at androidx.appcompat.app.AppCompatViewInflater$DeclaredOnClickListener.resolveMethod(AppCompatViewInflater.java:506)
at androidx.appcompat.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:464)
at android.view.View.performClick(View.java:8160)
at android.view.View.performClickInternal(View.java:8137)
at android.view.View.access$3700(View.java:888)
at android.view.View$PerformClick.run(View.java:30236)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:246)
at android.app.ActivityThread.main(ActivityThread.java:8653)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
2024-01-03 15:49:43.334 21063-21063 Process com.example.musicreminder I Sending signal. PID: 21063 SIG: 9