Thursday, August 17, 2017

How Progress bar in Android

Hello,
        In this tutorial I will show you how to show Progress bar in your Android App, so that while performing a time consuming task such as fetching data from a URL, you can show progress Dialog.

In Order to show a Progress bar follow these steps

1. Add Progress bar in your XML Layout  

 <ProgressBar  
       android:id="@+id/toolbarProgressBar"  
       style="?android:attr/progressBarStyleLarge"  
       android:layout_width="match_parent"  
       android:layout_height="wrap_content"  
       android:layout_centerHorizontal="true"  
       android:layout_centerVertical="true"  
       android:visibility="gone" />  

2. Now to show the progress bar

  progressBar=(ProgressBar) findViewById(R.id.toolbarProgressBar);  
       progressBar.setVisibility(View.VISIBLE);  
       progressBar.animate();  


3. To Stop the Progress bar

  progressBar.setVisibility(View.GONE);  


I hope it was informative for you, and I would like to Thank you for reading.

Thursday, July 27, 2017

How to use ADB Pull And ADB Push

Hello,
        In this tutorial I will show you how to use ADB pull and ADB push commands.

If you have already setup environment Path variable than simple execute CMD, otherwise go to folder where ADB command is and execute Command Prompt from there.

For me ADB command is in folder

C:\Users\muhammad.taqi\AppData\Local\Android\Sdk\platform-tools

To view connected devices type

ADB devices

How to Push Files into your Android Device

adb push e:\myfile.txt /storage/emulated/0/myfolder/myfile.txt

How to Pull Files into your Android Device

 adb pull /storage/emulated/0/myfolder/myfile.txt

This will copy file from you android device to the folder where ADB command is present.

I hope it was informative for you and I would like to thank you for reading.

Thursday, April 14, 2016

OnFocusOut Event on EditText Android Studio

We can check if EditText control has focus on or not using the following event.


txtFrom.setOnFocusChangeListener(new View.OnFocusChangeListener() {
            @Override
            public void onFocusChange (View v, boolean hasFocus) {
                     // Do Code here
            }
        });

I hope it was inforamtive for you and I would like to Thank you for reading

Saturday, April 9, 2016

Send Data Back and forth between Two Activities Android Studio

Hello,

In this tutorial I will demonstrate how to send data back and forth between two activities.

Consider two Activities

1. Home Activity        (This is the Launcher Activity)
2. Detail Activity

Our goal is to send data from Home Activity to Detail Activity, use that received data, concatenate some extra string in it and than send it back to Home Activity via Button click event

Home Activity Code


private void SendDataToDetailActivity () {
        EditText fn = (EditText) findViewById(R.id.txtfname);
        Intent obj = new Intent(this, Details.class);
        obj.putExtra("Name", fn.getText().toString());
        startActivityForResult(obj, 100);
    }

Now override the onActivityResult Method
@Override
    protected void onActivityResult (int requestCode, int resultCode, Intent data) {
        if (requestCode == 100) {

            if (resultCode == RESULT_OK) {

                Toast.makeText(Home.this, data.getStringExtra("result"), Toast.LENGTH_SHORT).show();
            }
        }
    }

Now in detail Activity Define the method
private void GetDetails() {

        TextView txtF = (TextView) findViewById(R.id.txtName);
        String Name = getIntent().getStringExtra("Name");
        Student objS = new Student(Name);
        Name = objS.getName();
        String[] ss = Name.split("!");
        txtF.setText(Name);
    }
Now to send data back to Home Activity use the following Method
public void NavigateToBack (View view) {
        String Name = getIntent().getStringExtra("Name");
        Intent obj = getIntent().putExtra("result", Name + " You just received a Message from Another Activity");
        setResult(RESULT_OK, obj);
        finish();

    }
I hope that it was informative for you and I would like to Thank you for reading.

Monday, March 21, 2016

Verify MD5 and SHA-1 cryptographic hash values

Hello,
         Today in this tutorial I'm gonna show you how you can verify MD5 and SHA-1 code of a file which you have downloaded form the Internet.

It is very usefull to verify MD5 and SHA-1 code to make sure that the file you just downloaded is not corrupted and altered by any mean.

So in order to check MD5 and SHA-1 code you will need to download a utility called

File Checksum Integrity Verifier (FCIV)

Download From Here

After downloading Extract it in a folder where your download files are.

Now open up your folder which contain your downloaded file Press shift + right click and select open command window from here.

now type fciv [Your Full File name] without brackets.

Example lets say we have a file called taqi.jpg now to check the code for this file type

fciv taqi.jpg

I hope that it was informative for you and I would like to Thank you for reading.