Found 1966 Articles for Apps/Applications

How to add custom view in alert dialog?

Vrundesha Joshi
Updated on 30-Jul-2019 22:30:25

3K+ Views

This example demonstrate about How to add custom view in alert dialogStep 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     In the above code, we have taken text view.Step 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.annotation.TargetApi; import android.content.DialogInterface; import android.os.Build; import android.os.Bundle; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.EditText; import android.widget.Switch; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends AppCompatActivity {    TextView text;    @TargetApi(Build.VERSION_CODES.LOLLIPOP) ... Read More

How to add check box list in alert dialog?

Jennifer Nicholas
Updated on 30-Jul-2019 22:30:25

2K+ Views

How to add checkbox list in alert dialog?This example demonstrates How to add checkbox list in the alert dialogStep 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     In the above code, we have taken text view.Step 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.annotation.TargetApi; import android.content.DialogInterface; import android.os.Build; import android.os.Bundle; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Switch; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends AppCompatActivity { ... Read More

How can I make my custom objects Serializable?

Nitya Raut
Updated on 30-Jul-2019 22:30:25

209 Views

This example demonstrate about how can I make my custom objects SerializableStep 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     In the above code, we have taken button view to show Serializable object values.Step 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.os.Build; import android.os.Bundle; import android.support.annotation.RequiresApi; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Toast; public class MainActivity extends AppCompatActivity {    serializableObject sample;    @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)    @Override   ... Read More

How can I make my custom objects Parcelable?

Jennifer Nicholas
Updated on 30-Jul-2019 22:30:25

348 Views

This example demonstrates how can I make my custom objects ParcelableStep 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     In the above code, we have taken button view to show parcel object values.Step 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.os.Build; import android.os.Bundle; import android.support.annotation.RequiresApi; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Toast; public class MainActivity extends AppCompatActivity {    parcleObject sample;    @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)    @Override    protected ... Read More

Get clicked item and its position in RecyclerView?

Nitya Raut
Updated on 30-Jul-2019 22:30:25

3K+ Views

This example demonstrate about how to get clicked item and its position in RecyclerViewStep 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.                 In the above code, we have taken recycerview.Step 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.annotation.TargetApi; import android.os.Build; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.DefaultItemAnimator; import android.support.v7.widget.DividerItemDecoration; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.Toolbar; import android.widget.TextView; import android.widget.Toast; import java.util.ArrayList; public class ... Read More

Fragment Tutorial with Example in Android Studio?

Vrundesha Joshi
Updated on 30-Jul-2019 22:30:25

5K+ Views

This example demonstrate about Fragment Tutorial with Example in Android StudioStep 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.                 In the above code, we have taken button views and linear layout to show different fragments.Step 3 − Add the following code to src /MainActivity.javapackage com.example.myapplication; import android.os.Build; import android.os.Bundle; import android.support.annotation.RequiresApi; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentTransaction; import android.support.v7.app.AppCompatActivity; import android.view.View; public class MainActivity extends AppCompatActivity { ... Read More

Difference between Parcel able and Serializable in android

Jennifer Nicholas
Updated on 30-Jul-2019 22:30:25

334 Views

This example demonstrate about Difference between Parcel able and Serializable in androidSerializableSerializable is a markable interface or we can call as empty interface. It doesn’t have any pre-implemented methods. Serializable is going to convert object to byte stream. So user can pass the data between one activity to another activity. The main advantage of serializable is creation and passing data is very easy but it is a slow process compare to parcelable.A simple example of serializable as shown below –import java.io.Serializable; class serializableObject implements Serializable {    String name;    public serializableObject(String name) {       this.name = name; ... Read More

Difference between Parcelable and Serializable in android

Vrundesha Joshi
Updated on 30-Jul-2019 22:30:25

3K+ Views

This example demonstrates about Difference between Parcel able and Serializable in androidSerializableSerializable is a markable interface or we can call as an empty interface. It doesn’t have any pre-implemented methods. Serializable is going to convert an object to byte stream. So the user can pass the data between one activity to another activity. The main advantage of serializable is the creation and passing data is very easy but it is a slow process compare to parcelable.A simple example of serializable as shown below –import java.io.Serializable; class serializableObject implements Serializable {    String name;    public serializableObject(String name) {     ... Read More

Detect home button press in android

Jennifer Nicholas
Updated on 30-Jul-2019 22:30:25

2K+ Views

This example demonstrates about Detect home button press in androidStep 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     In the above code, we have taken a text view.Step 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends Activity {    TextView text;    @Override    public void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);       setContentView(R.layout.activity_main); ... Read More

Best replacement of onItemClickListner in android recyclerview?

Nitya Raut
Updated on 30-Jul-2019 22:30:25

83 Views

This example demonstrates about Best replacement of onItemClickListner in android recyclerviewStep 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.                   In the above code, we have taken recyclerview.Step 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.annotation.TargetApi; import android.os.Build; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.DefaultItemAnimator; import android.support.v7.widget.DividerItemDecoration; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.Toolbar; import android.widget.TextView; import java.util.ArrayList; public class MainActivity extends AppCompatActivity { ... Read More

Advertisements