Cannot resolve symbol 'Builder' : package com.example.myapp2.UI.view.fragments; import…
- User
Cannot resolve symbol 'Builder' : package com.example.myapp_2.UI.view.fragments;
import static android.content.Context.MODE_PRIVATE;
import android.app.NotificationChannel; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.EditText; import android.widget.Switch; import android.widget.TextView; import android.widget.Toast;
import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.core.app.NotificationCompat; import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import androidx.viewpager.widget.ViewPager; import androidx.work.WorkerParameters;
import com.example.myapp_2.List_1.Product; import com.example.myapp_2.List_1.ProductAdapter; import com.example.myapp_2.R; import com.example.myapp_2.SortWorker; import com.example.myapp_2.UI.view.adapters.SliderAdapter;
import java.util.ArrayList; import java.util.List; //import androidx.work.WorkerParameters.Builder;
public class SecondFragment extends Fragment implements View.OnClickListener {
code - Assistant
The issue is that the
Builderclass is not imported from the correct package. Based on the commented out import statement, it seems that you were trying to importWorkerParameters.Builderfromandroidx.work.WorkerParameters, but that is not used in the code. Instead, you need to importNotificationCompat.Builderfromandroidx.core.app.NotificationCompatin order to use theBuilderclass for building a notification.To fix the error, change the import statement for
Builderto the following:code