android-intent

Add items to listview from other activity

て烟熏妆下的殇ゞ 提交于 2019-12-26 12:23:27
问题 scenario: First mainactivity launches and from the menu option user launches second activity using intent and there he adds some text to edittext and get that edittext value using intent to the first activity and add that value to the listview. FirstActivity: public class MainActivity extends Activity { ListView lv; EditText et; String AddedTask ; ArrayList<Model> modelList; CustomAdapter adapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState

I am trying this code to share pdf fromAsset of app But it's showing error

泪湿孤枕 提交于 2019-12-25 18:57:13
问题 I am trying this code to share pdf fromAsset of app But it's showing error InputStream outputFile = getAssets().open("new-age-careers-careers-that-didnt-exist-20-yr-ago.pdf") ; Uri uri = Uri.fromFile( (File) InputStream ); **Here is my code ** Intent share = new Intent(); share.setAction(Intent.ACTION_SEND); share.setType("application/pdf"); share.putExtra(Intent.EXTRA_STREAM, uri); share.setPackage("com.whatsapp"); activity.startActivity(share); 回答1: public class MainActivity extends

How to call an activity from a Dialogfragment in android?

泪湿孤枕 提交于 2019-12-25 18:29:05
问题 I want to call an activity from Dialogfragment, I have attached the code and logcat below for your reference on what I have tried.Kindly provide me your knowledge on it. Thank you. Intent intent = new Intent(getActivity(), LinkActivity.class); getActivity().startActivityForResult(intent, 0); Logcat: 02-12 13:47:17.345: E/AndroidRuntime(670): FATAL EXCEPTION: main 02-12 13:47:17.345: E/AndroidRuntime(670): java.lang.NullPointerException 02-12 13:47:17.345: E/AndroidRuntime(670): at android

How to get the list of installed Browser Apps in an Android Device Programmatically (Package Names)

怎甘沉沦 提交于 2019-12-25 18:27:56
问题 How to get the list of Installed Browser Apps Package Names in an Android Device Programmatically, So that I have to show the list of Browser Apps in my Mobile. 回答1: Create an Intent that describes the type of activity that you want to match. Pass that to queryIntentActivities() on a PackageManager . The resulting list of ResolveInfo objects contains details of the activities — and their associated apps — that match the Intent . If the list is empty, there are no matches. 来源: https:/

using image button, in each listview item row and trying to start a new activity [closed]

删除回忆录丶 提交于 2019-12-25 18:17:16
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . I am using image button, in each listview item row and trying to start a new activity using Button onClick listener, but getting:- the source attachment does not contain source for the ComponentName.class package

VLC intent always returns result code 0 - RESULT_CANCELED

三世轮回 提交于 2019-12-25 17:49:31
问题 This code works fine and starts video playback as expected, but when backing out of VLC in our Cordova app, the correct requestCode (42) is returned, but resultCode is always 0 (RESULT_CANCELLED) and returned Intent is null. The same thing occurs if the video finishes playing and VLC exits on its own. According to the documentation, we should be getting RESULT_OK with a return Intent containing information such as extra_position (to get the video position upon exit). Other Intents work fine,

VLC intent always returns result code 0 - RESULT_CANCELED

我只是一个虾纸丫 提交于 2019-12-25 17:48:05
问题 This code works fine and starts video playback as expected, but when backing out of VLC in our Cordova app, the correct requestCode (42) is returned, but resultCode is always 0 (RESULT_CANCELLED) and returned Intent is null. The same thing occurs if the video finishes playing and VLC exits on its own. According to the documentation, we should be getting RESULT_OK with a return Intent containing information such as extra_position (to get the video position upon exit). Other Intents work fine,

Open Default Browser Settings page programmatically

淺唱寂寞╮ 提交于 2019-12-25 16:53:31
问题 Is there a way to open the settings page of the default browser for Android programmatically from an application? Through some intent? or Maybe some other way to do it? 回答1: Yes, we can use this code for call Browser settings page from our application Intent i = new Intent(Intent.ACTION_MANAGE_NETWORK_USAGE); // It launches Chooser without specify the package name becz ACTION_MANAGE_NETWORK_USUAGE // action is used in Other apps also. i.setPackage("com.android.browser"); startActivity(i);

Eclipse Android Project Throws Class Not Found Error During Runtime

浪尽此生 提交于 2019-12-25 16:48:14
问题 I am trying to incorporate ZXing into my own android app via intent, and am having difficulty. I can compile my code fine, but when it tries to call the following after a button click it dies on the IntentIntegrator() constructor: public void ScanCheck(View view){ try{ IntentIntegrator integrator = new IntentIntegrator(MainActivity.this); integrator.initiateScan(); }catch(Exception e){ return; } } the above code is verbatim and MainActivity is the name of my class. I typically program in C#

Adding a different putExtra to an intent for each dynamically created button

99封情书 提交于 2019-12-25 14:48:27
问题 I'm creating buttons dynamically to a linear layout and after a button is clicked it goes to a new activity. I want to pass along a string with information about which button was clicked with that activity as a putExtra. For some reason the intents that I add to the each buttons onClickListener get overwritten so it only sends the string of the last button and not the one that is clicked: LinearLayout l = (LinearLayout) findViewById(R.id.allOptions); for(int i=0; i<currentOptions.size(); i++)