Category : nullpointerexception

I am getting a NullPointerException Error while trying to play a Downloaded Content. I’m using a PlayerActivity class to play any content in my app. The content is being fetched using a reference number thus a getReference() method. @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_player); Bundle extras = getIntent().getExtras(); if(extras != null){ content = ..

Read more

This has been asked a million times, but I cannot get my code to work: public class MainActivity extends AppCompatActivity { //private static final String LOG_TAG = "SongList"; Dialog mDialog; Button button; static final String LOG_TAG = "SONG_APP"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Setup Floating Action Button that is used by ..

Read more

I am passing data to my recyclerview adpter RecyclerViewAdpter package com.example.alarm.Apters; import android.content.Context; import android.media.MediaPlayer; import android.net.Uri; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.ImageView; import android.widget.SeekBar; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import com.example.alarm.ExtraClass.External_Stotrage; import com.example.alarm.Models.RingtoneModel; import com.example.alarm.R; import java.util.ArrayList; public class Ringtone_Adpter extends RecyclerView.Adapter<Ringtone_Adpter.ViewHolder> {///24 Ist NullPointer exception ArrayList<RingtoneModel> ..

Read more

I am new to android and trying to create one simple application.However, i am getting nullpointerexception error and don’t have much knowledege about it. Error i got: java.lang.NullPointerException: Attempt to invoke virtual method ‘java.lang.String com.jstechnologies.helpinghands.data.model.Address.getShortAddress()’ on a null object reference at com.jstechnologies.helpinghands.ui.views.dashBoard.DashBoardActivity$5.onChanged(DashBoardActivity.java:113) at com.jstechnologies.helpinghands.ui.views.dashBoard.DashBoardActivity$5.onChanged(DashBoardActivity.java:110) DashBoardActivity.java package com.jstechnologies.helpinghands.ui.views.dashBoard; public class DashBoardActivity extends BaseActivity<DashBoardViewModel> { LinearLayout tagsView; ..

Read more

I am making an app in android studio but I am new to java. I am trying to make a dropdown menu using a spinner but I am getting NullPointerExeption but I did initialize the spinner variable. Plz help. I am getting error – Caused by: java.lang.NullPointerException: Attempt to invoke virtual method ‘void android.widget.Spinner.setAdapter(android.widget.SpinnerAdapter)’ on ..

Read more

I am making an app in android studio but I am new to java. I am trying to make a dropdown menu using a spinner but I am getting NullPointerExeption but I did initialize the spinner variable. Plz help. I am getting error – Caused by: java.lang.NullPointerException: Attempt to invoke virtual method ‘void android.widget.Spinner.setAdapter(android.widget.SpinnerAdapter)’ on ..

Read more

I tried to get all the music files through the directory but I get Java NullPointerException attempt to get length of null array right where the for loop starts. public ArrayList<File> findSong(File file) { ArrayList<File> arraylist = new ArrayList<>(); File f = file; if (file.length() > 0) { tvresult2.setText(" not null"); } else { tvresult2.setText(" ..

Read more

I have an app that has many fragments connected to one single activity. The first fragment has ListView with a custom arrayadpater. On clicking on an item in listview a second fragment opens up. The item’s name is also sent to the second fragment. The app also has a toolbar. Everything worked fine, but after ..

Read more