title: Is it possible Android applictaion development with Apache Thrift?
body: <p>I want to develop an android app which can communicate with my server which is developed using Apache thrift......how can I develop plz help me i'v write a code but it cannot run successfully....</p>
  
  <pre><code>import org.apache.thrift.protocol.TBinaryProtocol;
  import org.apache.thrift.protocol.TProtocol;
  import org.apache.thrift.transport.TSocket;
  import org.apache.thrift.transport.TTransport;
  
  import android.app.Activity;
  
  
  import android.os.Bundle;
  import android.widget.Toast;
  
  public class ThriftExampleActivity extends Activity {
      /** Called when the activity is first created. */
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
          try
          {&lt;br&gt;   //this code is used to cretae an client
              TTransport transport = new TSocket("107.20.177.28", 8888);
              transport.open();
              TProtocol protocol = new  TBinaryProtocol(transport);
              Mainservice.Client client = new Mainservice.Client(protocol);
              //upto this line is common code for client need not to touch
  
              //below call any API using client object created above
              //like I have call add API which take some input and return output
              System.out.println(client);
             Getsearch g=new Getsearch();
            g.rows="5";
             g.text="india";
             g.page=Integer.toString(2);
             Toast.makeText(getBaseContext(), client.get_search(g).toString(), &lt;br&gt;Toast.LENGTH_LONG).show();
             System.out.println(client.get_search(g));
              //System.out.println("The Sum is: "+sum);
  
              //close client socket
              transport.close();
          }
          catch(Exception e)
          {
              e.printStackTrace();
          }
      }
  }
  </code></pre>