Shalvin Interests

Saturday, April 30, 2016

Android with Android Studio


<?xml version="1.0" encoding="utf-8"?>
<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"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.example.administrator.myapplication.MainActivity">

    <Button
        android:layout_width="150dp"
        android:layout_height="150dp"
        android:text="New Button"
        android:textSize="40dp"
        android:id="@+id/button"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="223dp"
        android:onClick="Click"
        />
</RelativeLayout>p


package com.example.administrator.myapplication;

import android.app.Activity;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Button b=(Button)findViewById(R.id.button);
    }
    public void Click(View v)
    {
        Toast.makeText(this,"Toast",Toast.LENGTH_SHORT).show();
    }
}

Sunday, April 17, 2016

ExtJS 6 Getting Started


<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script src="ext-all.js"></script>
    <script type="text/javascript">
        Ext.define("MyApp.Session",
            {
                config: {
                    Name: '',
                    Specialization: ''
           }
           });

        var session = Ext.create("MyApp.Session",
            {});
        session.setName('Shalvin P D');
        session.setSpecialization('Microsoft .Net')
        alert(session.getName() + " - " + session.getSpecialization());
    </script>
</head>
<body>

Creating Component

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script src="ext-all.js"></script>
    <script type="text/javascript">
        var myComponent = Ext.create('Ext.Component', {
            html:'Hello World ExtJS Shalvin'
        });

        Ext.application({
            name: 'MyApp',
            launch:function()
            {
                Ext.create('Ext.container.Viewport', {
                    items: [
                        myComponent
                    ]
                });
            }
        });
    </script>
</head>
<body>

</body>
</html>



Data
<pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"><code>&lt;!DOCTYPE html&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;head&gt;
    &lt;title&gt;&lt;/title&gt;
    &lt;script src=&quot;ext-all.js&quot;&gt;&lt;/script&gt;
    &lt;script type=&quot;text/javascript&quot;&gt;
        Ext.application({
            name: 'MyApp',
            launch: function () {
                Ext.create('Ext.container.Viewport', {
                    items: [
                        {
                            padding: 40,
                            tpl: 'Trainer : {name} {location}',
                            data:{
                                name: 'Shalvin P D',
                                location:'Kochi'
                            }
                        }
                       
                    ]
                });
            }
        });
    &lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;

&lt;/body&gt;
&lt;/html&gt;


</code></pre>


Thursday, April 14, 2016

AngularJS with Asp .Net MVC


<script src="~/Scripts/angular.js"></script>

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Index</title>
</head>
<body ng-app>
    <div> 
        {{2 + 2}}
    </div>
</body>
</html>

Friday, April 8, 2016

Android Views

TextView

<TextView
    android:text="Shalvin P D 1!"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textSize="56sp"
    android:fontFamily="sans-serif-light"
    android:textColor="@android:color/black"
    android:background="#ccddff"
    android:padding="20dp"/>

LayoutView


<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:text="Shalvin P D 1!"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textSize="56sp"
    android:fontFamily="sans-serif-light"
    android:textColor="@android:color/black"
    android:background="#ccddff"
    android:padding="20dp"/>
    
     <TextView
    android:text="Shalvin P D 2!"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textSize="56sp"
    android:fontFamily="sans-serif-light"
    android:textColor="@android:color/black"
    android:background="#ccddff"
    android:padding="20dp"
   />
    
</LinearLayout>


RelativeLayour
<RelativeLayout 
   android:layout_width="match_parent"
    android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">

        <TextView android:text="Shalvin P D."
           android:layout_width="wrap_content"
           android:textColor="#555555"
            android:layout_height="wrap_content"
           android:layout_alignParentTop="true"
            android:textSize="30sp"/>

        <TextView android:text="Shalvin P D."
            android:layout_width="wrap_content"
            android:textColor="#555555"
            android:layout_alignParentBottom="true"
            android:layout_height="wrap_content"
            android:textSize="30sp"
            />

 </RelativeLayout>




Event Handling



<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
   android:orientation="vertical"
    tools:context="com.blogspot.shalvinpd.helloevents.MainActivity">

   

    <EditText
        android:id="@+id/etName"
        android:layout_width="wrap_content"
        android:layout_height="40sp" />
    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Hello"
        android:id="@+id/btnHello"
        android:onClick="btnHello_Click"
        android:layout_centerVertical="true"
        android:layout_toEndOf="@+id/textView" />


</LinearLayout>



public void btnHello_Click(View view)
    {
        EditText et = (EditText)(findViewById(R.id.etName));
        Toast.makeText(this, "Hello " + et.getText().toString(), Toast.LENGTH_SHORT).show();
    }