I want to know what the log that shows means when the Buttom Navigation Bar is clicked, The text information inside this item is stored in the prefrence.
this is the code for navigation item when clicked :
case R.id.navigation_gift:
View view = View.inflate(getApplicationContext(), R.layout.section_fragment_69, null);
TextView txtEmtiaz = (TextView) view.findViewById(R.id.txtEmtiaz);
SharedPreferences sp = getSharedPreferences("entire", 0);
txtEmtiaz.setText(sp.getString("tik", ""));
Log.e("POPI", "txt in main2 :" + String.valueOf(txtEmtiaz));
This is the Log information that is displayed:
/POPI: txt in main2 :android.widget.TextView{1e42d479 V.ED.... ......ID 0,0-0,0 #7f09016d app:id/txtEmtiaz}
You need to get text from txtEmtiaz
and then set it to sp
shared preference.
Problem is at below line:
txtEmtiaz.setText();
Change to:
sp.putString("tik", txtEmtiaz.getText());
Problem in log:
Log.e("POPI", "txt in main2 :" + String.valueOf(txtEmtiaz));
You are trying to print txtEmtiaz
i.e. txtEmtiaz
object which of course you can not.
You should use like below to print value (text) of txtEmtiaz
TextView:
Log.e("POPI", "txt in main2 :" + txtEmtiaz.getText());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With