Found 1966 Articles for Apps/Applications

Where and how to use to static variables in android studio?

Azhar
Updated on 01-Aug-2019 07:19:46

523 Views

This example demonstrates about how and where do I use static variable in android studio.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new projectStep 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.util.Log; public class MainActivity extends AppCompatActivity {    public static final String TAG = "I'm a Static Variable";    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);       setContentView(R.layout.activity_main);    } ... Read More

How to load an ImageView by URL on Android using Picasso?

Azhar
Updated on 01-Aug-2019 07:18:59

571 Views

This example demonstrates about how do I load an ImageView on Android using Picasso.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 − Gradle Scripts from Project → Click build.gradle (Module: app) → add dependency − Implementation ‘com.squareup.picasso−Picasso:2.5.2 and click “Sync now”.Step 3 − Add the following code to res/layout/activity_main.xml.             Step 4 − Add the following code to src/MainActivity.javaimport android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.widget.ImageView; import com.squareup.picasso.Picasso; public class MainActivity extends AppCompatActivity {    private ImageView ... Read More

How to get the touch position on android device?

Azhar
Updated on 01-Aug-2019 07:17:40

1K+ Views

This example demonstrates about how do I get the touch position on android device.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new projectStep 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.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.MotionEvent; import android.view.View; import android.widget.EditText; import android.widget.TextView; public class MainActivity extends AppCompatActivity {    TextView T;    EditText E1, E2;    float x = 0f;    float y = 0f;   ... Read More

How to call OnDestroy Activity in Android app?

Azhar
Updated on 01-Aug-2019 07:16:37

748 Views

This example demonstrates about How do I call OnDestroy Activity 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 − Add the following code to src/MainActivity.javapackage com.sample.q2; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; public class MainActivity extends AppCompatActivity {    public static final String MY_TAG = "Destroy";    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);       setContentView(R.layout.activity_main);       Log.i(MY_TAG, "onCreate"); ... Read More

How to change color of Button in Android when Clicked?

Azhar
Updated on 01-Aug-2019 07:15:44

4K+ Views

This example demonstrates about How do I change the color of Button in Android when clicked.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; public class MainActivity extends AppCompatActivity {    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);       setContentView(R.layout.activity_main);       final Button button = findViewById(R.id.button);     ... Read More

How do I prevent an iOS device from going to sleep mode?

Mohtashim M
Updated on 30-Jul-2019 22:30:26

1K+ Views

When most apps have no touches as user input for a short period, the system puts the device into a "sleep” state where the screen dims. This is done for the purposes of conserving power.Preventing iOS Device from going to sleep is easy, navigate to your Settings → Display & Brightness → Autolock, select never.This will never lock your screen.If you’re developing an iOS Application and you’re required to implement this feature, you should use isidletimerdisabled provided by apple, to read more about it https://developer.apple.com/documentation/uikit/uiapplication/1623070-isidletimerdisabledIn your viewDidLoad method write the following line of code to prevent the device from going to ... Read More

How to count number of characters in Text box while typing in iOS?

Mohtashim M
Updated on 30-Jul-2019 22:30:26

1K+ Views

As an iOS developer one should know how to manipulate with text field and it’s operation, Apple has already provided UITextFieldDelegate protocol.To read more about it https://developer.apple.com/documentation/uikit/uitextfielddelegateYou may have seen may application where forms are involved, and you see number of characters you’re entering when you type specially on the forms where characters are restricted to certain count.In this post we’re going to see the same how to display the character count, when you type in TextField.Step 1 − Open Xcode → New Project → Single View Application → Let’s name it “TextFieldCount”Step 2 − Open Main.storyboard and add TextField and ... Read More

Where and how to use static variable in swift?

Mohtashim M
Updated on 30-Jul-2019 22:30:26

7K+ Views

Before we see where and how to use static variable, let us first understand, What is static variable in swift?Static VariableStatic variables are those variables whose values are shared among all the instance or object of a class. When we define any variable as static, it gets attached to a class rather than an object. The memory for the static variable will be allocation during the class loading time.Let us understand above figure, we have a class Sample and it has two object s1 and s2. You see s1 and s2 both have their variable “a” separately but they have ... Read More

Set Border for an ImageView in iOS?

Mohtashim M
Updated on 30-Jul-2019 22:30:26

1K+ Views

Setting border for image view is easy, In this post we will see how to set Border for an Image View in iOS.Let’s get started.Step 1 − Open Xcode → New Project → Single View Application → Let’s name it “BorderToImage”We will create an image view and a button in our storyboard on tap of button we will add border to image view. We could do the same in viewDidLoad but to see the difference we’re doing this.Step 2 − In Main.storyboard add an image view and a button as shown below.Step 3 − Create @IBOutlet for image and name ... Read More

How to enable/disable data connection in iOS programmatically?

Mohtashim M
Updated on 30-Jul-2019 22:30:26

305 Views

User can turn on or turn off mobile data from settings of an iOS device, but it’s practically not possible to disable or enable the same programmatically. It is only possible if you jailbroke an iOS device.. Apple does not allow any apps developer to access wifi or Bluetooth.There are some private API’s which may aid this but eventually result in app rejection from the app store.

Advertisements