Search code examples
androidandroid-intentintentfilter

Custom Intent-Filters in android


What i am currently try to achieve is:
Add a record in one activity and show it on the other activity. And on the click of the edit button on the show activity it takes back user to the first page for editing the data.
The problem is that i cannot use Intent.putextra() for this because the add page is linked with other so it gives me error for this.
Thought of using shared preferences as well,but i don't think it would help me much, since if a value is set in shared preference it would be available on load of the activity so i wont be able to know from where i entered the activity. so thought of using intent-filters for it. can anyone help me with this ? And i dont want to create another class for edit purpose.


Solution

  • Why not check for...

    <pre>
    <code>
        if (getIntent() != null && getIntent().getSerializableExtra("Id") != null)
        {
           //get the data here becuz it's not null here....
        }
    </code>
    </pre>
    

    also just note that getIntExtra() also exists...