I get some text from my sqlite database and place it in a variable:
opis = c.getString(11);
Cursor works fine in the rest of my app. Now I call another activity with an intent and send it the string:
Intent opis = new Intent(getApplicationContext(), Popup_opis.class);
opis.putExtra("poslatOpis", opis);
startActivity(opis);
In that class I take that string and place it in another one, and then set that text to a TextView. That popup activity works fine when I call it with just word "text" in that TextView. Now, here's that activity:
public class Popup_opis extends Activity{
TextView opis;
String poslatOpis, primljenOpis;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.popup_opis);
Bundle extras = getIntent().getExtras();
if(extras !=null) {
primljenOpis = extras.getString("poslatOpis");
}
initVariables();
}
private void initVariables() {
Typeface tv = Typeface.createFromAsset(getAssets(), "ARIALN.TTF");
opis = (TextView) findViewById(R.id.tvOpis);
opis.setTypeface(tv);
opis.setText(primljenOpis);
}
}
And here's the LogCat:
04-03 13:59:54.424: E/AndroidRuntime(28413): FATAL EXCEPTION: main
04-03 13:59:54.424: E/AndroidRuntime(28413): java.lang.StackOverflowError
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Parcel.writeMapInternal(Parcel.java:484)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Bundle.writeToParcel(Bundle.java:1552)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Parcel.writeBundle(Parcel.java:502)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.content.Intent.writeToParcel(Intent.java:5503)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Parcel.writeParcelable(Parcel.java:1151)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Parcel.writeValue(Parcel.java:1070)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Parcel.writeMapInternal(Parcel.java:488)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Bundle.writeToParcel(Bundle.java:1552)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Parcel.writeBundle(Parcel.java:502)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.content.Intent.writeToParcel(Intent.java:5503)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Parcel.writeParcelable(Parcel.java:1151)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Parcel.writeValue(Parcel.java:1070)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Parcel.writeMapInternal(Parcel.java:488)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Bundle.writeToParcel(Bundle.java:1552)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Parcel.writeBundle(Parcel.java:502)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.content.Intent.writeToParcel(Intent.java:5503)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Parcel.writeParcelable(Parcel.java:1151)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Parcel.writeValue(Parcel.java:1070)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Parcel.writeMapInternal(Parcel.java:488)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Bundle.writeToParcel(Bundle.java:1552)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Parcel.writeBundle(Parcel.java:502)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.content.Intent.writeToParcel(Intent.java:5503)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Parcel.writeParcelable(Parcel.java:1151)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Parcel.writeValue(Parcel.java:1070)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Parcel.writeMapInternal(Parcel.java:488)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Bundle.writeToParcel(Bundle.java:1552)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Parcel.writeBundle(Parcel.java:502)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.content.Intent.writeToParcel(Intent.java:5503)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Parcel.writeParcelable(Parcel.java:1151)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Parcel.writeValue(Parcel.java:1070)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Parcel.writeMapInternal(Parcel.java:488)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Bundle.writeToParcel(Bundle.java:1552)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Parcel.writeBundle(Parcel.java:502)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.content.Intent.writeToParcel(Intent.java:5503)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Parcel.writeParcelable(Parcel.java:1151)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Parcel.writeValue(Parcel.java:1070)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Parcel.writeMapInternal(Parcel.java:488)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Bundle.writeToParcel(Bundle.java:1552)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Parcel.writeBundle(Parcel.java:502)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.content.Intent.writeToParcel(Intent.java:5503)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Parcel.writeParcelable(Parcel.java:1151)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Parcel.writeValue(Parcel.java:1070)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Parcel.writeMapInternal(Parcel.java:488)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Bundle.writeToParcel(Bundle.java:1552)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Parcel.writeBundle(Parcel.java:502)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.content.Intent.writeToParcel(Intent.java:5503)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Parcel.writeParcelable(Parcel.java:1151)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Parcel.writeValue(Parcel.java:1070)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Parcel.writeMapInternal(Parcel.java:488)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Bundle.writeToParcel(Bundle.java:1552)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Parcel.writeBundle(Parcel.java:502)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.content.Intent.writeToParcel(Intent.java:5503)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Parcel.writeParcelable(Parcel.java:1151)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Parcel.writeValue(Parcel.java:1070)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Parcel.writeMapInternal(Parcel.java:488)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Bundle.writeToParcel(Bundle.java:1552)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Parcel.writeBundle(Parcel.java:502)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.content.Intent.writeToParcel(Intent.java:5503)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Parcel.writeParcelable(Parcel.java:1151)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Parcel.writeValue(Parcel.java:1070)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Parcel.writeMapInternal(Parcel.java:488)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Bundle.writeToParcel(Bundle.java:1552)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Parcel.writeBundle(Parcel.java:502)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.content.Intent.writeToParcel(Intent.java:5503)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Parcel.writeParcelable(Parcel.java:1151)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Parcel.writeValue(Parcel.java:1070)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Parcel.writeMapInternal(Parcel.java:488)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Bundle.writeToParcel(Bundle.java:1552)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Parcel.writeBundle(Parcel.java:502)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.content.Intent.writeToParcel(Intent.java:5503)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Parcel.writeParcelable(Parcel.java:1151)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Parcel.writeValue(Parcel.java:1070)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Parcel.writeMapInternal(Parcel.java:488)
04-03 13:59:54.424: E/AndroidRuntime(28413): at android.os.Bundle.writeT
What am I doing wrong?
Intent opis = new Intent(getApplicationContext(), Popup_opis.class);
opis.putExtra("poslatOpis", opis);
You are putting your opis
intent inside your intent extras, creating infinite recursion when parceled. Use a different variable name for the intent and poslatOpis
.
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