Change TextView Style at Runtime in Android

Azhar
Updated on 03-Jul-2020 10:11:17

940 Views

This example demonstrates how do I change a textView style in runtime 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 in res/values/styles.xml    bold|italic    #FFFFFF    normal    #C0C0C0

Determine the Size of an Android View at Run Time

Azhar
Updated on 03-Jul-2020 09:06:06

232 Views

This example demonstrates how do I determine the size of an android view at run time.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 – Copy and paste an image (.png/.jpg/.jpeg) into res/drawableStep 4 − Add the following code to src/MainActivity.javaimport android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.view.ViewTreeObserver; import android.widget.ImageView; import android.widget.TextView; public class MainActivity extends AppCompatActivity {    ImageView imageView;    @Override    protected void onCreate(Bundle savedInstanceState) { ... Read More

Rotate an Image in ImageView by an Angle on Android

Azhar
Updated on 03-Jul-2020 09:05:03

1K+ Views

This example demonstrates how do I rotate an image in ImageView by an angle on 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 android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.ImageView; public class MainActivity extends AppCompatActivity {    ImageView imageView;    Button btnRotate;    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);       setContentView(R.layout.activity_main);   ... Read More

Permissions Required to Access Internet in Android Applications

Azhar
Updated on 03-Jul-2020 09:04:06

797 Views

This example demonstrates how do I open google from android app using Internet permission.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 android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.webkit.WebView; public class MainActivity extends AppCompatActivity {    WebView webView;    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);       setContentView(R.layout.activity_main);       webView = findViewById(R.id.webView);       ... Read More

Use BroadcastReceiver in Android

Azhar
Updated on 03-Jul-2020 09:03:21

492 Views

This example demonstrates how do I use BroadcastReceiver 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 android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.net.wifi.WifiManager; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.widget.CompoundButton; import android.widget.Switch; import android.widget.Toast; public class MainActivity extends AppCompatActivity {    Switch wifiSwitch;    WifiManager wifiManager;    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);     ... Read More

Standalone React JS Basic Example

Shyam Hande
Updated on 03-Jul-2020 09:02:34

2K+ Views

Lets first start with writing a simple HTML code and see how we can use ReactBasic React example  − Create a simple div like below −    Steve    My hobby: Cricket Add some styling elements.player{    border:1px solid #eee;    width:200px;    box-shadow:0 2px 2px #ccc;    padding: 22px;    display:inline-block;    margin:10px; }This is just like normal html data in web app. Now, we may have multiple same players and we then have to replicate the same div like below    David    My hobby: Cricket These div are same in structure but having different data inside. Here, ... Read More

Start Android Application at Boot Time

Azhar
Updated on 03-Jul-2020 09:00:11

3K+ Views

This example demonstrates how do I start an android application at boot time.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 – Create a new Java class (StartAppOnBoot.java) and add the following code −import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; public class StartAppOnBoot extends BroadcastReceiver {    @Override    public void onReceive(Context context, Intent intent) {       if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {          Intent i = new Intent(context, ... Read More

Start a Service at Boot Time in Android App

Azhar
Updated on 03-Jul-2020 08:52:08

3K+ Views

This example demonstrates how do I 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 – Create a new Java class (StartAppOnBoot.java) and add the following code −import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; public class StartAppOnBoot extends BroadcastReceiver {    @Override    public void onReceive(Context context, Intent intent) {    if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {       Intent i = new Intent(context, MainActivity.class);       i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);       ... Read More

Use Scrollbar in Android

Azhar
Updated on 03-Jul-2020 08:51:27

5K+ Views

This example demonstrates how do I use ScrollView 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.                                                                                       ... Read More

Get Bitmap from URL in Android App

Azhar
Updated on 03-Jul-2020 08:50:38

4K+ Views

This example demonstrates how do I get a bitmap from Url in 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 – Copy and paste an image (.png/.jpg/.jpeg) into res/drawableStep 4 − Add the following code to src/MainActivity.javaimport android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.AsyncTask; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.widget.ImageView; import java.io.IOException; import java.io.InputStream; public class MainActivity extends AppCompatActivity {    Bitmap ... Read More

Advertisements