Saturday, 2 June 2012

access facebook and google using intenttab

access facebook and google using intent tab



Here is a good example for how to access Facebook or Google using intent tab,here we simply uses the intent concept.it a simple example  for beginners.


class PeeractivityActivity.java



package a.b;

import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TabHost;

public class PeeractivityActivity extends TabActivity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        TabHost host=getTabHost();
        host.addTab(host.newTabSpec("one").setIndicator("facebook").setContent(new Intent(this, facebook.class)));
        host.addTab(host.newTabSpec("two").setIndicator("google").setContent(new Intent(this, google.class)));
    }


}

facebook .java



package a.b;


import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebView;

public class facebook extends Activity {
WebView browser;

@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);

browser=new WebView(this);
setContentView(browser);
browser.loadUrl("http://www.facebook.com/");
}
}


google.java




package a.b;
import android.app.Activity;

import android.os.Bundle;

import android.webkit.WebView;

public class google extends Activity {
WebView browser;

@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);

browser=new WebView(this);
setContentView(browser);
browser.loadUrl("https://www.google.co.in/");
}
}

No comments:

Post a Comment