android-intent

FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY not set in Nexus 10 (Android 4.4.2)

左心房为你撑大大i 提交于 2019-12-24 02:02:07
问题 I have a main activity A which will call another activity B whose oncreate() is mentioned below. When I press home button while in activity B and press recent apps, the flag FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY is never set. I'm using a samsung nexus 10 (Android 4.4.2). protected void onStart() { super.onCreate(savedInstanceState); if ((getIntent().getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) != 0) { //Call Main Activity. } else { //Continue creating this activity } } When I placed

Intent android youtube player app in full-screen mode

感情迁移 提交于 2019-12-24 01:57:24
问题 Could we make an intent for youtube player app in portrait(full-screen-horizontal) mode. I want "my android app users" to open youtube video in full screen? How can I prevent my users from seeing the youtube videos' details, comments, view number, etc by letting them only the portrait view(full screen)? Even if they use the android phone vertically, how can I let them only horizontal-full screen view of youtube player thereby forcing them to turn their phone. ? 回答1: As for YouTube v4.1.47,

Get Intent from PendingIntent causes SecurityException

佐手、 提交于 2019-12-24 01:56:14
问题 We have some old code that worked for a long time: public static Intent getIntent(PendingIntent pendingIntent) { Intent intent = null; try { Method getIntent = PendingIntent.class.getDeclaredMethod("getIntent"); intent = (Intent) getIntent.invoke(pendingIntent); } catch (Exception e) { // Log line } return intent; } We are now getting a security exception: java.lang.reflect.InvocationTargetException at java.lang.reflect.Method.invoke(Native Method) at com.company.util.IntentUtils.getIntent

How to move again MainActivity after sending the mail?

佐手、 提交于 2019-12-24 01:27:43
问题 I am developing one app, in which I am sending the email with the help of intent. I am successfully sending the mail from MainActivity, but problem is that, as I am clicking on send button for sending the email, I am going to outside of the app. But after sending the email I want to come again on MainActivity. Here is my code. protected void sendEmail() { String[] TO = {"xxx@gmail.com"}; Intent emailIntent = new Intent(Intent.ACTION_SEND); emailIntent.setData(Uri.parse("mailto:"));

Passing and ArrayList<Service> through intent

天大地大妈咪最大 提交于 2019-12-24 01:27:14
问题 I have a class called Service, which is used to create Service objects using this constructor public Service(int id, String service_name, String service_code) { this.id = id; this.service_name = service_name; this.service_code = service_code; } then I create a list call service list as with the following signature List<Service> serviceList = new ArrayList<Service> I have try to pass this ArrayList through Intent Object like this Intent i = new Intent(Classname.this, anotherClass.class); i

How to pass data from a non-activity class to an activity in android?

两盒软妹~` 提交于 2019-12-24 01:25:57
问题 I'm building my app and I'm using socket.io to communicate with a webserver. I have java files that take care of that which are not activities and run in the background. So to start them, it will be instantiated in an activity and the sockets will run. Now the webserver triggers messages which I handle in the callback and pass the data to an activity. Now I'm looking for the best way to pass data from a running non-activity class to an activity currently running. What I did before was using

How can go in last activity with resume button?

北慕城南 提交于 2019-12-24 01:16:06
问题 My app works fine, but my purpose is that when I close the app then run it again, my app opens at the last activity. I want when I open again main activity become to show and if I clicked resume then last activity open. So I have 4 Activity called Main Activity (my main) , p1 , p2 , p3 : Main Activity: public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_page); Button resume

Unable to set picture as. “No appps can perform this action”

假装没事ソ 提交于 2019-12-24 01:06:58
问题 I am trying to give users an option to set image as wallpaper/whatsapp dp like this. But I'm stuck with this code Uri sendUri = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.a_day_without_thinking_mobile); Intent intent = new Intent(Intent.ACTION_ATTACH_DATA); intent.setDataAndType(sendUri, "image/jpg"); intent.putExtra("mimeType", "image/jpg"); startActivity(Intent.createChooser(intent,"Set As")); It shows a dialog that no apps can perform this action. I also tried to

How do I navigate back to my app after user grants Usage Access Permission in Kotlin

与世无争的帅哥 提交于 2019-12-24 01:04:51
问题 I need my app to return automatically to my application once the user grants permission of usage stats access through toggle/switch button in Settings Screen. This is possible in Google FILES app. PSB FLOW from Google File App: Google Files APP Flow How do I achieve this in my Kotlin app. I have tried multiple ways, but could not achieve it. Please advise. Thank You. MAIN ACTIVITY class MainActivity : AppCompatActivity() { private lateinit var usage: UsageStatsManager private lateinit var

android services life time continuation

被刻印的时光 ゝ 提交于 2019-12-24 01:04:28
问题 In mainactivity I have Broadcast Receiver, pending intent, and alarm manager. It triggers as per selected time (System.currentTimeMillis() + smstimeinmilliseconds). Intent intent = new Intent(this, DBBroadcastReceiver.class); intent.putExtra("message", message); PendingIntent pendingIntent = PendingIntent.getBroadcast(this, id, intent, 0); AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE); alarmManager.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() +