How to send data back to the main Activity in android?

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

1K+ Views

This example demonstrates how do I send data back to the main activity 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.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends AppCompatActivity {    private TextView textViewResult;    private EditText editTextNumber1;    private EditText editTextNumber2;   ... Read More

How to change a textView Style at runtime in android?

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

996 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

How to determine the size of an android view at run time?

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

267 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

How to rotate an Image in ImageView by an angle on Android?

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

2K+ 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

What permission do I need to access Internet from an Android application?

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

857 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

How to use BroadcastReceiver in Android?

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

529 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

How to start an 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

How to 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

How to get a 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