We provide complete mobile and web apps development solutions

Sunday, February 24, 2013

HttpClient post in Android

To post the data to the server, to get the data from the server which is stored in remote database, we can use HttpClient for webservice requests.
 call HttpClient ,
HttpClient  client = new DefaultHttpClient();
Here is the example for HttpClient for posting the data, getting response from the server.

public class MainActivity extends Activity {
    TextView tv;
    String text;
    Button b;
    DefaultHttpClient client; 
    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    tv     = (TextView)findViewById(R.id.textView1);
     text     = "";
    }
     public void callWebService(View webService)
    {
      try {
            postData();
        } catch (JSONException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
           }
  public void postData() throws JSONException{ 
        // Create a new HttpClient and Post Header
        client = new DefaultHttpClient();
        HttpPost httppost = new HttpPost("http://192.168.0.1:8080/webservice/latest");        
        JSONObject json= new JSONObject();
           try {
            // JSON data:
                json.put("datapost",subJSON);
         StringEntity entity = new StringEntity(mainJSON.toString(), HTTP.UTF_8);
            httppost.setHeader("Content-Type","application/json");
            httppost.setEntity(entity);
            // Execute HTTP Post Request
            System.out.print(json);
            Log.e("tag", text);
            HttpResponse response = client.execute(httppost,localContext);
                      // for JSON:
            if(response != null)
            {
                InputStream is = response.getEntity().getContent();

                BufferedReader reader = new BufferedReader(new InputStreamReader(is));
                StringBuilder sb = new StringBuilder();

                String line = null;
                try {
                    while ((line = reader.readLine()) != null) {
                        sb.append(line + "\n");
                    }
                } catch (IOException e) {
                    e.printStackTrace();
                } finally {
                    try {
                        is.close();
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                }
                text = sb.toString();
            }
            tv.setText(text);
 }catch (ClientProtocolException e) {
            // TODO Auto-generated catch block
        } catch (IOException e) {
            // TODO Auto-generated catch block
        }
    }

Wednesday, February 20, 2013

Android Developers -Freshers and Experienced




Picon Infotech Pvt Ltd            0-2 yrs            Android developer                   Click here to apply

OKIT Pvt Ltd                               0-2 yrs               Android Developer                    Click here to apply

 Smart Utility Systems           0-1 yr                Android Developer                 Click here to apply

Pennywise software               0-2 yrs               Android Developer                  Click here to apply 

Multiplex Systems Private Limited               Iphone Developer                      Click here to apply

 

 









HP hiring Software developers (freshers)

Qualifications:


Bachelors or Masters degree in Cse, It



Experience:



0-2 yrs


Skills:


Good analytical and problem solving skills.

Good knowledge of design of software applications.

Good communication skills.


Primary Location: 


Bangalore

MAQ hiring software engineers

Job location: Mumbai, Hyderabad

Position: Software Engineer

Experience:  Freshers (0 to 1 yr)

Event date: 09 march 2013

Eligibility:

2012 batch Btech

Graduates with PH score

Job Description:

Web app development using C#, SharePoint, Microsoft SQL Server,

XML Webservices

Business Intelligent app testing


Click here to apply


Dell India hiring freshers

Position:  Software Developer Analysts

Location:  Bangalore

Experience: Freshers

Job Code: 130004QE

Job Description:

To resolve Netcool Change requests
Obtain requirements from clients
delivering commited change requests with all quality.

Click here to apply

Wednesday, February 13, 2013

WebView in Android

WebView is a class which is an extention of View class. Using Webview, we can display webpages in the mobile browser.

To add webview to your application, declare internet permission in manifest file and add WebView to xml.
To load webpage in WebView, use loadUrl

WebView wb=(WebView)findViewById(R.id.webView1);
        wb.loadUrl("http://www.mobengineers.com");
      
You must enable javascript in your webview to load javascript in the page.

To bind interface between Javascript code and android code, then use
        webview.addJavascriptInterface(new WebAppInterface(this), "Android");

To store user data in the browser, we have to use cookies, so that the browser data it does not share.

android.webkit.CookieSyncManager  class to manage all cookies.
To use this, 1st create one instance,
cookieSyncManager.createInstance(context);
setup sync call
to start
cookieSyncManager.getInstance().startSync();
to stop
cookieSyncManager.getInstance().stopSync();
to get sync instantly,

cookieSyncManager.getInstance().Sync();

sample webview example here

package com.example.demo1;

public class MainActivity extends Activity {

    public class WebAppInterface { Context mContext;

    WebAppInterface(Context c) {
        mContext = c;
    }


    public void showToast(String toast) {
        Toast.makeText(mContext, toast, Toast.LENGTH_SHORT).show();
    }

}

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
       
        WebView wb=(WebView)findViewById(R.id.webView1);
        wb.loadUrl("http://www.mobengineers.com");
        WebSettings ws=wb.getSettings();
        ws.setJavaScriptEnabled(true);
       // wb.addJavascriptInterface(new WebAppInterface(this), "Android");
        wb.setWebViewClient(new WebViewClient());
       
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }
    private class MyWebViewClient extends WebViewClient {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            if (Uri.parse(url).getHost().equals("www.getnicejobs.com")) {
                return false;
            }
            Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
            startActivity(intent);
            return true;
        }


}
}

activity_main.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity" >

    <WebView
        android:id="@+id/webView1"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        />

</RelativeLayout>







Monday, February 11, 2013

Java Developers Jobs

Java Developers in MNC

experience: 2 yrs
 email your resumes to
karuna@sancrosoftusa.com



for more jobs apply here
http://www.sancrosoftusa.com/jobopenings.html

SancroSoft USA inc
4944 Sunrise Blvd, Suite B-4, Fair Oaks,
CA 95628,
Phone: 718-360-4561













InteractCRM  hiring Java Professionals

Job Dec:


Work in product devel team to build  Contact Center Solutions for our clients.
Deliver work  using OOAD methodologies , provide technical insights to the team.
Design, coding & testing of Modules and components assigned.


Desired Profile:




3 - 4 years hands on Java / J2EE & web services develop exp.
 exposure to all software development life cycle.
 analytical, logical & communication skills. email ur resumes to:
careers@interactcrm.com

Online Training

Your Name :
Your Email: (required)
Your Message: (required)

Powered by Blogger.

Recent Posts

Find Us On Facebook

Popular Posts