Need help about Intent

by gganesh » Tue, 24 Feb 2009 13:38:26 GMT


Sponsored Links
 hi friends,
i have two classes Screen1 and Screen2 both extends activity
i have to pass data from the Screen1 to Screen 2

i wrote in onCreate method of Screen1 class


 t=(EditText)findViewById(R.id.ed1);
 b=(Button)findViewById(R.id.but1);
         b.setOnClickListener(new Button.OnClickListener()
         {
                public void onClick(View v)
                {
                        Intent i= new Intent(v.getContext(),Screen2.class);
                        i.putExtra("myval",t.toString());
                        startActivity(i);
                }

My doubt is ,how to receive myval data in Screen2 class ,what is the
code i have to add in AndroidManifest.xml file
--~--~---------~--~----~------------~-------~--~----~



Need help about Intent

by dillirao malipeddi » Tue, 24 Feb 2009 13:46:11 GMT


 you have to
use

Bundle your_extras = getIntent.getExtras();

String val = your_extras.getExtras("myval");








-- 
Dilli Rao. M
ARIJASOFT
+91 - 9703073540

--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Need help about Intent

by gganesh » Tue, 24 Feb 2009 16:43:02 GMT


 but the code   " your_extras.getExtras(myval) ; "
didn't work ,i suppose there is no such method in Bundle class
i tried as show below
       Bundle your_extras = this.getIntent().getExtras();
        String val = (String) your_extras.get("myval");
 but the "val" doesn't gives me the required data
Any suggestions ?
Thanks





On Feb 24, 10:46am, dillirao malipeddi <dillir...@arijasoft.com>



--~--~---------~--~----~------------~-------~--~----~



Need help about Intent

by dillirao malipeddi » Tue, 24 Feb 2009 17:03:00 GMT


 in your first Activity

        Intent my_intent = new Intent(FirstScreen.this.getApplication(),
SecondScreen.class);

        my_intent.putExtra("Value_String", "HaiHow R U");

        startActivity(intent);


in your Second Activity
in onCreate

Bundle extras = getIntent().getExtras();

String fromFirstActivity= extras.getString("Value_String");

you can use fromFirstActivity as from previous activity value


imp:

 the value pasesed in putExtras()   // Value_String

use the same for get the value in second Activity









-- 
Dilli Rao. M
ARIJASOFT
+91 - 9703073540

--~--~---------~--~----~------------~-------~--~----~



Need help about Intent

by dillirao malipeddi » Tue, 24 Feb 2009 17:07:17 GMT


 n your first Activity

b.setOnClickListener(new Button.OnClickListener()


load_SecondActivity()
{

Intent my_intent = new Intent(FirstScreen.this.getApplication(),
SecondScreen.class);

my_intent.putExtra("Value_String", "HaiHow R U");

startActivity(my_intent);
}

in your Second Activity
in onCreate

Bundle extras = getIntent().getExtras();

String fromFirstActivity= extras.getString("Value_String");

you can use fromFirstActivity as from previous activity value


On Tue, Feb 24, 2009 at 2:32 PM, dillirao malipeddi <dillir...@arijasoft.com




--
Dilli Rao. M
ARIJASOFT
+91 - 9703073540

--~--~---------~--~----~------------~-------~--~----~



Need help about Intent

by gganesh » Tue, 24 Feb 2009 17:18:54 GMT


 sorry, i have made a minor mistake ,the code given by me works
perfectly
and the "val" is displayed as excepted  .






--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Conflict in to MapController between Zoom Level and AnimateTo ?

I used a personnal ItemizedOverlay,

I extend "OnTap(int index)" where I call
MapController.animato(GeoPoint)

The coordinate of the geopoint are always the same but the animation
goes wrong depending of the zoom level

-- 

2. Invalidating a Canvas view that is part of setContentView()

Hello,

Using the example from the API FingerPaint as a basis, I have
something similar to the following structure:

public class FingerPaint extends GraphicsActivity
        implements ColorPickerDialog.OnColorChangedListener {

                [...]

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(new MyView(this));
   [...]
}

The class that has been set as contentView (MyView) contains a Canvas:

    public class MyView extends View {
       [..]
        public Canvas  mCanvas;
       [..]
}

How could I access this mCanvas in order to redraw it when an external
event is triggered (i.e., clicking a button from the menu). Obviously
I can access them from FingerPaint, since the attributes from MyView
are not inherited, but I can't neither access MyView directly, since
it is "absorbed" by the class FingerPrint.

Any idea, before redesigning the classes?

Thanks!

-- 

3. Porting of OpenGL on powerpc board

4. Original posting

5. How to Access Gmail Account Contact in Android

6. NFC question: card emulation is not supported in the Android SDK yet, right?

7. Partial Honeycomb-ish source