Nice replies guyz.

Here is my code:

                Intent intention = new Intent( this, MyView2.class );
                intention.putExtra( "param1", "strings of JSON text" );
                startActivity( intention );

The question is:
1. Do I did a correct the way calling the other activity?
2. Is it effective if I pass the JSON text between intents?
3. How to pass an object between activities?



On Jun 15, 12:51 am, sachin ravi <sachinravi...@gmail.com> wrote:
> Hi,,
>
> U can have the one activity with 2 views. For that you need to set the new
> layout (say view 2) using setContentView() function when button 1 is pressed
> in view 1. When user press the BACK key, handle the same using onKeyDown()
> and call again setContentView() method with view1 layout.
>
> But problem with above approach will be when u rotate the screen then it
> will call OnCreate() of activity which will again set the view 1 content if
> view 2 has been set previously.
>
> So it is better to have 2 activity rather trying to draw the 2 views in 1
> activity.
>
>
>
> On Mon, Jun 14, 2010 at 6:09 PM, Steven Maitlall <m.ste...@gmail.com> wrote:
> > You should really be using Intents to launch activities, like Justin said.
> > Each of your views would be a separate activity. The OS will handle going
> > back to the previous activity for you, by means of the phone's back button.
> > When a button is clicked that should switch to a different view, launch an
> > Intent. Android will handle the rest.

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to