Develop a Soft Keyboard for Android

Azhar
Updated on 03-Jul-2020 13:18:14

977 Views

This example demonstrates how do I develop a soft keyboard for android.Step 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.                 Step 3 − Add the following code to src/MainActivity.javaimport androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.EditText; import android.widget.TextView; public class MainActivity extends AppCompatActivity {    EditText editText;    TextView textView;    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);       setContentView(R.layout.activity_main); ... Read More

Get Web Page Contents from WebView in Android

Azhar
Updated on 03-Jul-2020 13:17:33

941 Views

This example demonstrates how do I get the web page contents from a webView in android.Step 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.     Step 3 − Add the following code to src/MainActivity.javaimport androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.webkit.WebView; public class MainActivity extends AppCompatActivity {    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);       setContentView(R.layout.activity_main);       WebView webView = findViewById(R.id.webView);       webView.loadUrl("http://www.tutorialspoint.com");   ... Read More

Stop Screen Recording in Android

Azhar
Updated on 03-Jul-2020 13:16:55

911 Views

This example demonstrates about How to stop screen recording in Android.Step 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. Step 3  − Add the following code to src/MainActivity.javapackage app.com.sample; import android.os.Bundle; import android.view.WindowManager; import androidx.appcompat.app.AppCompatActivity; public class MainActivity extends AppCompatActivity {    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);       getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE,       WindowManager.LayoutParams.FLAG_SECURE);       setContentView(R.layout.activity_main);    } }Step 4  − Add the following code to ... Read More

Create Left to Right Slide Animation in Android

Azhar
Updated on 03-Jul-2020 13:16:09

3K+ Views

This example demonstrates how do I create left to right side animation in android.Step 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.                 Step 3 − Add the following code to src/MainActivity.javaimport androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.transition.Slide; import android.transition.TransitionManager; import android.view.Gravity; import android.view.View; import android.widget.Button; import android.widget.RelativeLayout; import android.widget.TextView; public class MainActivity extends AppCompatActivity {    Button btnSlideLeft, btnSlideRight;    TextView textView, textView1;    RelativeLayout relativeLayout;   ... Read More

Make a Horizontal ListView in Android

Azhar
Updated on 03-Jul-2020 13:15:26

3K+ Views

This example demonstrates about How can I make a horizontal ListView in Android.Step 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.     Step 3  − Add the following code to src/MainActivity.javapackage app.com.sample; import android.os.Bundle; import androidx.appcompat.app.AppCompatActivity; import androidx.recyclerview.widget.DefaultItemAnimator; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import java.util.ArrayList; import java.util.List; public class MainActivity extends AppCompatActivity {    private List movieList = new ArrayList();    private MoviesAdapter mAdapter;    @Override    protected void onCreate(Bundle savedInstanceState) {     ... Read More

Crop Circular Area from Bitmap in Android

Azhar
Updated on 03-Jul-2020 13:13:37

1K+ Views

This example demonstrates how to crop circular area from bitmap in Android .Step 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.         Step 3  − Add the following code to src/MainActivity.javapackage com.medkart.sample; import androidx.appcompat.app.AppCompatActivity; import android.content.Context; import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.PorterDuff; import android.graphics.PorterDuffXfermode; import android.graphics.Rect; import android.graphics.RectF; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.ImageView; import android.widget.RelativeLayout; public class MainActivity extends AppCompatActivity ... Read More

Create Shadow in Android Buttons

Azhar
Updated on 03-Jul-2020 13:12:56

9K+ Views

This example demonstrates how How to create shadow in Android Buttons.Step 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.         Step 3  − Add the following code to src/MainActivity.javapackage com.medkart.sample; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; public class MainActivity extends AppCompatActivity {    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);       setContentView(R.layout.activity_main);    } }Step 4  − Add the following code to res/drawable/shadow_button_layer_list.xml       ... Read More

Fix Android OS NetworkOnMainThreadException

Azhar
Updated on 03-Jul-2020 13:11:21

3K+ Views

The exception that is thrown when an application attempts to perform a networking operation on its main thread.This is only thrown for applications targeting the Honeycomb SDK or higher. Applications targeting earlier SDK versions are allowed to do networking on their main event loop threads, but it's heavily discouraged.Kindly refer the below example program to fix this exception −This example demonstrates how do I fix the android.os.NetworkOnMainThreadException.Step 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.   ... Read More

Integrate Facebook in Android App

Azhar
Updated on 03-Jul-2020 13:10:40

323 Views

This example demonstrates about How to integrate facebook in Android AppStep 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  – Please follow Q21 to integrate Facebook.Step 3  − Add the following code to res/layout/activity_main.xml.     Step 4  − Add the following code to src/MainActivity.javapackage app.com.sample; import android.os.Bundle; import android.view.View; import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; import com.facebook.CallbackManager; import com.facebook.FacebookCallback; import com.facebook.FacebookException; import com.facebook.login.LoginManager; import com.facebook.login.LoginResult; public class MainActivity extends AppCompatActivity {    @Override    protected void onCreate(Bundle savedInstanceState) {       ... Read More

Open Facebook Page from Android App

Azhar
Updated on 03-Jul-2020 13:09:28

2K+ Views

This example demonstrates about How to open Facebook page from Android app?Step 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.     Step 3  − Add the following code to src/MainActivity.javapackage app.com.sample; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.view.View; import androidx.appcompat.app.AppCompatActivity; public class MainActivity extends AppCompatActivity {    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);       setContentView(R.layout.activity_main);    }    public void fbClick(View view) {     ... Read More

Advertisements