android-intent

I tried using this Flag in setFlags from tutorial but its deprecated, what do i do

时光毁灭记忆、已成空白 提交于 2019-12-24 14:55:23
问题 FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET is deprecated; so what should I use? private Intent createShareForecastIntent() { Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); shareIntent.setType("text/plain"); shareIntent.putExtra(Intent.EXTRA_TEXT, mforecastStr + FORECAST_SHARE_HASHTAG); return shareIntent; } 回答1: Quoting the documentation: As of API 21 this performs identically to FLAG_ACTIVITY_NEW_DOCUMENT which should be used

How can I find all the packages with a particular intent filter?

旧巷老猫 提交于 2019-12-24 14:43:15
问题 I need to get the names of all the installed packages whose names being with com.mridang . In order to do this, I'm using something on the lines of the following snippet: for (PackageInfo pkgPackage : mgrPackages.getInstalledPackages(0)) { if (pkgPackage.applicationInfo.packageName.startsWith("com.mridang.")) { System.out.println(pkgPackage.applicationInfo.packageName); } } I need to only get the names of those packages which have a service containing the following intent filter com.google

Detect new data when call is given to webservice

江枫思渺然 提交于 2019-12-24 14:43:10
问题 I have app, in which i am refreshing that app in particular amount of time. Each time the call is given to webservice and all the messages in database are loaded to listview. Its done as follows: public class Messages extends Activity { protected Handler handler = new Handler(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_messages); Intent intent = getIntent(); String message = intent.getStringExtra

Spotify Android Intent Play on Launch

 ̄綄美尐妖づ 提交于 2019-12-24 14:35:03
问题 I'm trying to get Spotify to resume playback when launched from an intent but not having much luck. I think I'm close I can get Spotify to launch, and if I specify a search for an artist it will auto play but really I just want it to resume what I was last playing which I have not gotten to work yet. This site made it seem possible but with what I have so far Spotify just launches and goes to the search screen. http://developer.android.com/guide/components/intents-common.html#PlaySearch Here

Android - intent to record video on lowest quality

馋奶兔 提交于 2019-12-24 14:21:12
问题 I have a project where the user can take pictures and videos without limitation of time, so i need to record with the lowest quality. This is my code: Intent takeVideoIntent = new Intent(android.provider.MediaStore.ACTION_VIDEO_CAPTURE); takeVideoIntent.putExtra(android.provider.MediaStore.EXTRA_VIDEO_QUALITY, 0); if (takeVideoIntent.resolveActivity(getPackageManager()) != null) { startActivityForResult(takeVideoIntent, REQUEST_VIDEO_CAPTURE); } in (MediaStore.EXTRA_VIDEO_QUALITY, 0);) i made

error on creating new intent

五迷三道 提交于 2019-12-24 14:14:46
问题 what's wrong with MainActivity.this here: Intent myIntent = new Intent(MainActivity.this, SecondActivity.class); when I press Ctrl+Space it suggest MainActivity.this but then rais an error : this is Java : package com.example.explicitintent; import android.app.ActionBar; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v7.app.ActionBarActivity; import android.view.LayoutInflater; import android

Sending an intent from c++ to java in Android 5.0.1_r1

北城以北 提交于 2019-12-24 14:08:41
问题 After going through several posts I figured out I could send the intent with the following line of code (second line used for debugging): int ret = system("am broadcast -a android.intent.action.MIKE_ACCESSED --user 0"); __android_log_print(ANDROID_LOG_DEBUG, "gxp18", "Shell command returned %i", ret); Unfortunately, this returns always (No matter what is the command used in the system("...")): Shell command returned 32512 Interestingly, I can successfully send the intent through adb using:

How can I make my webview load a url shared from another app?

懵懂的女人 提交于 2019-12-24 13:53:59
问题 I'm new to developing, for my first app I'm trying to make a web browser. My problem is I cant get my webview to load a url from a shared Intent. All I get is a blank page. I've spent days searching the web, any help would be greatly appreciated. Thank you in advance! my code to get the intent (in oncreate and onresume) Intent receivedIntent = getIntent(); String receivedAction = receivedIntent.getAction(); String receivedType = receivedIntent.getType(); try { if (receivedAction.equals(Intent

Android: Task affinity & Clear task

泪湿孤枕 提交于 2019-12-24 13:22:27
问题 I am having three modules - ModuleA, ModuleB, ModuleC ModuleA - 1 activity MainActivity - no task affinity Module B - 3 activities Activity_A task affinity = "com.performance.poc.main" Activity_B task affinity = "com.performance.poc.main" Activity_C task affinity = "com.performance.poc.main" Module C - 1 activity Activity_D - no task affinity Navigation Case 1: MainActivity on btn Click - start Activity_A Intent.FLAG_ACTIVITY_NEW_TASK on btn Click - start Activity_B on btn Click - start

How to start an activity using a custom intent?

偶尔善良 提交于 2019-12-24 13:19:50
问题 I have a very simple application (an example from a textbook) that consists of 2 activities: The first activity UsingIntentActivity has a button. When this button is clicked it must lead to the second activity called SecondActivity which will show a text on the screen. I can achieve this using startActivity(new Intent(this, SecondActivity.class)); However in the textbook where I met this example another form of the same method is used: startActivity(new Intent("net.dreamingpixel