Arraylist showing this value PlanetData@adf4bee instead of added value [duplicate]











up vote
0
down vote

favorite













This question already has an answer here:




  • How do I print my Java object without getting “SomeType@2f92e0f4”?

    10 answers




I'm not exactly sure if my topic is asking the right question but the situtation is this. I working on an app that is performing multiple calculations in separate classes. The calculations are being done correctly and I am able to see that they are in logcat. Now I want to display them in recyclerview and to do that I am trying to add them to an arraylist before doing a recyclerview. My arraylist is getting the values displayed in the title and its not showing in my recyclerview. Here is are my codes but based on the research I looked up I cant see what I am doing wrong.



ArrayList Code:



public class PlanetData {
private String planetRA;

private PlanetData(String planetRA){
this.planetRA = planetRA;
}

public String getPlanetRA(){
return planetRA;
}

public void setPlanetRA (String planetRA){
this.planetRA = planetRA;
}

public static void main(String args){
List<PlanetData> planetvalues = new ArrayList<>();

planetvalues.add(new PlanetData("12"));
planetvalues.add(new PlanetData(Double.toString(Mercury.getMercuryRA())));
planetvalues.add(new PlanetData(Double.toString(Venus.getVenusRA())));
planetvalues.add(new PlanetData(Double.toString(Moon.getMoonRA())));
planetvalues.add(new PlanetData (Double.toString(Mars.getMarsRA())));
planetvalues.add(new PlanetData(Double.toString(Jupiter.getJupiterRA())));
planetvalues.add(new PlanetData(Double.toString(Saturn.getSaturnRA())));
planetvalues.add(new PlanetData(Double.toString(Uranus.getUranusRA())));
planetvalues.add(new PlanetData(Double.toString(Neptune.getNeptuneRA())));
planetvalues.add(new PlanetData(Double.toString(Pluto.getPlutoRA())));

System.out.println("This is the arraylist" + planetvalues);

}




}


RecyclerView Adapter



      public class PlanetRecyclerViewAdapter extends RecyclerView.Adapter<PlanetRecyclerViewAdapter.ViewHolder> {

List<PlanetData> mPlanetDataList;
Context mContext;

public static class ViewHolder extends RecyclerView.ViewHolder{

public TextView currentRA;

public ViewHolder(View itemView) {
super(itemView);

currentRA = (TextView) itemView.findViewById(R.id.planet_location);


}

}

public PlanetRecyclerViewAdapter(List<PlanetData> mPlanetDataList, Context mContext){
this.mPlanetDataList = mPlanetDataList;
this.mContext = mContext;
}

@Override
public PlanetRecyclerViewAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.planet_recycler_item,parent, false);



return new ViewHolder(itemView);
}

@Override
public void onBindViewHolder( PlanetRecyclerViewAdapter.ViewHolder holder, int position) {
holder.currentRA.setText(mPlanetDataList.get(position).getPlanetRA());


}

@Override
public int getItemCount() {
return mPlanetDataList.size();
}
}


Fragment Activity



public class TestFragment extends Fragment {
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1";
private static final String ARG_PARAM2 = "param2";
private TextView planetLongitude;
private TextView planetLatitude;
private TextView planetTime;
private TextView SunRA;
private TextView SunDEC;
RecyclerView mRecyclerView;
PlanetRecyclerViewAdapter adapter;
List<PlanetData> items = new ArrayList<>();

// TODO: Rename and change types of parameters
private String mParam1;
private String mParam2;

Mercury test;

private OnFragmentInteractionListener mListener;

public TestFragment() {
// Required empty public constructor
}

/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param param1 Parameter 1.
* @param param2 Parameter 2.
* @return A new instance of fragment TestFragment.
*/
// TODO: Rename and change types and number of parameters
public static TestFragment newInstance(String param1, String param2) {
TestFragment fragment = new TestFragment();
Bundle args = new Bundle();
args.putString(ARG_PARAM1, param1);
args.putString(ARG_PARAM2, param2);
fragment.setArguments(args);
return fragment;
}

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);



if (getArguments() != null) {
mParam1 = getArguments().getString(ARG_PARAM1);
mParam2 = getArguments().getString(ARG_PARAM2);



}

}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {

// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_test, container, false);


mRecyclerView = (RecyclerView)view.findViewById(R.id.planet_recycler_view);
mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
mRecyclerView.addItemDecoration(new DividerItemDecoration(mRecyclerView.getContext(),DividerItemDecoration.VERTICAL));

adapter = new PlanetRecyclerViewAdapter(items, mRecyclerView.getContext());
mRecyclerView.setAdapter(adapter);




return view;
}



In my logcat I'm getting the following response in my arraylist:
11-10 22:02:52.581 13826-13826/com.ksburneytwo.planetmathtest I/System.out: This is the arraylist[com.ksburneytwo.planetmathtest.PlanetData@adf4bee, com.ksburneytwo.planetmathtest.PlanetData@24a088f, com.ksburneytwo.planetmathtest.PlanetData@5bb671c, com.ksburneytwo.planetmathtest.PlanetData@5dd9f25, com.ksburneytwo.planetmathtest.PlanetData@17838fa, com.ksburneytwo.planetmathtest.PlanetData@ce89eab, com.ksburneytwo.planetmathtest.PlanetData@2a5d908, com.ksburneytwo.planetmathtest.PlanetData@cee08a1, com.ksburneytwo.planetmathtest.PlanetData@580eac6, com.ksburneytwo.planetmathtest.PlanetData@a907a87]




The values should be my the results of my calculations.










share|improve this question















marked as duplicate by GBlodgett, Stephen C android
Users with the  android badge can single-handedly close android questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 11 at 4:22


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.















  • you have to override toString() method in PlanetData class in-order to see those values.
    – sarath kumar
    Nov 11 at 3:51










  • You should override toString() method for your array list.
    – PradyumanDixit
    Nov 11 at 3:51















up vote
0
down vote

favorite













This question already has an answer here:




  • How do I print my Java object without getting “SomeType@2f92e0f4”?

    10 answers




I'm not exactly sure if my topic is asking the right question but the situtation is this. I working on an app that is performing multiple calculations in separate classes. The calculations are being done correctly and I am able to see that they are in logcat. Now I want to display them in recyclerview and to do that I am trying to add them to an arraylist before doing a recyclerview. My arraylist is getting the values displayed in the title and its not showing in my recyclerview. Here is are my codes but based on the research I looked up I cant see what I am doing wrong.



ArrayList Code:



public class PlanetData {
private String planetRA;

private PlanetData(String planetRA){
this.planetRA = planetRA;
}

public String getPlanetRA(){
return planetRA;
}

public void setPlanetRA (String planetRA){
this.planetRA = planetRA;
}

public static void main(String args){
List<PlanetData> planetvalues = new ArrayList<>();

planetvalues.add(new PlanetData("12"));
planetvalues.add(new PlanetData(Double.toString(Mercury.getMercuryRA())));
planetvalues.add(new PlanetData(Double.toString(Venus.getVenusRA())));
planetvalues.add(new PlanetData(Double.toString(Moon.getMoonRA())));
planetvalues.add(new PlanetData (Double.toString(Mars.getMarsRA())));
planetvalues.add(new PlanetData(Double.toString(Jupiter.getJupiterRA())));
planetvalues.add(new PlanetData(Double.toString(Saturn.getSaturnRA())));
planetvalues.add(new PlanetData(Double.toString(Uranus.getUranusRA())));
planetvalues.add(new PlanetData(Double.toString(Neptune.getNeptuneRA())));
planetvalues.add(new PlanetData(Double.toString(Pluto.getPlutoRA())));

System.out.println("This is the arraylist" + planetvalues);

}




}


RecyclerView Adapter



      public class PlanetRecyclerViewAdapter extends RecyclerView.Adapter<PlanetRecyclerViewAdapter.ViewHolder> {

List<PlanetData> mPlanetDataList;
Context mContext;

public static class ViewHolder extends RecyclerView.ViewHolder{

public TextView currentRA;

public ViewHolder(View itemView) {
super(itemView);

currentRA = (TextView) itemView.findViewById(R.id.planet_location);


}

}

public PlanetRecyclerViewAdapter(List<PlanetData> mPlanetDataList, Context mContext){
this.mPlanetDataList = mPlanetDataList;
this.mContext = mContext;
}

@Override
public PlanetRecyclerViewAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.planet_recycler_item,parent, false);



return new ViewHolder(itemView);
}

@Override
public void onBindViewHolder( PlanetRecyclerViewAdapter.ViewHolder holder, int position) {
holder.currentRA.setText(mPlanetDataList.get(position).getPlanetRA());


}

@Override
public int getItemCount() {
return mPlanetDataList.size();
}
}


Fragment Activity



public class TestFragment extends Fragment {
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1";
private static final String ARG_PARAM2 = "param2";
private TextView planetLongitude;
private TextView planetLatitude;
private TextView planetTime;
private TextView SunRA;
private TextView SunDEC;
RecyclerView mRecyclerView;
PlanetRecyclerViewAdapter adapter;
List<PlanetData> items = new ArrayList<>();

// TODO: Rename and change types of parameters
private String mParam1;
private String mParam2;

Mercury test;

private OnFragmentInteractionListener mListener;

public TestFragment() {
// Required empty public constructor
}

/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param param1 Parameter 1.
* @param param2 Parameter 2.
* @return A new instance of fragment TestFragment.
*/
// TODO: Rename and change types and number of parameters
public static TestFragment newInstance(String param1, String param2) {
TestFragment fragment = new TestFragment();
Bundle args = new Bundle();
args.putString(ARG_PARAM1, param1);
args.putString(ARG_PARAM2, param2);
fragment.setArguments(args);
return fragment;
}

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);



if (getArguments() != null) {
mParam1 = getArguments().getString(ARG_PARAM1);
mParam2 = getArguments().getString(ARG_PARAM2);



}

}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {

// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_test, container, false);


mRecyclerView = (RecyclerView)view.findViewById(R.id.planet_recycler_view);
mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
mRecyclerView.addItemDecoration(new DividerItemDecoration(mRecyclerView.getContext(),DividerItemDecoration.VERTICAL));

adapter = new PlanetRecyclerViewAdapter(items, mRecyclerView.getContext());
mRecyclerView.setAdapter(adapter);




return view;
}



In my logcat I'm getting the following response in my arraylist:
11-10 22:02:52.581 13826-13826/com.ksburneytwo.planetmathtest I/System.out: This is the arraylist[com.ksburneytwo.planetmathtest.PlanetData@adf4bee, com.ksburneytwo.planetmathtest.PlanetData@24a088f, com.ksburneytwo.planetmathtest.PlanetData@5bb671c, com.ksburneytwo.planetmathtest.PlanetData@5dd9f25, com.ksburneytwo.planetmathtest.PlanetData@17838fa, com.ksburneytwo.planetmathtest.PlanetData@ce89eab, com.ksburneytwo.planetmathtest.PlanetData@2a5d908, com.ksburneytwo.planetmathtest.PlanetData@cee08a1, com.ksburneytwo.planetmathtest.PlanetData@580eac6, com.ksburneytwo.planetmathtest.PlanetData@a907a87]




The values should be my the results of my calculations.










share|improve this question















marked as duplicate by GBlodgett, Stephen C android
Users with the  android badge can single-handedly close android questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 11 at 4:22


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.















  • you have to override toString() method in PlanetData class in-order to see those values.
    – sarath kumar
    Nov 11 at 3:51










  • You should override toString() method for your array list.
    – PradyumanDixit
    Nov 11 at 3:51













up vote
0
down vote

favorite









up vote
0
down vote

favorite












This question already has an answer here:




  • How do I print my Java object without getting “SomeType@2f92e0f4”?

    10 answers




I'm not exactly sure if my topic is asking the right question but the situtation is this. I working on an app that is performing multiple calculations in separate classes. The calculations are being done correctly and I am able to see that they are in logcat. Now I want to display them in recyclerview and to do that I am trying to add them to an arraylist before doing a recyclerview. My arraylist is getting the values displayed in the title and its not showing in my recyclerview. Here is are my codes but based on the research I looked up I cant see what I am doing wrong.



ArrayList Code:



public class PlanetData {
private String planetRA;

private PlanetData(String planetRA){
this.planetRA = planetRA;
}

public String getPlanetRA(){
return planetRA;
}

public void setPlanetRA (String planetRA){
this.planetRA = planetRA;
}

public static void main(String args){
List<PlanetData> planetvalues = new ArrayList<>();

planetvalues.add(new PlanetData("12"));
planetvalues.add(new PlanetData(Double.toString(Mercury.getMercuryRA())));
planetvalues.add(new PlanetData(Double.toString(Venus.getVenusRA())));
planetvalues.add(new PlanetData(Double.toString(Moon.getMoonRA())));
planetvalues.add(new PlanetData (Double.toString(Mars.getMarsRA())));
planetvalues.add(new PlanetData(Double.toString(Jupiter.getJupiterRA())));
planetvalues.add(new PlanetData(Double.toString(Saturn.getSaturnRA())));
planetvalues.add(new PlanetData(Double.toString(Uranus.getUranusRA())));
planetvalues.add(new PlanetData(Double.toString(Neptune.getNeptuneRA())));
planetvalues.add(new PlanetData(Double.toString(Pluto.getPlutoRA())));

System.out.println("This is the arraylist" + planetvalues);

}




}


RecyclerView Adapter



      public class PlanetRecyclerViewAdapter extends RecyclerView.Adapter<PlanetRecyclerViewAdapter.ViewHolder> {

List<PlanetData> mPlanetDataList;
Context mContext;

public static class ViewHolder extends RecyclerView.ViewHolder{

public TextView currentRA;

public ViewHolder(View itemView) {
super(itemView);

currentRA = (TextView) itemView.findViewById(R.id.planet_location);


}

}

public PlanetRecyclerViewAdapter(List<PlanetData> mPlanetDataList, Context mContext){
this.mPlanetDataList = mPlanetDataList;
this.mContext = mContext;
}

@Override
public PlanetRecyclerViewAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.planet_recycler_item,parent, false);



return new ViewHolder(itemView);
}

@Override
public void onBindViewHolder( PlanetRecyclerViewAdapter.ViewHolder holder, int position) {
holder.currentRA.setText(mPlanetDataList.get(position).getPlanetRA());


}

@Override
public int getItemCount() {
return mPlanetDataList.size();
}
}


Fragment Activity



public class TestFragment extends Fragment {
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1";
private static final String ARG_PARAM2 = "param2";
private TextView planetLongitude;
private TextView planetLatitude;
private TextView planetTime;
private TextView SunRA;
private TextView SunDEC;
RecyclerView mRecyclerView;
PlanetRecyclerViewAdapter adapter;
List<PlanetData> items = new ArrayList<>();

// TODO: Rename and change types of parameters
private String mParam1;
private String mParam2;

Mercury test;

private OnFragmentInteractionListener mListener;

public TestFragment() {
// Required empty public constructor
}

/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param param1 Parameter 1.
* @param param2 Parameter 2.
* @return A new instance of fragment TestFragment.
*/
// TODO: Rename and change types and number of parameters
public static TestFragment newInstance(String param1, String param2) {
TestFragment fragment = new TestFragment();
Bundle args = new Bundle();
args.putString(ARG_PARAM1, param1);
args.putString(ARG_PARAM2, param2);
fragment.setArguments(args);
return fragment;
}

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);



if (getArguments() != null) {
mParam1 = getArguments().getString(ARG_PARAM1);
mParam2 = getArguments().getString(ARG_PARAM2);



}

}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {

// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_test, container, false);


mRecyclerView = (RecyclerView)view.findViewById(R.id.planet_recycler_view);
mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
mRecyclerView.addItemDecoration(new DividerItemDecoration(mRecyclerView.getContext(),DividerItemDecoration.VERTICAL));

adapter = new PlanetRecyclerViewAdapter(items, mRecyclerView.getContext());
mRecyclerView.setAdapter(adapter);




return view;
}



In my logcat I'm getting the following response in my arraylist:
11-10 22:02:52.581 13826-13826/com.ksburneytwo.planetmathtest I/System.out: This is the arraylist[com.ksburneytwo.planetmathtest.PlanetData@adf4bee, com.ksburneytwo.planetmathtest.PlanetData@24a088f, com.ksburneytwo.planetmathtest.PlanetData@5bb671c, com.ksburneytwo.planetmathtest.PlanetData@5dd9f25, com.ksburneytwo.planetmathtest.PlanetData@17838fa, com.ksburneytwo.planetmathtest.PlanetData@ce89eab, com.ksburneytwo.planetmathtest.PlanetData@2a5d908, com.ksburneytwo.planetmathtest.PlanetData@cee08a1, com.ksburneytwo.planetmathtest.PlanetData@580eac6, com.ksburneytwo.planetmathtest.PlanetData@a907a87]




The values should be my the results of my calculations.










share|improve this question
















This question already has an answer here:




  • How do I print my Java object without getting “SomeType@2f92e0f4”?

    10 answers




I'm not exactly sure if my topic is asking the right question but the situtation is this. I working on an app that is performing multiple calculations in separate classes. The calculations are being done correctly and I am able to see that they are in logcat. Now I want to display them in recyclerview and to do that I am trying to add them to an arraylist before doing a recyclerview. My arraylist is getting the values displayed in the title and its not showing in my recyclerview. Here is are my codes but based on the research I looked up I cant see what I am doing wrong.



ArrayList Code:



public class PlanetData {
private String planetRA;

private PlanetData(String planetRA){
this.planetRA = planetRA;
}

public String getPlanetRA(){
return planetRA;
}

public void setPlanetRA (String planetRA){
this.planetRA = planetRA;
}

public static void main(String args){
List<PlanetData> planetvalues = new ArrayList<>();

planetvalues.add(new PlanetData("12"));
planetvalues.add(new PlanetData(Double.toString(Mercury.getMercuryRA())));
planetvalues.add(new PlanetData(Double.toString(Venus.getVenusRA())));
planetvalues.add(new PlanetData(Double.toString(Moon.getMoonRA())));
planetvalues.add(new PlanetData (Double.toString(Mars.getMarsRA())));
planetvalues.add(new PlanetData(Double.toString(Jupiter.getJupiterRA())));
planetvalues.add(new PlanetData(Double.toString(Saturn.getSaturnRA())));
planetvalues.add(new PlanetData(Double.toString(Uranus.getUranusRA())));
planetvalues.add(new PlanetData(Double.toString(Neptune.getNeptuneRA())));
planetvalues.add(new PlanetData(Double.toString(Pluto.getPlutoRA())));

System.out.println("This is the arraylist" + planetvalues);

}




}


RecyclerView Adapter



      public class PlanetRecyclerViewAdapter extends RecyclerView.Adapter<PlanetRecyclerViewAdapter.ViewHolder> {

List<PlanetData> mPlanetDataList;
Context mContext;

public static class ViewHolder extends RecyclerView.ViewHolder{

public TextView currentRA;

public ViewHolder(View itemView) {
super(itemView);

currentRA = (TextView) itemView.findViewById(R.id.planet_location);


}

}

public PlanetRecyclerViewAdapter(List<PlanetData> mPlanetDataList, Context mContext){
this.mPlanetDataList = mPlanetDataList;
this.mContext = mContext;
}

@Override
public PlanetRecyclerViewAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.planet_recycler_item,parent, false);



return new ViewHolder(itemView);
}

@Override
public void onBindViewHolder( PlanetRecyclerViewAdapter.ViewHolder holder, int position) {
holder.currentRA.setText(mPlanetDataList.get(position).getPlanetRA());


}

@Override
public int getItemCount() {
return mPlanetDataList.size();
}
}


Fragment Activity



public class TestFragment extends Fragment {
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1";
private static final String ARG_PARAM2 = "param2";
private TextView planetLongitude;
private TextView planetLatitude;
private TextView planetTime;
private TextView SunRA;
private TextView SunDEC;
RecyclerView mRecyclerView;
PlanetRecyclerViewAdapter adapter;
List<PlanetData> items = new ArrayList<>();

// TODO: Rename and change types of parameters
private String mParam1;
private String mParam2;

Mercury test;

private OnFragmentInteractionListener mListener;

public TestFragment() {
// Required empty public constructor
}

/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param param1 Parameter 1.
* @param param2 Parameter 2.
* @return A new instance of fragment TestFragment.
*/
// TODO: Rename and change types and number of parameters
public static TestFragment newInstance(String param1, String param2) {
TestFragment fragment = new TestFragment();
Bundle args = new Bundle();
args.putString(ARG_PARAM1, param1);
args.putString(ARG_PARAM2, param2);
fragment.setArguments(args);
return fragment;
}

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);



if (getArguments() != null) {
mParam1 = getArguments().getString(ARG_PARAM1);
mParam2 = getArguments().getString(ARG_PARAM2);



}

}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {

// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_test, container, false);


mRecyclerView = (RecyclerView)view.findViewById(R.id.planet_recycler_view);
mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
mRecyclerView.addItemDecoration(new DividerItemDecoration(mRecyclerView.getContext(),DividerItemDecoration.VERTICAL));

adapter = new PlanetRecyclerViewAdapter(items, mRecyclerView.getContext());
mRecyclerView.setAdapter(adapter);




return view;
}



In my logcat I'm getting the following response in my arraylist:
11-10 22:02:52.581 13826-13826/com.ksburneytwo.planetmathtest I/System.out: This is the arraylist[com.ksburneytwo.planetmathtest.PlanetData@adf4bee, com.ksburneytwo.planetmathtest.PlanetData@24a088f, com.ksburneytwo.planetmathtest.PlanetData@5bb671c, com.ksburneytwo.planetmathtest.PlanetData@5dd9f25, com.ksburneytwo.planetmathtest.PlanetData@17838fa, com.ksburneytwo.planetmathtest.PlanetData@ce89eab, com.ksburneytwo.planetmathtest.PlanetData@2a5d908, com.ksburneytwo.planetmathtest.PlanetData@cee08a1, com.ksburneytwo.planetmathtest.PlanetData@580eac6, com.ksburneytwo.planetmathtest.PlanetData@a907a87]




The values should be my the results of my calculations.





This question already has an answer here:




  • How do I print my Java object without getting “SomeType@2f92e0f4”?

    10 answers








java android arraylist






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 11 at 5:02









PradyumanDixit

2,1971718




2,1971718










asked Nov 11 at 3:48









ksb

3316




3316




marked as duplicate by GBlodgett, Stephen C android
Users with the  android badge can single-handedly close android questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 11 at 4:22


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






marked as duplicate by GBlodgett, Stephen C android
Users with the  android badge can single-handedly close android questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 11 at 4:22


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.














  • you have to override toString() method in PlanetData class in-order to see those values.
    – sarath kumar
    Nov 11 at 3:51










  • You should override toString() method for your array list.
    – PradyumanDixit
    Nov 11 at 3:51


















  • you have to override toString() method in PlanetData class in-order to see those values.
    – sarath kumar
    Nov 11 at 3:51










  • You should override toString() method for your array list.
    – PradyumanDixit
    Nov 11 at 3:51
















you have to override toString() method in PlanetData class in-order to see those values.
– sarath kumar
Nov 11 at 3:51




you have to override toString() method in PlanetData class in-order to see those values.
– sarath kumar
Nov 11 at 3:51












You should override toString() method for your array list.
– PradyumanDixit
Nov 11 at 3:51




You should override toString() method for your array list.
– PradyumanDixit
Nov 11 at 3:51












1 Answer
1






active

oldest

votes

















up vote
1
down vote



accepted










By default, toString() method would result in packagename.ClassName@hashcode.



In your PlanetData class, you need to override toString() method, so that it can return the appropriate fields and their values.



You can generate toString() method using your IDE and choose what fields you want to include in the output.






share|improve this answer




























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote



    accepted










    By default, toString() method would result in packagename.ClassName@hashcode.



    In your PlanetData class, you need to override toString() method, so that it can return the appropriate fields and their values.



    You can generate toString() method using your IDE and choose what fields you want to include in the output.






    share|improve this answer

























      up vote
      1
      down vote



      accepted










      By default, toString() method would result in packagename.ClassName@hashcode.



      In your PlanetData class, you need to override toString() method, so that it can return the appropriate fields and their values.



      You can generate toString() method using your IDE and choose what fields you want to include in the output.






      share|improve this answer























        up vote
        1
        down vote



        accepted







        up vote
        1
        down vote



        accepted






        By default, toString() method would result in packagename.ClassName@hashcode.



        In your PlanetData class, you need to override toString() method, so that it can return the appropriate fields and their values.



        You can generate toString() method using your IDE and choose what fields you want to include in the output.






        share|improve this answer












        By default, toString() method would result in packagename.ClassName@hashcode.



        In your PlanetData class, you need to override toString() method, so that it can return the appropriate fields and their values.



        You can generate toString() method using your IDE and choose what fields you want to include in the output.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 11 at 3:54









        snmaddula

        1918




        1918















            Popular posts from this blog

            List item for chat from Array inside array React Native

            Thiostrepton

            Caerphilly