Skip to main content

Posts

Showing posts with the label manifest

How to align your TabHost at the bottom of the screen

There is a simplest way to align Tabbar at the bottom of the page. The code is given below copy and download the code and try it... In the previous example we learned a simple example to add Tabs to our application.Only a small change can give you tabs at the bottom of the page. In the previous example the xml was like this... <TabHost xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@android:id/tabhost" android:layout_width="fill_parent" android:layout_height="fill_parent" tools:context=".MainActivity" > <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <TabWidget android:id="@android:id/tabs" android:layout_width="fill_parent" ...

Change Tabbar Text (title) dynamically in Android - a simple example

Changing title of tabbar is bit easier in android Copy and download the code below and try it.... Basic tabbar tutorials see here... import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.TabHost; import android.widget.TabHost.TabSpec; import android.widget.TabWidget; import android.widget.TextView; import android.app.TabActivity; import android.content.Intent; public class MainActivity extends TabActivity { TabWidget tw; TabHost tabHost; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); /** TabHost will have Tabs */ tabHost = (TabHost)findViewById(android.R.id.tabhost); TabSpec firstTabSpec = tabHost.newTabSpec("tab_id1"); TabSpec secondTabSpec = tabHost.newTabSpec("tab_id2"); TabSpec thirdTabSpec = tabHost.newTabSpec("tab_id3"); ...

Using TabHost to create a simple Tabbar application - An Android Example

For creating a tabbar application first create a tabhost object to create tabs In activity_main.xml we create TabHost and specify a layout where we are going to insert the tabs. Copy and download the code and try it yourself.... Now we are going to create three tabs. Lets us now first make the xml for it activity_main.xml : TabHost provided flexibility of managing data in different views by providing tabbed interface(compared to TabLayout). TabHost basically a container, where you need to put tab widget, which will host tabbed interface and FrameLayout, within which the different views are presented. TabHost ( main container of tab view ) TabWidget ( used to navigate between tabs ) FrameLayout ( for tab content ) <TabHost xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@android:id/tabhost" android:layout_width="fill_parent" android:l...

Android Application Fundamentals or Components

See more basics on Android along with interview questions Android is written in java programming language.Android application are composed of some of the main components such as: Activities Services Content providers Broadcast receivers Intents, Resources(such as strings and graphics), Notification signalings(light,sound,dialog), are also part of the components. All these components play different role in the overall application and each one can be activated individually. Activities :           An activity represents a single screen with a user interface.Suppose if there is a listview and if clicking on each row it traverse to another page ,then the screen showing listview is an activity and the next page is another activity,where each one is independent of the others. An activity is implemented as a subclass of Activity ,that why we use see activity life cycle here : public class MainActivity extends Activity { } ...

Broadcast Receiver Introduction in Android

A broadcast receiver is a component that responds to system-wide broadcast announcements. Many broadcasts originate from the system—for example, a broadcast announcing that the screen has turned off, the battery is low, or a picture was captured. There are two ways to use broad cast receiver in android -- One is using dynamically in activity Second to register through manifest Using dynamically in activity Register broadcast receiver Via dynamically ( Run time ) // Create reciever object private BroadcastReceiver the_receiver = new PhoneCall(); // Set When broadcast event will fire. private IntentFilter filter = new IntentFilter(Intent.ACTION_CONFIGURATION_CHANGED); // Register new broadcast receiver this.registerReceiver(the_receiver, filter); // Reciever class which extends BroadcastReceiver public class PhoneCall extends BroadcastReceiver { public void onReceive(Context context, Intent intent) { // Phone call state change then this method will au...

TextView with link in ANDROID…….

in java class: import android.app.Activity; import android.os.Bundle; import android.text.Html; import android.text.method.LinkMovementMethod; import android.widget.TextView; public class TextViewLinkDemo extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); TextView tv = (TextView) findViewById(R.id.tv); tv.setText( Html.fromHtml(" This is a textView with a link " +" AngelMark Blog " + "created in the Java source code using HTML.")); tv.setMovementMethod(LinkMovementMethod.getInstance()); } } main.xml: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width=...