android-intent

Intent extra gets cleared out from unknown reason

三世轮回 提交于 2019-12-25 00:43:22
问题 I have Activity A which starts Activity B with following code: Intent intent = new Intent(this, B.class); intent.putExtra("foo", new MySerializableObject()); startActivity(intent); In B "foo" is received correctly and then I create PendingIntent to start itself after some time, you can think about it as some alarm clock app. Anyway the mysterious thing is that when I schedule this intent in following way: Intent intent = new Intent(context, B.class); intent.putExtra("bar", true);

Alternatives for Pushing data from an Android Service to an Activity

做~自己de王妃 提交于 2019-12-25 00:42:29
问题 I've a service that is receiving UDP data from the network. I want to push this data from the service to a UI activity. One way to do it is using broadcast Intents . What is the performance overhead of sending broadcasts frequently from the service to the activities? Are there any other alternatives for doing this ? Thanks. 回答1: Not sure of the overhead of Broadcasting Intents but a topic similar to this was discussed a few days ago. 来源: https://stackoverflow.com/questions/3149339

Intents for EditText LongPress

随声附和 提交于 2019-12-25 00:35:55
问题 i want my application to be seen when a user long presses on edit text to copy or paste. or clicks on copy or paste. i tried with different intents like ACTION_PASTE , ACTION_EDIT But none are working for me !! Please help me out Thanks in advance. 回答1: There is no way for you to automatically appear in the action mode or context menu that appears when the user selects text in an EditText for other applications. For your own EditText widgets, you can use setCustomSelectionActionModeCallback()

How to finish the Ads_Fullscreen Activity in 8 seconds and lunch the MainActivity after wards?

帅比萌擦擦* 提交于 2019-12-25 00:31:11
问题 Two situation for Splash Screen if ads is enable then Splash Screen time will be 2 seconds and Ads_Fullscreen time will be 8 seconds then final Main Activity will come. if ads is not enable then Splash Screen time will be 5 seconds and then Main Activity will come. This is code for splash screen new Handler().postDelayed(new Runnable() { @Override public void run() { Intent i; if (prefManager.isFirstTimeLaunch()){ i = new Intent(SplashScreen.this,WelcomeActivity.class); prefManager

getting data from first activity to fourth activity in android

社会主义新天地 提交于 2019-12-25 00:23:59
问题 i want to get text written in the EditText first activity and set that text to the another EditText which is fourth activity. 回答1: Use this code in your first activity Intent intent = new Intent(context,Viewnotification.class); intent.putExtra("Value1", youredittextvalue.getText().toString()); startActiviy(intent); And in your fourth Activity Bundle extras = getIntent().getExtras(); String value1 = extras.getString("Value1"); yourfourthactivityedittext.setText(value1); 回答2: 1- use

How can i get the Audio file that the user picks

假装没事ソ 提交于 2019-12-25 00:16:29
问题 I would want to get a handle to the actual audio file that i pick. For selecting the audio file, i have an intent that looks like this : Intent audioIntent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Audio.Media.EXTERNAL_CONTENT_URI); startActivityForResult(audioIntent , 0); It allows me to get a popup to pick audio files from but how can i get the file that i have picked ? In the case of images, i have : bitmap = android.provider.MediaStore.Images.Media.getBitmap

Android- How to check the type of Intent Filters Programmatically?

∥☆過路亽.° 提交于 2019-12-24 22:51:13
问题 I'm Creating an android application with two Activities(Activity1 and Activity2) where I need to open the app in two ways . Way 1 : By NFC Card In this way ,I need to open the Activity1. ie., If I swipe the Card I need to open Activity1. Way 2 : By Icon In this way,I need to open the Activity 2 .ie., If the user click the icon the Activity2 must be opened . My AndroidManifest.xml is shown below , ............... ............... ............... <activity android:name=".Activity1" android

Starting a new Activity but I get an ActivityNotFoundException

萝らか妹 提交于 2019-12-24 22:14:19
问题 Ok so.. when I plug in my phone to the computer it starts the application and after the sleep() is finished it crashes with the error shown at the bottom. All of my code which I think you will need is shown in the quotations. Really baffled Why I am getting this problem. I have my mainActivity.java file looking like this: public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Thread timer = new Thread(){ public void run(){ try{

how to share images inside assets folder with intent to other application

北战南征 提交于 2019-12-24 20:20:18
问题 i want to share images inside an assets folder using intent to the following applications hangout whatsapp line chat viber tango wechat i have try this code for whatsapp but it given me file not supported public void share (){ String file = "file:///android_asset/food/apple.png"; Uri filePath = Uri.fromFile(new File("content://com.example.zainabishaqmusa.postemoji/assets/gestures/aok.png")); final ComponentName name = new ComponentName("com.whatsapp", "com.whatsapp.ContactPicker"); Intent

move one image from one activity to another activity in android on selecting gridview

痴心易碎 提交于 2019-12-24 20:18:45
问题 i have a grid view which contain images when click on one image it should open in a another page.ie i need to pass the image from one activity to another where i want to get the pixels of the image.i have the code to get the pixels.what i need is that i have to show the image in anther activity so that to get the pixels.how to pass the selected image from one activity to another in android .i have tried some of the solution from stack overflow but it did not worked //GridviewActivity.java