View in multiple XML files

by Vaibhav Gathibandhe » Sat, 13 Sep 2008 19:46:31 GMT


Sponsored Links
 Hello all,

Is there any way I can put a large view in multiple XML files.

For example, If i have a view consist of TableLayout and under it I have 6
table rows. Those table rows consist of text view, buttons etc.
The first 2 rows are static, i.e. I always show them in this activity.
But I do want to select 2-3 table rows from remaining four table rows,
depending upon some conditions.

I see there is a addContentView() method for such conditions. But then I
have to program my table rows rather than using XML.

So, it is possible that I define those 4 table rows in separate XML files
and just grab the ones that I need at runtime and add to TableLayout.

Please let me know if I am not clear enough.

Thanks in advance.
Vaibhav

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



View in multiple XML files

by Romain Guy » Sat, 13 Sep 2008 19:52:14 GMT


 Yes, just put that view in a separate XML file and use the tag
<include layout="@layout/my_table" /> to include it.

On Sat, Sep 13, 2008 at 11:37 AM, Vaibhav Gathibandhe





-- 
Romain Guy
www.curious-creature.org

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


Sponsored Links


Other Threads

1. Using KSoap2 with VB.Net webservice

Hello All,
I am having some serious difficulty using KSoap2 to connect to a
VB.Net webservice and am hoping I could get some help from someone who
is smarter than me. I have been trying to work this out for 2 weeks
with no luck.


So this is my problem. Using KSoap2 on the Android platform I have
successfully queried a super simple web service that I created using
vb.net (It can be found at 
http://gershwinsolutions.ftpaccess.cc/2dowebservice.asmx)
I receive a XML result which looks quite reasonable to me.

ReturnCustomerObject2Response{
ReturnCustomerObject2Result=anyType{CustomerID=1; FirstName=This is a
test; };
}


However at the point where I try to cast the object I am returning
from the webservice into a KvmSerializable object (as required by
KSoap2) I receive a java.lang.ClassCastException.


This is my object (I have excluded imports for brevity):

public class Customer extends BaseObject {

        private int m_CustomerID;
        private String m_FirstName;
        public static Class<? extends Customer> Customer_CLASS = new Customer
().getClass();



        public void setCustomerID(int CustomerID) {
                m_CustomerID = CustomerID;
        }
        public int getCustomerID() {
                return m_CustomerID;
        }
        public void setFirstName(String FirstName) {
                m_FirstName = FirstName;
        }
        public String getFirstName() {
                return m_FirstName;
        }


    public void getPropertyInfo(int index, Hashtable properties,
PropertyInfo info) {
        switch (index)
        {
        case 0:
            info.type = PropertyInfo.INTEGER_CLASS;
            info.name = "CustomerID";
            break;
        case 1:
            info.type = PropertyInfo.STRING_CLASS;
            info.name = "FirstName";
            break;
        default:
            break;

        }
    }


        @Override
        public Object getProperty(int index)
    {
                switch (index) {
        case 0:
            return m_CustomerID;
        case 1:
            return m_FirstName;
        default:
            return null;
        }
    }

        @Override
    public int getPropertyCount() {
        return 2;
    }


        @Override
        public void setProperty(int index, Object value) {

                switch (index) {
        case 0:
            m_CustomerID = Integer.parseInt(value.toString());
            break;
        case 1:
                 m_FirstName = value.toString();
             break;
        default:
            break;
        }

        }
}


private static final String SOAP_ACTION = "http://tempuri.org/
ReturnCustomerObject2";
private static final String METHOD_NAME = "ReturnCustomerObject2";
private static final String NAMESPACE = "http://tempuri.org/";
private static final String URL = "http://
10.0.2.2/2DoWebService.asmx";

public Boolean ExecuteSoapAction() {
        SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope
(SoapEnvelope.VER11);
        envelope.encodingStyle = SoapSerializationEnvelope.XSD;
        envelope.setOutputSoapObject(request);
        envelope.addMapping("http://tempuri.org/ReturnCustomerObject2",
"ReturnCustomerObject2", new Customer().getClass());

        envelope.dotNet = true;

        Customer Cust = new Customer();

        HttpTransportSE HttpTransport = new HttpTransportSE(URL);
        HttpTransport.debug = true;
        try {
                HttpTransport.call(SOAP_ACTION, envelope);
//HERE IS WHERE IT ALL GOES HORRIBLY WRONG!!
                Cust = (Customer) envelope.getResponse();
        }
        catch (Exception ex) {
                ex.printStackTrace();
        }
        return false;
    }

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

2. Zeroconf AP

Hi Group,

I am surprised to see that the Android doesn't yet have a zeroconf
stack as part of its API. Zeroconf allows you to find services (eg Web
Servers, Instant Messaging peers, SIP) on a given network with minimal
effort, something a mobile device going to new places I would envisage
doing alot.

Obvious starting points could be Avahi (as found in most major linux
distributions and jmdns). Apple also have the open source
mDNSResponder. (zeroconf is found on the iPhone under the name
Bonjour).

For more information see: http://www.zeroconf.org.

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

3. How can I call methods in Activity from an event listener of a custom Adapter?

4. device to device broadcasts possible via wi-fi?

5. CHEAP MONCLER JACKET, GSTAR JEANS, COOGI JEANS, EVISU JEANS, POLO T-SHIRT, ARMANI...

6. question about orientation sensor

7. is an AppWidget Configuration Activity required?