How to get list of settings in android - java

Does anyone know where can I find a full list of settings?
This is my code it works, the only problem I have I cannot find the line to bring up the google voice settings I'm looking for:
if (Build.VERSION.SDK_INT >= 14){
Intent intent = new Intent();
intent.setAction("com.android.settings.TTS_SETTINGS");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}else {
Intent intent = new Intent();
intent.addCategory(Intent.CATEGORY_LAUNCHER);
intent.setComponent(new ComponentName("com.android.settings", "com.android.settings.TextToSpeechSettings"));
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}

Related

Duckduckgo Android search Intent

Anyone knows the intent to search directly through the official Duckduckgo app on Android?
Tried this one so far, i think they dont have a query key in extras
Intent intent = new Intent(Intent.ACTION_SEARCH);
intent.setPackage("com.duckduckgo.mobile.android");
intent.putExtra("query", subject);
context.startActivity(intent);
It is actually pretty simple than i thought
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("https://duckduckgo.com/?q=" + subject));
try {
intent.setPackage("com.duckduckgo.mobile.android");
context.startActivity(intent);
} catch (ActivityNotFoundException a) {
intent.setPackage(null);
context.startActivity(intent);
}

Open File-Intent in all devices through the same code or by applying any logic

I want to choose a file via an Android File Manager.
so, to open file intent code is
Intent intent = new Intent();
intent.setType("file/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent,"Select File"), 1);
But I was unable to access file manager in samsung devices to resolve this problem i do
Intent intent = new Intent("com.sec.android.app.myfiles.PICK_DATA");
intent.putExtra("CONTENT_TYPE", "*/*");
intent.addCategory(Intent.CATEGORY_DEFAULT);
startActivityForResult(intent, 1);
But this code in not working in other devices so what should i do to open file manager in all devices ?
private void openFile(int requestCODE) {
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
i.setType("*/*");
startActivityForResult(intent, requestCODE);
}

Android - Run a system settings activity

If I run this code
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setComponent(new ComponentName("com.android.settings",
"com.android.settings.Settings$NotificationAppListActivity"));
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
I get this
PICTURE 1
Instead,I want that the startActivity(intent) opens the activity that appears when I tap on the "Phone" view in the list
PICTURE 2
How can I get this ? Thanks
Use This..
Intent intent = new Intent(android.provider.Settings.ACTION_SETTINGS);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
Or Edit your code line 2
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setComponent(new ComponentName("com.android.settings",
"com.android.settings.Settings"));
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
Because ComponentName method get 2 parameter 1. package name and 2. class name ComponentName(String pkg, String cls) first one, package name is ok but class name com.android.settings.Settings$NotificationAppListActivity that means you want to open Notification settings
try this way
Intent intent = new Intent();
intent.setAction("android.settings.APP_NOTIFICATION_SETTINGS");
intent.putExtra("app_package", getPackageName());
intent.putExtra("app_uid", getApplicationInfo().uid);
startActivity(intent);
Use this:
startActivity(new Intent("android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS"));

Android how to delete application shortcut?

When I create a shortcut for my application, and when I want to delete shortcut with code, how should I do it? I try some method but not used.
The create shortcut code:
Intent shortcut = new Intent("com.android.launcher.action.INSTALL_SHORTCUT");
shortcut.putExtra(Intent.EXTRA_SHORTCUT_NAME, "test");
shortcut.putExtra("duplicate", false);
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
intent.setClass(this, SecondActivity.class);
shortcut.putExtra(Intent.EXTRA_SHORTCUT_INTENT, intent);
Intent.ShortcutIconResource iconRes = Intent.ShortcutIconResource.fromContext(this, R.drawable.ic_launcher);
shortcut.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, iconRes);
sendBroadcast(shortcut);`
The delete shortcut code:
actionIntent.addCategory(Intent.CATEGORY_LAUNCHER);
actionIntent.setClass(this, SecondActivity.class);
Intent intent = new Intent("com.android.launcher.action.UNINSTALL_SHORTCUT");
intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, "taotao");
intent.putExtra("duplicate", false);
intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, actionIntent);
sendBroadcast(intent);`

Clearning Stack of Activities unto the Top

I want to perform a logout function in which I want to clear all the activities before the logout and start a new Login Activity
Here is my code
Utilities.logoutPlayerDefaults(Profile.this);
Utilities.vibrate(Profile.this);
Intent myIntent = new Intent (Profile.this,FBLogin.class);
myIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(myIntent);
But it doesn't work. If i press back button i go back to Profile
Try following way,
#Override
public void onBackPressed()
{
Intent myIntent = new Intent (Profile.this,FBLogin.class);
myIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
myIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
myIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(myIntent);
super.onBackPressed();
}
Change your code to below :
Utilities.logoutPlayerDefaults(Profile.this);
Utilities.vibrate(Profile.this);
Intent myIntent = new Intent (Profile.this,FBLogin.class);
myIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(myIntent);
finish();

Categories