I want to open (start) activity named: "Language and input", where the user can change the device language.
startActivity(new Intent(Locale....));
It's in the Locale or... settings? Where is it?
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. In the above code, we have taken button view to open YouTube application.
createChooser(intent, title); // Try to invoke the intent. // Define what your app should do if no activity can handle the intent. This displays a dialog with a list of apps that respond to the intent passed to the createChooser() method and uses the supplied text as the dialog title.
Starting activities or services. To start an activity, use the method startActivity(intent) . This method is defined on the Context object which Activity extends. The following code demonstrates how you can start another activity via an intent.
If you want to make Login activity your main activity then put the the intent-filter tag inside Login activity. Any activity your want to make your main activity must contain intent-filter tag with action as main and category as launcher.
try this:
Intent intent = new Intent();
intent.setComponent( new ComponentName("com.android.settings","com.android.settings.Settings$InputMethodAndLanguageSettingsActivity" ));
startActivity(intent);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With