Tag: android-intent

How to start android service from another Android app

I’m having a problem starting a service from another Android app (API 17). However, if I do run ‘am’ from the shell, the service starts fine. # am startservice com.xxx.yyy/.SyncService Starting service: Intent { act=android.intent.action.MAIN cat= [android.intent.category.LAUNCHER] cmp=com.xxx.yyy/.SyncService } (service starts fine at this point) # am to-intent-uri com.xxx.yyy/.SyncService intent:#Intent;action=android.intent.action.MAIN; category=android.intent.category.LAUNCHER; component=com.xxx.yyy/.SyncService;end So, it doesn’t […]

data in onActivityResult is null

I am trying do a simple application for Android. I have two Activities (A and B). In B I only want select a date. I start A, and do: Intent intent = new Intent(); intent.setClass(this, B.class); startActivityForResult(intent,1); Then, in B, I do: Intent intent = getIntent(); setResult(RESULT_OK); intent.putExtra(“Date”,dateSelected); finish(); And, in A, i have the […]

The constructor Intent(new View.OnClickListener(){}, Class<DrinksTwitter>) is undefined

I am getting the following error: The constructor Intent(new View.OnClickListener(){}, Class<DrinksTwitter>) is undefined In the following code snippet: @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); // Get the EditText and Button References etUsername = (EditText)findViewById(R.id.username); etPassword = (EditText)findViewById(R.id.password); btnLogin = (Button)findViewById(R.id.login_button); btnSignUp = (Button)findViewById(R.id.signup_button); lblResult = (TextView)findViewById(R.id.result); // Set Click Listener btnLogin.setOnClickListener(new OnClickListener() { […]

Android: Starting app from 'recent applications' starts it with the last set of extras used in an intent

Bit of a confusing problem for me here: I’ve got a home screen widget which, when clicked, starts my main app Activity with a few extras put in the intent: Intent start = new Intent(context, Main.class); start.putExtra(“action”, “showXYZ”); start.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(start); This all works fine, it starts my activity and my activity receives the extras as […]

How to get the file name from the intent?

This is my manifest file. After using intent filter i download the ics file from the mail attachment. When i open the downloaded file it start my application. I need to get the file name and data of the selected file in my application. What should i do in the manifest and the java file. […]

Espresso intent test failing

I’m learning android instrumentation testing with espresso. I have a app which has a drawermenu and there is menu called About. I was testing click on that menu item and contents of activity. testfunction: @Test public void testNavigationDrawerAboutMenu() { onView(withId(R.id.drawer_layout)) .perform(DrawerActions.open()); //open drawer onView(withText(“About”)).perform(click()); onView(withId(R.id.aboutsptemail)).check(matches(withText(R.string.screen_about_support_email))); onView(withId(R.id.aboutcpright)).check(matches(isDisplayed())); onView(withId(R.id.aboutprivacy)).check(matches(isDisplayed())); onView(withId(R.id.abouttermsconditions)).check(matches(isDisplayed())); onView(withId(R.id.aboutsptemail)).perform(click()); } now the last textview has […]

Android intent filter data path example

I tried using the following data in my intent filter: <data android:scheme=”http” android:host=”an.example.i.p” android:pathPrefix=”t” /> Why doesn’t the following url trigger it? http://an.example.i.p/t/v2.aspx/chase/a.test.auto

Android limit time recording using intent

How can I limit recording when using intents ? I tryed this code: Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); intent.putExtra(“android.intent.extra.durationLimit”,5); startActivityForResult(intent,RQS_RECORDING); This part of code works fine when I record video. Time is countdown from 5 to 0 and after 5 seconds recording automatically stop. But this limited time does not work when I record sound. […]

How to use Intent.ACTION_APP_ERROR as a means for a “feedback” framework in Android?

I would like to reuse the Intent.ACTION_BUG_REPORT in my app, as a simple means of getting user feedback. Google Maps uses it as their “Feedback” option. But I’ve not been successful in firing the event. I’m using the following in a onOptionsItemSelected(MenuItem item): Intent intent = new Intent(Intent.ACTION_BUG_REPORT); startActivity(intent); And in my AndroidManifest.xml I’ve declared […]

Share Intent of Google+ can not access image

i am calling an intent to share an image. this works with most providers, BUT with Google+. Google+ opens the post activity without the image and displays the toast “You can only post photos stored on your device.” at the same time. File f = storeImage(image); // f = /data/data/com.myapp/files/1333070776978.jpg Uri uri = Uri.fromFile(f); Intent […]

Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.