hello friends
i have around 14 different XML. In each XML i have 26 buttons all have
different positions using "android:layoutAlignLeft="300sp"..." etc
Like button1 to button26 are set in such a way that all scatter on the
UI. This way i have 14 xml. All XML have the same 26 buttons at
different positions. These XML come on the UI randomly i.e at run time
it is decided tht which XML will take the UI.

PROBLEM:-

as any of the XML gets inflated on the UI and when i click on the
button i want a toast exactly on the button.
I am getting the toast but not exactly on the button
I cant try using pixel position to bring the toast because i dont know
which XML will get inflated.

IN all 14 XML , each XML has 26 buttons , all buttons are in different
position in each XML ,One thing is common in all 14 XMl and that is
the ID of the button i.e- button1 in all 14 XML has - android:id=@+id/
button1....button2 in all 14 XML has - android:id=@+id/button2...
similarly all 26 buttons...
 its is decided at the runtime which XML will get inflate.

i have used this code:-

button1.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
                  // TODO Auto-generated method stub
            Toast toast = Toast.makeText(getApplicationContext(),"I am
BUTTON1", Toast.LENGTH_SHORT);
            toast.setGravity(Gravity.CENTER, 0,
0);                              //(WHAT PARAMETERS I SHOULD PASS
HERE)
                 //
toast.setGravity(button1.getGravity(),button1.getBottom(),button1.getHe‌​
ight()); (I HAVE TRIED THIS ALSO BUT ...)
            LinearLayout toastView = (LinearLayout) toast.getView();
            ImageView imageCodeProject = new
ImageView(getApplicationContext());
            imageCodeProject.setImageResource(R.drawable.b_1);
            toastView.addView(imageCodeProject, 0);
            toast.show();
        }
    });

If there is any other way then let me know.

KINdLY HELP.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to