android-intent

Passing parameters between activities/fragments

◇◆丶佛笑我妖孽 提交于 2020-01-17 07:27:20
问题 Hello Android developers, I'm trying to pass arguments between two distinct activities but I've got stuck into an issue and I can't get out of it. Basically, I'm trying to pass two strings from a fragment contained in my MainActivity, MainFragment to my secondary activity, SecondaryActivity I can pass those two strings from Other Activities to the SecondaryActivity without issues. I can even do that from my NotificationService , but I can't from that specific Fragment. Debugging, I can see

Passing parameters between activities/fragments

北城余情 提交于 2020-01-17 07:27:08
问题 Hello Android developers, I'm trying to pass arguments between two distinct activities but I've got stuck into an issue and I can't get out of it. Basically, I'm trying to pass two strings from a fragment contained in my MainActivity, MainFragment to my secondary activity, SecondaryActivity I can pass those two strings from Other Activities to the SecondaryActivity without issues. I can even do that from my NotificationService , but I can't from that specific Fragment. Debugging, I can see

notification intent opens the apps main activity in background if its paused

半城伤御伤魂 提交于 2020-01-17 06:28:08
问题 I have a notification service running that will create a notification for the user and if the user clicks the notification it opens an activity to display the message, the method I am using to create the notification is : public void createNotificationMsg(String name,String doing, boolean persistent){ PendingIntent pendingIntent = PendingIntent.getActivity(getApplicationContext(), 0, new Intent(getApplicationContext(), MessageNotificationActivity.class) .setFlags(Intent.FLAG_ACTIVITY_CLEAR

Unfortunately, *name of app* has stopped

冷暖自知 提交于 2020-01-17 05:27:19
问题 I have just started programming, and I am making an android version of the swedish law book. I have no errors in the code, but when I try to run it in the emulator, it starts up, but as soon as a press a button it says "Unfortunately, name of app has stopped." I have looked through many other threads like this, but they have all been code specific and therefore of no use to me. I am using Eclipse. So, I was wondering if any kind soul could just look through what I have done a help me find a

Android - Pass Data Between Two Activities get NullPointerException

北城余情 提交于 2020-01-17 04:55:07
问题 I have 3 activities we will call them A, B and C. A and B both have intents that send the view to C. And design on which one C came from different things happen on C's activity. I pass the data like this from A to C: Intent intent = new Intent(this, C.class); intent.putExtra("Action", "A"); startActivity(intent); Then in C's onCreate method I have something like this: Bundle extras = getIntent().getExtras(); if (extras.getString("Action").equals("A")) { //DO SOMETHING } Then I from B to C I

Passing Data to listview from other activity using intent

大城市里の小女人 提交于 2020-01-17 04:20:51
问题 I'm having 2 activities in my project where 1st activity has a list view and a button and 2nd activity has EditText and other info and a Button . i want to to pass data from 2nd activity when the user enters details to 1st activity's ListView . Here when I'm entering the data it is not getting displayed in the ListView .. what is the problem ? Main Activity :- @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode,

Are there unintended consequences by registering or canceling the same alarm using different Contexts?

倾然丶 夕夏残阳落幕 提交于 2020-01-17 01:50:30
问题 I have this method to register/cancel alarms that I call from two different Activities - hence the context passed in is different each time. I designed it so that the alertId in the Uri is the unique identifier for an alarm - all other parameters class, category are the same. However, sometimes ActivityA might register an alarm with alertId = 1 by using its contextA in the pending intent. ActivityB might update the alarm with alertId = 1 by registering it again by using its contextB.

Still cannot bind to my android service

不想你离开。 提交于 2020-01-17 01:20:07
问题 I am quite new to Android and I am porting a C# program to android. Most of it is going fine but I have a long running problem of not being able to bind to 1 of my services. I wanted to start and bind to the service to receive sendBroadcast(intent) from the service. The intent includes the data package for displaying in the UI using sendBroadcast(intent) but that returns a nullpointer, presumably because it is not connected to the activity properly. I have followed so many different tutorials

How to pass model type lists using intents from the adapter to another activity

落花浮王杯 提交于 2020-01-17 01:18:06
问题 I have a Department list that contains the department names, for example, Mens, Ladies, etc. Now if suppose, I click on 'Ladies', the next screen should be displayed with the categories list that are correlated to the Department Ladies . With my present code, only the first item on the category list is displayed. This is my code for my Department Adapter: public class Department_Adapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { public static Context context; private ArrayList

startActivityForResult from ActivityGroup

自闭症网瘾萝莉.ら 提交于 2020-01-16 19:28:05
问题 I am using ActivityGroup. I use the following code from ActivityGroup in order to replace view and launch a new activity. Intent i = new Intent(SummaryCostScreen.this,PermissionsScreen.class); replaceContentView("activity1",i); public void replaceContentView(String id, Intent newIntent) { View view = getLocalActivityManager().startActivity(id, newIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)).getDecorView(); } The problem with the above code is that, I need to have startActivityForResult in