Wednesday, May 8, 2013

Image WML

<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">

<wml>

<card id="card1" title="Title">
<p>
<small>Good Morning!Aurangabad!!</small>
</p>
<p>
<img src="img1.wbmp" hspace="10%" vspace="60%" width="40%" height="40%" align="top" alt="Error in Image Loading..."/>
<img src="imag2.wbmp" hspace="10%" vspace="60%" width="40%" height="40%" align="top" alt="Error in Image Loading..."/>today's weather is some what cool!!
</p>
</card>

</wml> 

Login Form 2

<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN" "http://www.wapforum.org/DTD/wml13.dtd">

<wml>
  <card id="card1" title="WML Form">
    <p>
      User name:<br/>
      <input name="myUserName"/><br/>

      Password:<br/>
      <input name="myPassword" type="password"/><br/><br/>

      <anchor>
        <go method="get" href="resetButtonsProc.asp">
          <postfield name="name" value="$(myUserName)"/>
          <postfield name="password" value="$(myPassword)"/>
        </go>
        Submit Data
      </anchor><br/>

      <anchor>
        <refresh>
          <setvar name="myUserName" value=""/>
          <setvar name="myPassword" value=""/>
        </refresh>
        Reset Form
      </anchor>
    </p>
  </card>
</wml>

If else android

1)

<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.WAPforum.org/DTD/wml_1.1.xml">
<wml>

<card id="card1">
   <p>
   if else example
   </p>
   <do type="accept">
      <go href="IfElseExample.wmls#findifelse()" />
   </do>
</card>

<card id="card2">
<p>
   rand is $(str)
</p>
</card>

</wml>

2)
extern function findifelse()
{
   var str;
   var rand = Lang.random(10000);
   if(rand < 5000)
   {
      str = "less than 5000";
   }
   else
   {
      str = "NOT less than 5000";
   }
   WMLBrowser.setVar("str", str);
   WMLBrowser.go("IfElseExample.wml#card2");
};

10th prac android

TenthActivity.java

package a.b;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class TenthActivity extends Activity implements OnClickListener{
    /** Called when the activity is first created. */
Button b1;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
       
        b1 = (Button) findViewById(R.id.button1);
b1.setOnClickListener(this);
    }
   
    public void onClick(View v) {
Intent it = new Intent(this,tenthActivity1.class);
startActivity(it);

    }
}


tenthActivity1.java
package a.b;

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

public class tenthActivity1 extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main2);
    }
}

Browser 9th

NinthActivity.java
package a.b;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Button;
import android.net.Uri;
import android.view.View;
import android.view.View.OnClickListener;

public class NinthActivity extends Activity implements OnClickListener {
Button b1;
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        b1 = (Button) findViewById(R.id.button1);
b1.setOnClickListener(this);
    }
   
    public void onClick(View v) {
Intent it = new Intent(Intent.ACTION_VIEW,
Uri.parse("http://www.google.com"));
startActivity(it);
}
}

Main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/hello" />

    <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Button" />

</LinearLayout>

Main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/hello" />


    <Button
        android:id="@+id/button1"
        android:layout_width="286dp"
        android:layout_height="wrap_content"
        android:text="Click Me!" />
   

</LinearLayout>

Main2.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Second"
        android:textAppearance="?android:attr/textAppearanceLarge" />

</LinearLayout>

One activity to another android

Main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="I&apos;m screen 1 (main.xml)"
android:textAppearance="?android:attr/textAppearanceLarge" />
 <Button
android:id="@+id/button1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Click me to another screen" />
</LinearLayout>



Main2.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="I&apos;m screen 2 (main2.xml)"
android:textAppearance="?android:attr/textAppearanceLarge" />
</LinearLayout>

AppActivity.java

package com.mkyong.android;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Button;
import android.view.View;
import android.view.View.OnClickListener;
public class AppActivity extends Activity {
Button button;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
addListenerOnButton();
}
public void addListenerOnButton() {
final Context context = this;
button = (Button) findViewById(R.id.button1);
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
Intent intent = new Intent(context, App2Activity.class);
startActivity(intent);  
}
});
}
}

AppActivity2.java

package com.mkyong.android;
import android.app.Activity;
import android.os.Bundle;
import android.widget.Button;
public class App2Activity extends Activity {
Button button;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main2);
}
}

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mkyong.android"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="10" />

<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:label="@string/app_name"
android:name=".AppActivity" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:label="@string/app_name"
android:name=".App2Activity" >
</activity>
</application>
</manifest>

Hello World Android

EightActivity.java
package a.b;

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

public class EightActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }
}


Main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/hello" />


    <Button
        android:id="@+id/button1"
        android:layout_width="290dp"
        android:layout_height="wrap_content"
        android:text="Hello!!" />

</LinearLayout>

Factorial

Fact.Wml:-
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">

<wml>

<card id="card1" title="Title">
<p>
<a href="factorial.wmls#factrl(4)">Factorial</a><br/>
$(fact1)
</p>
</card>

</wml>


Factorial.wmls:-
extern function factrl(num)
{
if(num==0)
WMLBrowser.setVar("fact1","1");
if(num>0)
{
var i=1;
var fact=1;
while(i<=num)
{
fact=fact*i;
i++;
}
WMLBrowser.setVar("fact1",fact);
WMLBrowser.refresh();
}
}

the assignment (one card to another)

<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">

<wml>

<card id="card1" title="Title">
<p>
here we are performing assignment
<do type="accept" label="Next Card">
<go href="#card2"/>
</do>

</p>
</card>

<card id="card2" title="Tit">
<p>
practical 1
<i>hello</i>


wap is wireless Application Protocol, a set of protocols for connecting cellular phones and other radio devices to the Internet.

<do type="accept" label="Next Card">
<go href="#card3"/>
</do>
</p>

</card>


   <card id="card3" title="Table">
<p>
<b>exp 2</b>

 


  <table columns="2">
     <tr>
   <td>elements</td>
    <td>explain</td>
    </tr>
   <tr>
    <td>i</td>
    <td>display char in italic</td>
     </tr>
      <tr>
      <td>b</td>
  <td>makes bold</td>
   </tr>
    </table>

<do type="accept" label="Next Card">
<go href="#card4"/>
</do>
   </p>
</card>

 <card id="card4" title="Table">
<p>

<img src="/D:/kamal/sasu.wbmp" alt="re" align="top"/>
<b> tag used:</b>
src:used to add path of image
<a href="a.wml"></a>
</p>

</card>
</wml>
<?xml version="1.0"?>

Anchor tag


<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
 <card id="card1" title="Title">
<p>
<a href="hello.wml">Next</a>
<anchor>
   <go href="hello.wml"/>
</anchor>
</p>
<p>
<anchor><prev/></anchor>
</p>
<p>
<anchor><refresh/></anchor>
</p>
</card>
 </wml>

Table - WML

seconds
<?xml version="1.0"?>
<!DOCTYPwmlPUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
 <wml>
 <card id="card1" title="Title">
<p>
    <table columns="3">
       <tr>
        <td>Sr.no</td><td>Name</td><td>roll no</td>
     </tr>
      <tr>
          <td>1</td><td>abc</td><td>10</td>
       </tr>
       <tr>
          <td>2</td><td>xyz</td><td>20</td>
       </tr>
       <tr>
          <td>3</td><td>mnp</td><td>30</td>
       </tr>
      </table>
     </p>
</card>
</wml>

Formatting text WML

<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
 <wml>
 <card id="card1" title="Title">
<p>  <strong>Hello World!!!</strong>
          <em>Hello MIT</em>
         <b>Hello MIT</b>
         <i>Hello MIT</i>
      <u>Hello MIT</u>
          <big>Hello MIT</big>
             <small>Hello MIT</small>
   </p>
</card>
 </wml>

Hello - WML

<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">

<wml>

<card id="card1" title="Title">


<p>  <strong>Hello World!!!</strong><br/>
          <em>Hello MIT</em><br/>
         <b>Hello MIT</b><br/>
         <i>Hello MIT</i>
        <u>Hello MIT</u>
          <big>Hello MIT</big>
             <small>Hello MIT</small>
   </p>
</card>

</wml>