Twitter Facebook Delicious Digg Stumbleupon Favorites More

Sunday 29 July 2018

rate us button android code

try {
    startActivity(new Intent(Intent.ACTION_VIEW,
            Uri.parse("market://details?id=com.google.android.googlequicksearchbox")));
}catch (ActivityNotFoundException e)
{
    startActivity(new Intent(Intent.ACTION_VIEW,
            Uri.parse("https://play.google.com/store/apps/details?id=com.google.android.googlequicksearchbox")));
}
Share:

share button android studio

    i = new Intent(Intent.ACTION_SEND);
i.setType("text/plain");
String shareBody="Downdload Arti Sangrah Here";
String shareSub="Arti Sangrah";

                i.putExtra(Intent.EXTRA_SUBJECT,shareBody);
                i.putExtra(Intent.EXTRA_TEXT,shareSub);
                startActivity(Intent.createChooser(i,"SHARE USING"));
                break;
Share:

Friday 27 July 2018

read string value from resource

https://www.dev2qa.com/how-to-read-string-value-array-from-strings-xml-in-android/

<resources>

    <string name="button_show_selection">Show Selection</string>

    <string name="auto_complete_text_view_car">Input Favorite Car Name</string>

</resources>
String defaultInputText = getResources().getString(R.string.auto_complete_text_view_car);
  1. Define a string array in strings.xml use string-array xml element.
    <resources>
        <string name="button_show_selection">Show Selection</string>
    
        <string name="auto_complete_text_view_car">Input Favorite Car Name</string>
    
        <string-array name="car_array">
            <item>Audi</item>
            <item>BMW</item>
            <item>Benz</item>
            <item>Ford</item>
            <item>Toyota</item>
            <item>Tesla</item>
            <item>Honda</item>
            <item>Hyundai</item>
        </string-array>
    
    </resources>
  2. Read the string array in java source code. Please note car_array is just the string array name defined in strings.xml.
    String carArr[] = getResources().getStringArray(R.array.car_array);
Share:

intent data passing example


In your current Activity, create a new Intent:
String value="Hello world";
Intent i = new Intent(CurrentActivity.this, NewActivity.class);    
i.putExtra("key",value);
startActivity(i);
Then in the new Activity, retrieve those values:
Bundle extras = getIntent().getExtras();
if (extras != null) {
    String value = extras.getString("key");
    //The key argument here must match that used in the other activity
}
Share:

Thursday 26 July 2018

Arti App


  • xml file 
  • <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        tools:context=".MainActivity">
    
        <ScrollView
            android:layout_width="match_parent"
            android:layout_height="match_parent">
    
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical">
    
                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="240dp"
                    android:background="@drawable/banner"
                    android:gravity="bottom"
                    android:textAlignment="center" />
    <!--FIRST ROW START     FIRST ROW START             FIRST ROW START                FIRST ROW START                    FIRST ROW START               FIRST ROW START           -->
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal"
                    android:weightSum="3">
    
                    <LinearLayout
                        android:id="@+id/one"
                        android:layout_width="0dp"
                        android:layout_height="120dp"
                        android:layout_margin="2dp"
                        android:layout_weight="1"
                        android:background="@color/colorGrapeFruit"
                        android:orientation="vertical">
    
                        <ImageView
                            android:layout_width="60dp"
                            android:layout_height="60dp"
                            android:layout_gravity="center"
                            android:layout_marginTop="20dp"
                            android:src="@drawable/tt"
                            android:tint="@color/colorWhite" />
    ye dusre type ke image ke liye
                        <TextView
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            android:background="@color/colorGrapeFruitDark"
                            android:padding="8dp"
                            android:text="Durga ji"
                            android:textAlignment="center"
                            android:textColor="@color/colorWhite"
                            android:textSize="18dp" />
                    </LinearLayout>
                    <!--sec-->
                    <LinearLayout
                        android:id="@+id/two"
                        android:layout_width="0dp"
                        android:layout_height="120dp"
                        android:layout_margin="2dp"
                        android:layout_weight="1"
                        android:background="@color/colorBitterSweet"
                        android:orientation="vertical">
    
                        <ImageView
                            android:layout_width="30dp"
                            android:layout_height="30dp"
                            android:layout_gravity="center"
                            android:layout_marginTop="20dp"
                            android:src="@drawable/ic_77_essential_icons_diary"
                            android:tint="@color/colorWhite"
                            />
    
                        <TextView
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            android:layout_marginTop="30dp"
                            android:background="@color/colorBitterSweetDark"
                            android:padding="8dp"
                            android:text="Ganesh ji marathoi"
                            android:textAlignment="center"
                            android:textColor="@color/colorWhite"
                            android:textSize="18dp" />
                    </LinearLayout>
    
    <!--comp-->
    
                    <!--THIRD-->
                    <LinearLayout
                        android:id="@+id/three"
                        android:layout_width="0dp"
                        android:layout_height="120dp"
                        android:layout_margin="2dp"
                        android:layout_weight="1"
                        android:background="@color/colorFlower"
                        android:orientation="vertical">
    
                        <ImageView
                            android:layout_width="30dp"
                            android:layout_height="30dp"
                            android:layout_gravity="center"
                            android:layout_marginTop="20dp"
                            android:src="@drawable/ic_77_essential_icons_credit_card"
                            android:tint="@color/colorWhite"
                            />
    
                        <TextView
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            android:layout_marginTop="30dp"
                            android:background="@color/colorFlowerDark"
                            android:padding="8dp"
                            android:text="karpur gavram"
                            android:textAlignment="center"
                            android:textColor="@color/colorWhite"
                            android:textSize="18dp" />
                    </LinearLayout>
  • colour <?xml version="1.0" encoding="utf-8"?>
    <resources>
        <color name="colorPrimary">#dd3333</color>
        <color name="colorPrimaryDark">#d11616</color>
        <color name="colorAccent">#ff4081</color>
        <color name="colorWhite">#FFFFFF</color>
        <color name="colorGrapeFruit">#ed5565</color>
        <color name="colorGrapeFruitDark">#da4453</color>
        <color name="colorBitterSweet">#fc6e51</color>
        <color name="colorBitterSweetDark">#e9573f</color>
        <color name="colorFlower">#ffce54</color>
        <color name="colorFlowerDark">#f68b42</color>
        <color name="colorGrass">#A0D468</color>
        <color name="colorGrassDark">#8CC152</color>
        <color name="colorBlueJeans">#509CEC</color>
        <color name="colorBlueJeansDark">#4A89DC</color>
        <color name="colorLavander">#ac92ec</color>
        <color name="colorLavanderDark">#967adc</color>
        <color name="colorMint">#48cfad</color>
        <color name="colorMintDark">#37bc9b</color>
        <color name="colorAqua">#4fc1e9</color>
        <color name="colorAquaDark">#3bafda</color>
        <color name="colorPinkRose">#EC87C0</color>
        <color name="colorPinkRoseDark">#D770AD</color>
    </resources>
  • 3
Share:

Tuesday 24 July 2018

colour code

<color name="colorPrimary">#dd3333</color>
<color name="colorPrimaryDark">#d11616</color>
<color name="colorAccent">#FF4081</color>
<color name="colorWhite">#FFFFFF</color>
<color name="colorGrapeFruit">#ED5565</color>
<color name="colorGrapeFruitDark">#DA4453</color>
<color name="colorBitterSweet">#FC6E51</color>
<color name="colorBitterSweetDark">#E9573F</color>
<color name="colorFlower">#FFCE54</color>
<color name="colorFlowerDark">#F68B42</color>
<color name="colorGrass">#A0D468</color>
<color name="colorGrassDark">#8CC152</color>
<color name="colorBlueJeans">#509CEC</color>
<color name="colorBlueJeansDark">#4A89DC</color>
<color name="colorLavander">#AC92EC</color>
<color name="colorLavanderDark">#967ADC</color>
<color name="colorMint">#48CFAD</color>
<color name="colorMintDark">#37BC9B</color>
<color name="colorAqua">#4FC1E9</color>
<color name="colorAquaDark">#3BAFDA</color>
<color name="colorPinkRose">#EC87C0</color>
<color name="colorPinkRoseDark">#D770AD</color>
Share:

best design android


Share:

Sunday 22 July 2018

kotlin do while loop


  • fun main(args:Array<String>)
    {
        var counter=0    do {
    
                println("hey")
            counter ++
    
        }
        while (counter<=5)
    
    }
  • OUTPUT 
  • hey
  • hey
  • hey
  • hey
  • hey
  • hey
Share:

kotlin while loop



fun main(args:Array<String>)
{
    var counter =0    while (counter<=5)
    {
        println("counting ...$counter")
        counter++ // counter counter+1    }
    println("out of loop")
}
  • counting ...0
  • counting ...1
  • counting ...2
  • counting ...3
  • counting ...4
  • counting ...5
  • out of loop
Share:

kotlin for loop

fun main(args:Array<String>)
{
    for (item in 1..5)
    {
        println("hey theree $item")
    }
}
  • OUTPUT  
  • hey theree 1
  • hey theree 2
  • hey theree 3
  • hey theree 4
  • hey theree 5
  • fun main(args:Array<String>)
    {
        for (item in 0..6)
        {
            if (item % 2 ==0)
            {//if the no is divisible by 2 or multiple of 2            println(" $item  is multiple  of $item   fizz")
            }
            else if(item%3==0)
            {
                println("buzz")
            }
    
    
    
        }
    }
  • OUTPUT 
  •  0  is multiple  of 0   fizz
  •  2  is multiple  of 2   fizz
  • buzz
  •  4  is multiple  of 4   fizz
  •  6  is multiple  of 6   fizz

          Share:

          kotlin when using read line



          fun main(args:Array<String>)
          {
              println("ENTER A NO BETWEEN 1 - 10")
              var enterno= readLine()!!.toInt()
              when(enterno)
              {
                  1-> println("WRONG NO 1")
                  2-> println("GET CLOSE 2")
                  3-> println("CLOSER 3" )
                  4-> println("HMM 4 ")
                  5-> println("GOOD 5")
                  else->{
                      println("sorry you lost")
              }
          
          
          }
          }
          • OUTPUT
          • ENTER A NO BETWEEN 1 - 10
          • 2
          • GET CLOSE 2

          • Process finished with exit code 0
          Share:

          kotlin when

          fun main(args:Array<String>)
          {
              var age:Int=19    age=16    when(age)
              {
                  17-> println("17")
                  18-> println("18")
                  19-> println("yep 19")
                  else ->
                  {
                     println("none of the above")
                  }
              }
          }
          • OUTPUT none of the above
          • 2
          Share:

          Friday 20 July 2018

          kotlin if else statement

          
          fun main(args:Array<String>)
          {
              var firstno=8    var secno=3
             if (firstno>secno)
             {
                 println("yes first no $firstno  is graater that $secno")
             }
              else   {
                 println("yes")
             }
          }
          • OUTPUT >>> yes first no 8  is graater that 3
          Share:

          kotlin conditional operator

          fun main(args:Array<String>)
          {
             val firstno=5    val secondno=6
          
              println(firstno>secondno) //return a boolear true or false
              println(firstno<secondno)
          
              println(firstno==secondno)
              println(firstno!=secondno)
              println(firstno<=secondno)
              println(firstno>=secondno)
          
          
          }
          • OUTPUT >> 
          • false
          • true
          • false
          • true
          • true
          • false
          Share:

          KOTLIN CONVERTING DATA TYPE

          fun main(args:Array<String>)
          {
              var age:Int=3
              var bloodpressure=89.0
              age=bloodpressure.toInt()
              println(age)
          }
          • OUTPUT >>> 89
          Share:

          kotline increament and decrement operator

          fun main(args:Array<String>)
          {
              var firstno=8    var secno=3
              var incre=firstno+1    var dec=firstno-1          println(incre)
              println(++firstno)
          
              println(dec)
              println(--firstno)
          }
          • OUTPUT >> 
          • 9
          • 9
          • 7
          • 8
          Share:

          kotline remainder

          fun main(args:Array<String>)
          {
              var firstno=8    var secno=3    var result:Int?
              result=firstno%secno
              println("THE RESULT  IS $result")
          
              //or    println("THE RESULT IS ${firstno % secno }")
          }
          • THE RESULT  IS 2
          • THE RESULT IS 2
          Share:

          kotlin division


          • fun main(args:Array<String>)
            {
                var firstno=2    var secno=2    var result:Int?
                result=firstno/secno
                println("THE RESULT  IS $result")
            
                //or    println("THE RESULT IS ${firstno / secno }")
            }
          • THE RESULT  IS 1
          • THE RESULT IS 1

          • Process finished with exit code 0
          Share:

          Search This Blog

          Popular Posts

          Pages

          how to make crores from 1 lakh in stock markets in 1 year

          how to make crores from 1 lakh in stock markets in 1 year

          Blogger Tutorials

          Blogger Templates

          Sample Text

          Copyright © ANDROID TUTORIAL CODE | Powered by Blogger
          Design by SimpleWpThemes | Blogger Theme by NewBloggerThemes.com & Distributed By Protemplateslab