Imageview image setus wallpapers   prview: Lets make up: setp 1: creating projects in android studio or sketchware  step2: open activity_mai...

HOW DO SET IMAGEVIEW IMAGE SET US WALLPAPERS

06:35 0 Comments

Imageview image setus wallpapers

  prview:

Lets make up:

setp 1:

creating projects in android studio or sketchware 

step2:
open activity_main.xml

Main_xml:


   

MainActivty:



package nwallpapers.com.neo.istone.andro.project.wallpapers.nwallpapers;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.app.WallpaperManager;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.media.Image;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import java.io.IOException;
import java.util.Timer;
import java.util.TimerTask;

public class MaiActivity extends Activity {

    private Bitmap bitmap;
    private Timer timer = new Timer();
    private TimerTask _timer;
    private ImageView images;
    private Button set_us;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate( savedInstanceState );
        setContentView( R.layout.activity_main );
         images = (ImageView) findViewById(R.id.iview);
         set_us = (Button) findViewById(R.id.set); 
         set_us.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                setWallpapers();
            }
        });
    }
    private void setWallpapers() {
        bitmap = ((BitmapDrawable)images.getDrawable()).getBitmap();
        final WallpaperManager myWallManager = WallpaperManager.getInstance( getApplicationContext() );
        try {
            final ProgressDialog progressDialog = new ProgressDialog(emple.this);
            progressDialog.setMax(100);
            progressDialog.setMessage("Loading...");
            progressDialog.setIndeterminate(true);
            progressDialog.setCanceledOnTouchOutside(false);
            progressDialog.show();
            _timer = new TimerTask() {
                @Override
                public void run() {
                    runOnUiThread( new Runnable() {
                        @Override
                        public void run() {
                            try {
                                myWallManager.setBitmap(bitmap );
                                progressDialog.dismiss();
                                final AlertDialog.Builder setus = new AlertDialog.Builder(emple.this);
                                setus.setMessage(R.string.set_wallpapers_secufully);
                                setus.show();
                                progressDialog.dismiss();
                            } catch (IOException e) {
                                final AlertDialog.Builder setus = new AlertDialog.Builder(emple.this);
                                setus.setTitle(R.string.set_wallpapers_error);
                                setus.setMessage(e.toString());
                                setus.show();
                                progressDialog.dismiss();

                            }
                        }
                    } );
                }
            };
            timer.schedule( _timer, (3500) );

        } catch (Exception e) {
            final AlertDialog.Builder setus = new AlertDialog.Builder(emple.this);
            setus.setTitle(R.string.set_wallpapers_error);
            setus.setMessage(R.string.set_wallpapers_error);
            setus.show();
        }
    }
}

0 Comments:

Make Follow This Steps: Open Android Studio  :- Step2:-  Step3:- Step4:- Step5: activty_main.xml Code in pasting main.xml </span></...

Muiltiple EditText in CostomDialog in Android Studio

22:35 0 Comments

Make Follow This Steps:



Open Android Studio  :-




Step2:- 


Step3:-

Step4:-






Step5:

activty_main.xml

Code in pasting main.xml

Step6:

costum.xml

Code in pasting costum.xml

Step7:

MainActivity.java

Code in pasting MainActivity.java
package com.neo_istone.muiltipleedittext; import android.content.DialogInterface; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.LinearLayout; import android.widget.TextView; import org.w3c.dom.Text; public class MainActivity extends AppCompatActivity { private Button btn1; private TextView name,email,age; private AlertDialog.Builder builder; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); btn1 = (Button) findViewById(R.id.showme_dialog_box); builder = new AlertDialog.Builder(this); name = (TextView) findViewById(R.id.name); email = (TextView) findViewById(R.id.email); age = (TextView) findViewById(R.id.age); btn1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { builder.setTitle("MulitipleEditTexts"); final View v2 = (View)getLayoutInflater().inflate(R.layout.coustom_dialog_box,null); builder.setView(v2); final TextView name2 =(TextView) v2.findViewById(R.id.name2); final TextView email2 =(TextView) v2.findViewById(R.id.email2); final TextView ag2 =(TextView) v2.findViewById(R.id.age2); builder.setPositiveButton("Shome Text", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if(name2.getText().toString().equals("")){ name.setText("N/A"); }else { if (email2.getText().toString().equals("")){ email.setText("N/A"); } else { if (ag2.getText().toString().equals("")){ email.setText("N/A"); } else { name.setText(name2.getText().toString()); email.setText(email2.getText().toString()); age.setText(ag2.getText().toString()); } } } } }); builder.show(); } }); } }

App Screenshots:

                                            screnenShot:1

                                                          screnenShot:2

0 Comments:

Hi. Here i want show you how to use Android GPS quickly. This is simple, may be not perfect example how to get current location by GPS. To u...

Current Location Android Studio Latitude Longitude

06:52 0 Comments

Hi. Here i want show you how to use Android GPS quickly. This is simple, may be not perfect example how to get current location by GPS.

To use GPS in your application first of all you must specify the uses-permission in Android manifest file:



If you don’t set this permission the application can’t get access to location service.
To use this application with android emulator you must mock location data. To do this using Eclipse you must:
  • Select Window > Show View > Other > Emulator Control
  • In Emulator Control panel enter the GPS coordinates under Location Controls and press Send
This operation you must do every time then you Run application.
Below you can see the application activity (HelloAndroidGpsActivity.java) source. Below you can download the source code of this Android project.
For more information about Android GPS Usage look HERE

MainActivity.java 

Full code:


0 Comments:

In that tutorial, you are going to learn how to create a Torch Flashlight application for Android with Android Studio. A lot of tutorials ex...

Torch Light App tutorils in android studio

23:26 2 Comments

In that tutorial, you are going to learn how to create a Torch Flashlight application for Android with Android Studio. A lot of tutorials exist to teach you to use the flashlight of your device via the Camera API but this API is now deprecated since Android API level 25.
So, to be up to date we are going to use the Camera2 API in this tutorial. Note that you can discover this tutorial in video on YouTube :

Creating the User Interface

To start, we are going to create the user interface of our Torch Flashlight Application for Android. We will have one image view to display an ON / OFF switcher image. Then, a button to enable the camera permissions to use the flashlight on the Android device..

Activity_Main.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"
    android:background="@color/background">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/app_names"
        android:textColor="@color/Whit"
        android:textSize="28sp"
        android:gravity="center_horizontal|center_vertical"
        android:textStyle="bold" />

  <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:gravity="center_horizontal|center_vertical">
      <LinearLayout
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:orientation="vertical"
          android:layout_weight="1">

      </LinearLayout>
    <ImageButton
        android:id="@+id/Switch"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/background"
        android:src="@drawable/off" />
  <LinearLayout
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical"
      android:layout_weight="1"
      android:gravity="bottom|right">
      <TextView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="This app devloped by neo-istone"
          android:textStyle="bold"
          android:textSize="14sp"
          android:textColor="#fff"/>
  </LinearLayout>
</LinearLayout>
</LinearLayout>



Updating the Android Manifest

Then, we are going to add the CAMERA permission in the android manifest and we also define the fact that we use the camera in our application :

Updating the Gradle Build File

To use the Camera2 API with no warnings on Android Studio, we are going to set the minimum Android SDK version to 23 in the Gradle Build File :

Writing the Java Code

Now, it’s time to write the Java code of the Main Activity. First, we declare a constant for the CAMERA_REQUEST request index used to request camera permissions. Then, we declare properties for the enable button and for the image view. We define a flashlight status Boolean which will indicate us if the flashlight is on or off.
In the onCreate method, we get references for the ImageView and for the button. We check if the device has a camera. We check also if the camera permission has already been granted by the user for the application. We manage the state of the button and the imageview according the camera permission authorization. We install an OnClickListener on the enable button. When the user will click on this button we will request permission for the Camera permission with the Camera Request id in parameter.

We set an OnClickListener on the ImageView. When a user will click on the image view, first we check if the device has camera flash. If no, we display a message to alert the user. Otherwise, we turn off the light if needed by calling the flashLightOff method. And we turn on the light if needed by calling the flashLightOn method.


 <?xml version="1.0" encoding="utf-8"?>
Switch.setOnClickListener(new View.OnClickListener() {
  @Override
  public void onClick(View view) {
    if (hasCameraFlash) {
      if (flashLightStatus)
        flashLightOff();
      else
        flashLightOn();
    } else {
      Toast.makeText(MainActivity.this, "No flash available on your device",
            Toast.LENGTH_SHORT).show();
    }
  }
});

Now, we write the flashLightOn method. We get the camera service. Usually, the front camera is at the first position. With the camera manager we call the set torch mode method with cameraId in parameter to enable it. We set the flashlight status to true and we change the image in the image view.


@TargetApi(Build.VERSION_CODES.M)
    @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
    private void flashLightOn() {
        CameraManager cameraManager = (CameraManager) getSystemService(Context.CAMERA_SERVICE);

        try {
            String cameraId = cameraManager.getCameraIdList()[0];
            cameraManager.setTorchMode(cameraId, true);
            flashLightStatus = true;
            Switch.setImageResource(R.drawable.on);
        } catch (CameraAccessException e) {
            Toast.makeText(this,e.toString(),Toast.LENGTH_SHORT).show();
        }
    }

Now, we write the flashLightOff method. We get the camera service. Usually, the front camera is at the first position. With the camera manager we call the set torch mode method with cameraId in parameter to enable it. We set the flashlight status to true and we change the image in the image view.

@RequiresApi(api = Build.VERSION_CODES.M)
    private void flashLightOff() {
        CameraManager cameraManager = (CameraManager) getSystemService(Context.CAMERA_SERVICE);

        try {
            String cameraId = cameraManager.getCameraIdList()[0];
            cameraManager.setTorchMode(cameraId, false);
            flashLightStatus = false;
            Switch.setImageResource(R.drawable.off);
        } catch (CameraAccessException e) {
            Toast.makeText(this,e.toString(),Toast.LENGTH_SHORT).show();
        }
    }
Finally, we override the onRequestPermissionsResult method. We check if the user has granted the camera permission. If yes, we disable the enable button and we change the text of the button to display a camera enabled message. Then, we enable the ImageView to let the user light up the Flashlight of their device :


MainActivity.java 

Full code:

package light.flash.istone.neo.com.flashlightapp;

import android.Manifest;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.pm.PackageManager;
import android.graphics.Camera;
import android.hardware.camera2.CameraAccessException;
import android.hardware.camera2.CameraManager;
import android.os.Build;
import android.support.annotation.NonNull;
import android.support.annotation.RequiresApi;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageButton;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {
    ImageButton Switch;
    private static final int CAMERA_REQUEST = 50;
    private boolean flashLightStatus = false;



    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        final boolean hasCameraFlash = getPackageManager().
                hasSystemFeature(PackageManager.FEATURE_CAMERA_FLASH);
        boolean isEnabled = ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA)
                == PackageManager.PERMISSION_GRANTED;
        ActivityCompat.requestPermissions(MainActivity.this, new String[] {Manifest.permission.CAMERA}, CAMERA_REQUEST);
        Switch = (ImageButton) findViewById(R.id.Switch);
    Switch.setOnClickListener(new View.OnClickListener() {
            @RequiresApi(api = Build.VERSION_CODES.M)
            @Override
            public void onClick(View view) {
                if (hasCameraFlash) {
                    if (flashLightStatus)
                        flashLightOff();
                    else
                        flashLightOn();
                } else {
                    Toast.makeText(MainActivity.this, "No flash available on your device",
                            Toast.LENGTH_SHORT).show();
                }
            }
        });
    }

    @TargetApi(Build.VERSION_CODES.M)
    @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
    private void flashLightOn() {
        CameraManager cameraManager = (CameraManager) getSystemService(Context.CAMERA_SERVICE);

        try {
            String cameraId = cameraManager.getCameraIdList()[0];
            cameraManager.setTorchMode(cameraId, true);
            flashLightStatus = true;
            Switch.setImageResource(R.drawable.on);
        } catch (CameraAccessException e) {
            Toast.makeText(this,e.toString(),Toast.LENGTH_SHORT).show();
        }
    }

    @RequiresApi(api = Build.VERSION_CODES.M)
    private void flashLightOff() {
        CameraManager cameraManager = (CameraManager) getSystemService(Context.CAMERA_SERVICE);

        try {
            String cameraId = cameraManager.getCameraIdList()[0];
            cameraManager.setTorchMode(cameraId, false);
            flashLightStatus = false;
            Switch.setImageResource(R.drawable.off);
        } catch (CameraAccessException e) {
            Toast.makeText(this,e.toString(),Toast.LENGTH_SHORT).show();
        }
    }

    @Override
    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
        switch(requestCode) {
            case CAMERA_REQUEST :
                if (grantResults.length > 0  &&  grantResults[0] == PackageManager.PERMISSION_GRANTED) {
                    Switch.setEnabled(true);
                } else {
                    Toast.makeText(MainActivity.this, "Permission Denied for the Camera", Toast.LENGTH_SHORT).show();
                }
                break;
        }
    }
}

Testing our Torch Flashlight Application

Now, it’s time to test our Torch Flashlight Application. You should obtain the following result :


2 Comments:

Firebase Examples   Firebase Auth   Firebase Database   Firebase Firebase Features of Firebase Firebase comes with bunch  features  essentia...

Firebase Auth

12:39 2 Comments


Firebase Examples Firebase Auth Firebase Database Firebase

Firebase

Features of Firebase

Firebase comes with bunch features essential for every android app starting from authentication to hosting the app.
google firebase android features
Below are the advantages using Firebase in general:
> Super easy and quick to implement.
> No server side configuration needed. No PHP Scripts and No Database Designs.
> Realtime update without using GCM.
> Autoscaling built-in
> Can start for free (only need to start paying once we hit 50 connections)
> Robust APIs for Javascript (including several frameworks like Angular), iOS, and Android
> Built-in support for authentication services like Facebook, Google, and Twitter
> Declarative Security Rules model allows us to enforce read/write privileges and data validation throughout the tree
Some of the disadvantages of Firebase can be sum up in the following:
> Need to build indexes manually
> May need to build “event log” manually as well (in separate sub-tree?)
> Implementation of REST API could be difficult on embedded platforms
> Data validation rules do not support complex objects directly (you’d need to validate individual child nodes separately)

1. Enabling Firebase Auth

1. First thing you need to do is go to https://firebase.google.com/ and make an account to gain access to their console. After you gain access to the console you can start by creating your first project.
2. Give the package name of your project (mine is info.androidhive.firebase) in which you are going to integrate the Firebase. Here the google-services.json file will be downloaded when you press add app button.
3. Next go to your project dashboard. Find the Auth and click get started. Go to set up sign in method and choose Email & Password and enable it.
android-adding-firebase-to-your-project
Now we are ready to start with our Android project. We are going to create a simple app which contains firebase authentication and profile management. Overall we are going to see how to add LoginRegistrationForgot PasswordChange EmailChange Password & finally Sign Out option.

2. Creating Android Project

1. Create a new project in Android Studio from File ⇒ New Project. When it prompts you to select the default activity, select Blank Activity and proceed.
While filling the project details, use the same package name which you gave in firebase console. In my case I am using same info.androidhive.firebase.
2. Open AndroidManifest.xml and add the INTERNET permission as we need to make network calls.
<uses-permission android:name="android.permission.INTERNET" />
3. Paste the google-services.json file to your project’s app folder. This step is very important as your project won’t build without this file.
4. Now open the build.gradle located in project’s home directory and add firebase dependency.
build.gradle
dependencies {
        classpath 'com.android.tools.build:gradle:2.1.2'
        classpath 'com.google.gms:google-services:3.0.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
5. Open app/build.gradle and add firebase auth dependency. At the very bottom of the file, add apply plugin: ‘com.google.gms.google-services’
app/build.gradle
dependencies {
    compile "com.google.firebase:firebase-auth:9.0.2"
}
apply plugin: 'com.google.gms.google-services'

activity_main.xml :

<LinerLayout
   android:layout_width="match_parent"
   android:layout_height="match_parent"
   android:orieation="vericatail"
   android:gravity="center"/>


<LinerLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orieation="vericatail"
    android:gravity="center">
    <Editext
      android:id="@+id/emailid"
      android::layout_width="match_parent"
      android:layout_height="warp_content"
      android:hint="Enter your emailid"
      android:hintColor="#ffffff"
      android:textColor="#0000ff"
      android:textSize="14sp"
      />


    <Editext
      android:id="@+id/password"
      android::layout_width="match_parent"
      android:layout_height="warp_content"
      android:hint="Enter your password"
      android:hintColor="#ffffff"
      android:textColor="#0000ff"
      android:textSize="14sp"
      />


      <Button
        android:id="@+id/login"
        android::layout_width="match_parent"
        android:layout_height="warp_content"
        android:textSize="14sp"
        android:textColor="#ffffff"
        android:text="Login"
        android:background="0000ff"
        />


    </LinerLayout>
   </LinerLayout>

MainActivty:

package nwallpapers.com.neo.istone.andro.project.wallpapers.nwallpapers;
import android.annotation.SuppressLint;import android.app.Activity;import android.app.ProgressDialog;import android.content.Context;import android.content.DialogInterface;import android.content.Intent;import android.content.SharedPreferences;import android.graphics.Color;import android.graphics.drawable.GradientDrawable;import android.os.Build;import android.support.annotation.NonNull;import android.support.annotation.RequiresApi;import android.support.v7.app.AlertDialog;import android.support.v7.app.AppCompatActivity;import android.os.Bundle;import android.view.View;import android.view.ViewGroup;import android.widget.AutoCompleteTextView;import android.widget.Button;import android.widget.EditText;import android.widget.LinearLayout;import android.widget.TextView;import android.widget.Toast;
import com.google.android.gms.tasks.OnCompleteListener;import com.google.android.gms.tasks.Task;import com.google.firebase.auth.AuthResult;import com.google.firebase.auth.FirebaseAuth;
import java.util.Timer;import java.util.TimerTask;
public class Login extends Activity {

private AutoCompleteTextView email; private EditText password; private Button login_btn; private TextView rest,creating_new_account; private FirebaseAuth mAuth; private LinearLayout main; private SharedPreferences new_users; private SharedPreferences data_expoerting; private AlertDialog.Builder dialog; private AlertDialog.Builder show; private Timer timer = new Timer(); private TimerTask _timer;
public Login() {
}

@SuppressLint("NewApi")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate( savedInstanceState ); setContentView( R.layout.activity_main );
      email = findViewById(R.id.email);
      main = findViewById(R.id.main);      password = findViewById(R.id.password);      login_btn = findViewById(R.id.login_btn);
       login_btn.setOnClickListener(new View.OnClickListener() {
    @Override
public void onClick(View v) {
if (email.getText().toString().contains( "@" )) {
if (email.getText().toString().equals( "" ) && password.getText().toString().equals( "" )) {
Toast.makeText( Login.this, "Fill it", Toast.LENGTH_SHORT ).show(); } else {
login();
}
});
}
    private void login() {
      if (email.getText().toString().equals("")){
neoistone.Toast(this,"Enter your message"); } else {
if (password.getText().toString().equals( "" )) {
neoistone.Toast( this, "Enter your Pswword" ); } else {
final ProgressDialog progressDialog = new ProgressDialog( Login.this ); progressDialog.setMax( 100 ); progressDialog.setMessage( "Please Wait Login you ..." ); progressDialog.setIndeterminate( true ); progressDialog.setCanceledOnTouchOutside( false ); progressDialog.show(); mAuth = FirebaseAuth.getInstance(); mAuth.signInWithEmailAndPassword( email.getText().toString(), password.getText().toString() )
.addOnCompleteListener( this, new OnCompleteListener<AuthResult>() {
@Override public void onComplete(@NonNull Task<AuthResult> task) {
final String error = task.getException() != null ? task.getException().getMessage() : "";
if (task.isSuccessful()) {
// Sign in success, update UI with the signed-in user's information new_users.edit().putString( "new", "123" ).apply(); data_expoerting.edit().putString( "email", mAuth.getCurrentUser().getEmail().toLowerCase().toString() ).apply(); // progress bar dismiss// progressDialog.dismiss(); neoistone.Toast(Login.this,"Loged");
} else {
// If sign in fails, display a message to the user. neoistone.Toast(Login.this,"error is :-"+error); progressDialog.dismiss(); }

// ... }
} ); }
}
}
}


2.resetPassword :



mAuth.getInstance().sendPasswordResetEmail(emailid.getText().toString());




Following On Google + or youtube channal
Google plus: Join Now
whatsapp: group:- Join Whatsapp group
youtube channal:- Neo-istone youtube channal

2 Comments: