Questions tagged android-intent

Explore the latest questions and answers asked by our top developers.

How to open pdf files in webview in pdfactivity?

Hello I’m developing app to open pdf files in webview in pdfactivity. I tried opening through intent its redirecting to system inbuilt apps but not find the code below, I declared this in my webview activity, private class MyWebViewClient extends WebViewClient { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { Uri uri = WebvActivity.this.getIntent().getData(); […]

Android open/view pdf: intent chooser cannot find any application for opening pdf file stored in ‘Google Drive’

I was trying to create a chooser to grant users freedom to open a pdf file with the application they prefer. Here’s my approach: private void openPdf(String pdfUrl, String mime) { // Intent pdfViewIntent = new Intent(Intent.ACTION_OPEN_DOCUMENT); Intent pdfViewIntent = new Intent(Intent.ACTION_VIEW); pdfViewIntent.setDataAndType(Uri.parse(pdfUrl), mime); Log.d(TAG, "openPdf: uri: " + Uri.parse((pdfUrl))); Intent chooser = Intent.createChooser(pdfViewIntent, "Choose […]

By ganjaam
Categorized as android, android-intent, android-intent-chooser, pdf

Share large text via whats app intent in android but i don’t want to share my data as a file

Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_TEXT, data); sendIntent.setType("text/plain"); ResultActivity.this.startActivity(sendIntent); Source: Android Questions

By Aman Joshi
Categorized as android, android-intent, android-studio, share, whatsapp

Explicit intent working single time in a loop

I am trying to run an explicit intent to set multiple alarms at different times. I am trying to do this from a CustomAdapter. I have an onclicklister on a button . The alarm is getting set for only the first value in ArrayList . Then even though the loop is running for all the […]

By Satyajit Ghosh
Categorized as android, android-intent

Android starting another application activity does not work

In Android Studio I’m trying to start another application activity, here is the code I’m using: Context otherContext; String otherContextString = "com.taozen.weather_sunshine"; try { otherContext = otherContext.createPackageContext(otherContextString, Context.CONTEXT_IGNORE_SECURITY | Context.CONTEXT_INCLUDE_CODE); } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } Class<?> otherClass = null; try { otherClass = otherContext.getClassLoader().loadClass("com.taozen.weather_sunshine.MainActivity"); } catch (ClassNotFoundException e) { e.printStackTrace(); } Intent intent […]

By Marius Nicolae
Categorized as android, android-activity, android-intent, java

Store image url in FirebaseRealTime thats retrived from intent

I am creating a project using TMDB API. I’m trying to store the image url’s in firebase storage and then receive and display them but I am not sure how to go about doing so. I would like to retrieve the image url from the intent in ActionAdapter an then store in in the database […]

By tza00
Categorized as android, android-intent, firebase, firebase-realtime-database

Set an ImageView from a different Activity

I have two Activities, in the secondary activity I have some ImageViews, by selecting one I want it to take me back to the main Activity and to show me the ImageView with the image selected in the secondary Activity. How can I do it? Source: Android Studio Questions

By vlad ivascu
Categorized as android-intent, android-studio, imageview, java

Close browser after oauth-redirect to app

I am starting an intent to launch a browser for oauth-login. String url = authUrl+"?response_type=code&client_id="+oauthSettings.getClientId()+"&state="+state+"&redirect_uri="+ Const.oauthRedirectURL; Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse(url)); startActivity(i); After the user is successfully logged in, an activity of my app is launched to handle the oauth redirect. If everything was ok, the users can use my app until they close […]

By Ef Ge
Categorized as android, android-intent, oauth

How to mock intent using Mockito?

I am attempting to mock intent inside the function I made. Here is the function below fun learningUnitTest(context: Context) { val str = context.getString(R.string.app_name) val intent = Intent(context, { flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK } // it resulting null. how to mock this? val pendingIntent: PendingIntent = PendingIntent.getActivity(context, 0, intent, 0) Log.d("AA", str) Log.d("BB", […]

By Marfin F
Categorized as android-intent, android-studio, junit, mockito, mockk

Attempt to invoke virtual method ‘java.lang.String android.os.Bundle.getString(java.lang.String)’ on a null object reference with Youtube API

I’m creating a feature for my app where a playlist is displayed and when the user clicks on the thumbnail of a video, a new activity opens which displays the video in a fragment. However the videoId doesnt seem to pass through the intent because whenever I click on the error that the bundle seems […]

By tza00
Categorized as android, android-fragments, android-intent, java
1 2 3 156

Still Have Questions?

Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us