Friday 11 September 2020

How to hide action bar for fragment?

 How can I hide action bar for certain fragment?

Please try this code


@Override

public void onResume() {
super.onResume();
((AppCompatActivity)getActivity()).getSupportActionBar().hide();
}
@Override
public void onStop() {
super.onStop();
((AppCompatActivity)getActivity()).getSupportActionBar().show();
}



Wednesday 6 May 2020

radio button in android studio

                     Multi radio button in android studio with example 

                   <LinearLayout
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:orientation="vertical">

                             <TextView
                              android:layout_width="match_parent"
                               android:layout_height="wrap_content"
                               android:layout_gravity="center"
                                android:textSize="@dimen/_16sdp"
                                android:textStyle="bold"
                                android:textColor="@color/colorPrimary"
                                android:text="Who are you here to see today?" />


                            <RadioGroup
                                android:layout_marginTop="@dimen/_10sdp"
                                android:id="@+id/radioGroup"
                                android:layout_width="fill_parent"
                                android:layout_height="wrap_content"
                                android:orientation="horizontal">

                                <RadioButton
                                    android:id="@+id/radioButton1"
                                    android:layout_width="wrap_content"
                                    android:layout_height="wrap_content"
                                    android:text="Dr. "
                                    android:textSize="18sp"/>

                                <RadioButton
                                    android:id="@+id/radioButton2"
                                    android:layout_width="wrap_content"
                                    android:layout_height="wrap_content"
                                    android:text=" Therapist."
                                    android:textSize="18sp"/>

                                <RadioButton
                                    android:id="@+id/radioButton3"
                                    android:layout_width="wrap_content"
                                    android:layout_height="wrap_content"
                                    android:text=" Or Both"
                                    android:textSize="18sp"/>
                            </RadioGroup>

                            </LinearLayout>

Android Time Picker Dialog with example

IN XML FILE

<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:background="@color/white"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".LoginActivity">

<TextView
android:id="@+id/pickuptime"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/_10sdp"
android:background="@drawable/gray_corner"
android:drawableLeft="@drawable/ic_access_time_black_24dp"
android:drawablePadding="@dimen/_10sdp"
android:focusable="true"
android:hint="time"
android:inputType="textEmailAddress"
android:isScrollContainer="true"
android:overScrollMode="always"
android:padding="@dimen/_10sdp"
android:scrollbarStyle="insideInset"
android:scrollbars="vertical"
android:singleLine="false"
android:windowSoftInputMode="stateAlwaysVisible">
</TextView>
</LinearLayout>

In JAVA FILE


public class LoginActivity extends AppCompatActivity {
    TextView btn_login;
    TextView btnDate;
    TextView pickuptime;
    private int Year, Month, Day, mHour, mMinute;
    DatePickerDialog datePickerDialog;
    Calendar calendar;

    @Override    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);
        btn_login= findViewById(R.id.btn_login);
        pickuptime = findViewById(R.id.pickuptime);


pickuptime.setOnClickListener(new View.OnClickListener() {
    @Override    public void onClick(View v) {

        final java.util.Calendar c = java.util.Calendar.getInstance();
        mHour = c.get(java.util.Calendar.HOUR_OF_DAY);
        mMinute = c.get(java.util.Calendar.MINUTE);
 TimePickerDialog timePickerDialog = new TimePickerDialog(LoginActivity.this,
                new TimePickerDialog.OnTimeSetListener() {

                    @Override                    
public void onTimeSet(TimePicker view, int hourOfDay,
                                          int minute) {
                        //mStr_pickup_time= hourOfDay + ":" + minute;
pickuptime.setText(hourOfDay + ":" + minute);
                    }
                }, mHour, mMinute, false);
        timePickerDialog.show();

    }
});

Android Date Time Picker Dialog with example

Android Date Time Picker Dialog Project Code


create xml file in android studio 

for example : LoginActivity


<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:background="@color/white"    
android:layout_height="match_parent"    
android:orientation="vertical"    
tools:context=".LoginActivity">






<TextView    
android:id="@+id/btnDate"
android:layout_width="match_parent" 
android:layout_height="wrap_content"    
android:layout_marginTop="@dimen/_10sdp"    
android:background="@drawable/gray_corner"    
android:drawableLeft="@drawable/ic_date"    
android:drawablePadding="@dimen/_10sdp"    
android:focusable="true"    
android:hint="Date of Birth"    
android:inputType="textEmailAddress"    
android:isScrollContainer="true"    
android:overScrollMode="always"
android:padding="@dimen/_10sdp"    
android:scrollbarStyle="insideInset"    
android:scrollbars="vertical"
android:singleLine="false"
android:windowSoftInputMode="stateAlwaysVisible"></TextView>
</LinearLayout>
In Java file 
public class LoginActivity extends AppCompatActivity {
TextView btn_login;
TextView btnDate;
Button selectDate;
TextView date;
private int Year, Month, Day, mHour, mMinute;
DatePickerDialog datePickerDialog;
int year;
int month;
int dayOfMonth;
Calendar calendar;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
btnDate = findViewById(R.id.btnDate);
btnDate.setOnClickListener(new View.OnClickListener() {
@Override public void onClick(View v) {
final java.util.Calendar c = java.util.Calendar.getInstance();
int mYear = c.get(java.util.Calendar.YEAR); // current year
                int mMonth = c.get(java.util.Calendar.MONTH); // current month                
                int mDay = c.get(java.util.Calendar.DAY_OF_MONTH); // current day 
datePickerDialog = new DatePickerDialog(LoginActivity.this,
new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year,
int monthOfYear, int dayOfMonth) {
btnDate.setText(dayOfMonth + "-" + (monthOfYear + 1) + "-" + year);
}
}, mYear, mMonth, mDay);
datePickerDialog.getDatePicker().setMinDate(System.currentTimeMillis() - 1000);
datePickerDialog.show();
}
});
}
}

Tuesday 5 May 2020

Card view in android Studio with example


How to use Card view in android Studio


use dependency for card view :

1) implementation "androidx.cardview:cardview:1.0.0"


<androidx.cardview.widget.CardView    android:layout_width="match_parent"    android:layout_height="wrap_content"
    android:orientation="horizontal"
    card_view:cardCornerRadius="2dp"
    card_view:contentPadding="10dp"
    card_view:cardElevation="30dp"
    app:cardBackgroundColor="@color/white">

</androidx.cardview.widget.CardView>

How to set on click Activity to Other Activity in android studio

set on click Activity to Other Activity  in android studio





btn_login= findViewById(R.id.btn_login);

findViewById(R.id.btn_login).setOnClickListener(new View.OnClickListener() {
    @Override    public void onClick(View view) {
        Intent intent = new Intent(LoginActivity.this, navigationActivity.class);
        startActivity(intent);
        finish();
    }
});

How to change Fragment to activity in Android Studio





change Fragment to activity in Android Studio






View view = inflater.inflate(R.layout.fragment_home, container, false);

shopdetails.setOnClickListener(new View.OnClickListener() {
    @Override    public void onClick(View v) {
        startActivity(new Intent(getActivity(), SalonDetailsActivity.class)

        );

    }
});

Tuesday 30 May 2017

Basic code of DELETE DATA USING MYSQL IN PHP

HOW TO CREAT DELETE DATA USING MYSQL IN PHP


<head>
<?php
mysql_connect("localhost","root","");
mysql_select_db("exam");

if(isset($_REQUEST['del'])){
$id = $_REQUEST['del'];
$delete = " delete from result where id = '$id' ";
$q = mysql_query ($delete);
};
$qr = " select * from  result";
$rs = mysql_query($qr);
$num= mysql_num_rows($rs);
?>
</head>

<body>

<table border="1">
<tr>
   <td>name</td>
   <td>last name</td>
   <td>father's name</td>
   <td>email</td>
   <td>password</td>
   <td>phone</td>
   <td>gender</td>
   <td>address</td>
   <td>nationality</td>
   <td>country</td>
   <td>delete</td>
</tr>

 <?php 
 if ($num > 0){
 while($row = mysql_fetch_array($rs)){
 
 ?>
      <tr>
          <td> <?php  echo $row['name']; ?> </td>
           
          <td> <?php  echo $row['lastname']; ?></td>
           <td><?php  echo $row['father']; ?></td>
           <td> <?php  echo $row['email']; ?> </td>
           <td><?php  echo $row['password']; ?></td>
           <td><?php  echo $row['phone']; ?></td>
           <td> <?php  echo $row['gender']; ?> </td>
           <td><?php  echo $row['address']; ?></td>
           <td> <?php  echo $row['nationality']; ?> </td>
           <td> <?php  echo $row['country']; ?> </td>
           <td><a href="exam select delete.php?del=<?php echo $row['id'];?>"> delete</a> </td>
           </tr>
           <?php }}  ?> 
             
</table>

</body>

Saturday 27 May 2017

the importent theory of CSS

A style sheet language, or style language, is a computer language that expresses the presentation of structured documents. One attractive feature of structured documents is that the content can be reused in many contexts and presented in various ways. Different style sheets can be attached to the logical structure to produce different presentations.

One modern style sheet language with widespread use is Cascading Style Sheets (CSS), which is used to style documents written in HTML, XHTML and other markup languages.

For content in structured documents to be presented, a set of stylistic rules – describing, for example, colors, fonts and layout – must be applied. A collection of stylistic rules is called a style sheet. Style sheets in the form of written documents have a long history of use by editors and typographers to ensure consistency of presentation, spelling and punctuation. In electronic publishing, style sheet languages are mostly used in the context of visual presentation rather than spelling and punctuation.

Example CSS
To make all paragraphs on a page blue and sized 20% bigger than normal text, we would apply this CSS rule to a page:

p {
Full form of css

  color: blue;
  font-size: 120%;
}

<div style="float:right; border:thin solid green;">
Here comes a short paragraph that is<br />
contained in a "div" element that is<br />
floated to the right.
</div>

All style sheet languages support some kind of formatting model. Most style sheet languages have a visual formatting model that describes, in some detail, how text and other content is laid out in the final presentation. For example, the CSS formatting model specifies that block-level elements (of which "h1" is an example) extend to fill the width of the parent element. Some style sheet languages also have an aural formatting model.

Click here for more knowledge


the most important Flowchart of php

PHP for loop can be used to traverse set of code for the specified number of times.

It should be used if number of iteration is known otherwise use while loop.

Syntax

for(initialization; condition; increment/decrement){  

//code to be executed  

}  

Flowchart

php for php for loop flowchartloop flowchart

Example

<?php  

for($n=1;$n<=10;$n++){  

echo "$n<br/>";  

}  

?> 

Sunday 9 April 2017

10 On-Page SEO Techniques That’ll Boost Your Rankings (Checklist Included)

On page SEO is one of the most important processes you can use, not only for achieving better rankings but also for running successful Internet marketing campaigns.


on-page SEO
Every SEO campaign has your website in focus and if it’s not properly optimized for both search engines and users, your chances of success are minimized.
Before getting into the details on which SEO techniques to use to improve your on-site SEO, let’s start with some basic terminology.
What is On-Page SEO?
On-page SEO is the process of optimizing each and every web page of your site in order to rank higher in the Search Engine Results Pages (SERPS). On-Page SEO has to do with both technical SEO (titles, descriptions, urls etc) and the content of your web pages.
Your ultimate goal with on-page SEO, is to speak the ‘search engines language’ and help crawlers understand the meaning and context of your pages.

On-Page SEO: Anatomy of a Perfectly Optimized Page (2017 Update)

When it comes to on-page SEO, I’m sure you’ve heard enough about meta tags and keyword density for one lifetime.
If you’re looking for some practical strategies that you can use on your site today, then you’ll love this infographic.
It’s a simple checklist that will bring in more search engine traffic from every piece of content that you publish:

php - for loop

for loop example


Pseudo PHP Code:
for ( initialize a counter; conditional statement; increment a counter){
do this code;
}
Notice how all the steps of the loop are taken care of in the for loop statement. Each step is separated by a semicolon: initiliaze counter, conditional statement, and the counter increment. A semicolon is needed because these are separate expressions. However, notice that a semicolon is not needed after the "increment counter" expression.

Here is the example of the brush prices done with a for loop .

PHP Code:
$brush_price = 5;

echo "<table border=\"1\" align=\"center\">";
echo "<tr><th>Quantity</th>";
echo "<th>Price</th></tr>";
for ( $counter = 10; $counter <= 100; $counter += 10) {
echo "<tr><td>";
echo $counter;
echo "</td><td>";
echo $brush_price * $counter;
echo "</td></tr>";
}
echo "</table>";