Open top menu





Exaplain:- How to Build a Responsive UI in Android?

You Can Bulid to Build a Responsive UI  with ConstraintLayout in Android. The ConstraintLayout similar to Relative Layout, All view laid out according to relationship between siling views.

ConstraintLayout is Available in an API Library, the library compatible  with Android 2.3 (API Level 9) and higher.


More Info clickhere







Read more







Example: How to debug android App via WIFI in Android Studio?

Step 1- Check android device and your PC WiFi both are same Internet  connection.

Step 2- First, you can connect android device via cable?  Check the Android device is connected 
android studio.

Step 3- Then, Open Run(CMD )Window, Get  \sdk \tool-plateform>




Step 4-Run >adp tcpip 5555



Step 4- Then, Remove Cable.

Step 5- Get android device  Ip Address.

Step 6-Setting-- >About Phone -- >Status

Step 7-you can run This command >adb connect  





Step 8- your Android device connect.




Read more

 Example :- How to drag and drop imageView,textVew programmatically in android.

First ,you have to Used Library Sticker View,with help of stickerView you can rotate and scale Image and text.

activity_main.xml


xml version="1.0" encoding="utf-8"?>

<FrameLayout
   
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:id="@+id/canvasView"
   
android:layout_width="match_parent"
   
android:layout_height="match_parent"
   
tools:context=".MainActivity">


    <
ImageView
       
android:id="@+id/imageView"
       
android:layout_gravity="center"
       
android:layout_width="wrap_content"
        
android:layout_height="wrap_content"
       
android:src="@drawable/im"
       
android:scaleType="fitXY"/>
</
FrameLayout>


MainActivity.java

package com.project.example.draganddropproject;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.FrameLayout;

public class MainActivity extends AppCompatActivity {

   
@Override
   
protected void onCreate(Bundle savedInstanceState) {
       
super.onCreate(savedInstanceState);

        setContentView(R.layout.
activity_main);

        FrameLayout canvas = (FrameLayout) findViewById(R.id.
canvasView);

       
//add a stickerImage to canvas
       
StickerImageView iv_sticker = new StickerImageView(MainActivity.this);
        iv_sticker.setImageDrawable(getResources().getDrawable(R.drawable.
cap));
        canvas.addView(iv_sticker);

       
//add a stickerText to canvas
       
StickerTextView tv_sticker = new StickerTextView(MainActivity.this);
        tv_sticker.setText(
"Android Tutorial Point");
        canvas.addView(tv_sticker);

    }
}





Read more


Example: How to implement AdapterViewFlipper In android.And why we are used?


Simple ViewAnimator that will Aniamte between two or moreViews View that have been added to it.Only one Child is shown at a time.


activity_main.xml
....................................................................... 

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"    
tools:context="com.project.example.androidbeginnerpoint.MainActivity"



  
 >      
android:layout_width="match_parent"       
android:layout_height="match_parent"       
android:id="@+id/simpleAdapterViewFlipper" 

 </LinearLayout>
............................................ 


row_item.xml

............................................ 

xml version="1.0" encoding="utf-8"

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    
android:layout_width="wrap_content"    
android:layout_height="wrap_content"    
android:background="#fff"    
android:gravity="center"    
android:orientation="vertical"

<ImageView        

android:id="@+id/fruitImage"        
android:layout_width="wrap_content"        
android:layout_height="150dp"       
 android:layout_gravity="center" />

 <TextView        
android:id="@+id/fruitName"        
android:layout_width="wrap_content"        
android:layout_height="wrap_content"        
android:layout_gravity="center"        
android:layout_marginTop="2dp"        
android:textColor="#000" />

</LinearLayout>
.................................... 




MainActivity.Java

..................................... 

package com.project.example.androidbeginnerpoint;
import android.app.ProgressDialog;
import android.content.Intent;
import android.net.Uri;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.AdapterViewFlipper;
import android.widget.ProgressBar;

public class MainActivity extends AppCompatActivity {

    private AdapterViewFlipper simpleAdapterViewFlipper;
    int[] fruitImages = {R.drawable.a, R.drawable.ga, R.drawable.s};     
    String fruitNames[] = {"Apple", "Green Apple", "Litchi"};

    @Override    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        simpleAdapterViewFlipper = (AdapterViewFlipper) 
findViewById(R.id.simpleAdapterViewFlipper);  
                 AdapterViewFlip customAdapter = new AdapterViewFlip
(getApplicationContext(), fruitNames, fruitImages);
        simpleAdapterViewFlipper.setAdapter(customAdapter);  
                simpleAdapterViewFlipper.setFlipInterval(3000);
        
        simpleAdapterViewFlipper.setAutoStart(true);
    }
}
............................................... 



AdapterViewFlip.Java
................................. 


package com.project.example.androidbeginnerpoint;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;


public class AdapterViewFlip extends BaseAdapter {
    Context context;
    int[] fruitImages;
    String[] fruitNames;
    LayoutInflater inflter;

    public AdapterViewFlip(Context applicationContext, String[] fruitNames,
 int[] fruitImages) {
        this.context = applicationContext;
        this.fruitImages = fruitImages;
        this.fruitNames = fruitNames;
        inflter = (LayoutInflater.from(applicationContext));
    }

    @Override    public int getCount() {
        return fruitNames.length;
    }

    @Override    public Object getItem(int position) {
        return null;
    }

    @Override    public long getItemId(int position) {
        return 0;
    }

    @Override    public View getView(int position, View view, ViewGroup parent) {
        view = inflter.inflate(R.layout.row_item, null);
        TextView fruitName = (TextView) view.findViewById(R.id.fruitName);
        ImageView fruitImage = (ImageView) view.findViewById(R.id.fruitImage);
        fruitName.setText(fruitNames[position]);
        fruitImage.setImageResource(fruitImages[position]);
        return view;
    }
}

.................................... 






Read more






Exaplain:- How to prevent Activity going to sleep mode Android ?


Stop the activity in pause Mode .



@Overridepublic void onResume() {
    super.onResume();
    getWindow().addFlags(WindowManager.LayoutParams.
               FLAG_KEEP_SCREEN_ON);
}

@Overridepublic void onPause() {
    super.onPause();
    getWindow().clearFlags(WindowManager.LayoutParams.
              FLAG_KEEP_SCREEN_ON);
}





Read more