android-intent

Android - Shared-preferences in Broadcast

谁都会走 提交于 2020-01-06 06:13:39
问题 In my BroadcastReceiver class I am using ISharedPreferences to store a string coming from a service and compare it with the previous string (which is stored in my Preferences). BroadcastReceiver.cs [BroadcastReceiver] [IntentFilter(new[] { "TEST" })] public class Receiver : BroadcastReceiver { public override void OnReceive(Context context, Intent intent) { ISharedPreferences pref = PreferenceManager.GetDefaultSharedPreferences(context); ISharedPreferencesEditor editor = pref.Edit(); string

Android - Shared-preferences in Broadcast

情到浓时终转凉″ 提交于 2020-01-06 06:12:27
问题 In my BroadcastReceiver class I am using ISharedPreferences to store a string coming from a service and compare it with the previous string (which is stored in my Preferences). BroadcastReceiver.cs [BroadcastReceiver] [IntentFilter(new[] { "TEST" })] public class Receiver : BroadcastReceiver { public override void OnReceive(Context context, Intent intent) { ISharedPreferences pref = PreferenceManager.GetDefaultSharedPreferences(context); ISharedPreferencesEditor editor = pref.Edit(); string

How to reuse intents in Android

℡╲_俬逩灬. 提交于 2020-01-06 05:49:05
问题 Hello All: I am creating an application in which I am using menus on every screen for the user to navigate. In my application, I have Screen1--> comes as home screen when the user logs in Screen2--> user goes to this screen to perform some operations. Now on Screen2 I want to have menu option to let the user go to home screen. But to start the activity we do startActivity(new Intent(Home.this, Screen2.class)); But, I want to use the existing home screen which was created when the used logged

Cannot pass selfmade serializable object to another activity via intent

吃可爱长大的小学妹 提交于 2020-01-06 05:28:29
问题 I created an object which contains data fields of the types ImageView, boolean and Integer. public class MemoryCard implements View.OnClickListener, Serializable { private ImageView image; private int id; private int nr; private boolean clicked = false; private int cardBack; private int cardFront; public MemoryCard(Context context, int id, int nr, int cardFront) { this.id = id; this.nr = nr; this.cardBack = R.drawable.backside; this.cardFront = cardFront; this.image = new ImageView(context);

Why is my ACTION_SEND working on API 25+ perfectly, but messes up on previous APIs?

狂风中的少年 提交于 2020-01-06 05:14:25
问题 So I have a Share button that will share an image and a body of text. On Nougat (API 25) and Oreo (API 26), it works absolutely perfectly. But when it comes to a couple older version it doesn't work as expected. Marshmallow (API 23): Inserts the image just fine but no body of text. Lollipop (API 22): Crashes when you push the Share button with popup error "Unfortunately, Messaging has stopped." LOGCAT isn't showing me any errors when this happens. Here is my share button code: if (id == R.id

How filter JSON files with Intent.ACTION_OPEN_DOCUMENT?

和自甴很熟 提交于 2020-01-06 04:43:06
问题 When I try to open a .json file with startActivityForResult(Intent(Intent.ACTION_OPEN_DOCUMENT).apply { addCategory(Intent.CATEGORY_OPENABLE) type = "application/json" }, 0) the chooser lists files of all types instead of just .json files. And what's worth, all files are greyed out, I can't select any, not even my .json files. However, when I change application/json to */* , the files aren't greyed out and I can open them. With ACTION_GET_CONTENT instead of ACTION_OPEN_DOCUMENT the behaviour

Pass the value from 1st activity to 2nd activity in android

。_饼干妹妹 提交于 2020-01-06 04:30:07
问题 As am getting article title on textview on first activity.how can i pass these textview to next activity... I have used below code: for ( j = 0; j <Appscontent.Sub_arraylisttwo.size(); j++) { LinearLayout ly = new LinearLayout(this); ly.setOrientation(LinearLayout.VERTICAL); ly.setOnClickListener(mArticleClick); TextView tv = new TextView(this); tv.setText(Appscontent.Sub_arraylisttwo.get(j)); ly.addView(tv); lLayout.addView(ly); } int num=Integer.parseInt(number); number=String.valueOf(num

why getStringExtra doesn't give the proper output?

﹥>﹥吖頭↗ 提交于 2020-01-06 04:22:07
问题 I'm was trying to pass some String from one intent to another. but adt says: Key text expected String but value was a android.text.SpannableString. The default value was returned. but I'm using a String as key not what it claims! here's the code for my first activity: private int CONTACTS_ACTIVITY_REQUEST = 1001; public static final String TEXT_KEY = "text"; ... Intent intent = new Intent(this, ContactsActivity.class); intent.putExtra(TEXT_KEY, text.getText()); startActivityForResult(intent,

Does WhatsApp uses the native Gallery while sharing images

怎甘沉沦 提交于 2020-01-06 03:53:20
问题 I am wondering if WhatsApp uses the native Android gallery or its own custom gallery. Basically this gallery allows the user to select multiple images. But I don't seem to find any way to select multiple images if I am to use the native images gallery. Being aware that Intent.ACTION_PICK is the basic to call the native images gallery but this allows the user to pick one image at a time. As WhatsApp allows the user to select multiple images, I want to find a way to do the same. Not sure

Does WhatsApp uses the native Gallery while sharing images

天大地大妈咪最大 提交于 2020-01-06 03:53:05
问题 I am wondering if WhatsApp uses the native Android gallery or its own custom gallery. Basically this gallery allows the user to select multiple images. But I don't seem to find any way to select multiple images if I am to use the native images gallery. Being aware that Intent.ACTION_PICK is the basic to call the native images gallery but this allows the user to pick one image at a time. As WhatsApp allows the user to select multiple images, I want to find a way to do the same. Not sure