android-intent

How to get a callback from google maps in Android application, when navigation is complete

荒凉一梦 提交于 2019-12-23 16:16:07
问题 I am building an android application, that will show certain points on google maps, for which I have (lat,lang) for all the points shown, with me. Whenever, a user clicks on one of these locations on google maps, I am starting a new Google Maps intent which shows navigation to the user and is supposed to take the user to that (lat, lang). //suppose this function is called on onclick of google maps event function onclick(){ Uri gmmIntentUri = Uri.parse("google.navigation:q=32.885240,-96.763475

onNewIntent() will not fire until phone is awake

一笑奈何 提交于 2019-12-23 16:02:13
问题 I have found some interesting behavior and do not know why or how to get around it. The activity is a singletask activity, which means onNewIntent() is for the activity while the activity is on the top of the stack. This works fine and well, while the phone's screen is on . Once the screen is off however, the new intent is not received until the phone is "awake" and at that point the onNewIntent() is called. If the activity is not at the top of the stack and the phone is asleep then the

How to get List of Data in Tabbed Actvity?

拜拜、爱过 提交于 2019-12-23 15:29:07
问题 I have made a program in which i am fetching list of all my Facebook Friends with their name, dob and profile picture, but i have decided to use tabs in my existing program therefore, i have also written code for that, but whenever i run my app, every time i am getting tabs but not getting list of friends.. In my case i am not getting FriendsList Activity data in TabSample Class, why? SplashScreen.java:- private final static int FACEBOOK_AUTHORIZE_ACTIVITY_RESULT_CODE = 0; private final

How to handle SecurityException thrown back from startActivity with chooser?

丶灬走出姿态 提交于 2019-12-23 15:17:19
问题 I'm using final Intent notice = new Intent(); notice.setType("text/plain"); notice.putExtra(Intent.EXTRA_SUBJECT, "My Subject"); notice.putExtra(Intent.EXTRA_TEXT, "My Text"); try { getContext().startActivity(Intent.createChooser(notice, "Send...")); } catch(final android.content.ActivityNotFoundException ex) { Toast.makeText(getContext(), "There are no email clients installed.", Toast.LENGTH_SHORT).show(); } catch(final SecurityException ex) { Toast.makeText(getContext(), "Sorry, application

Android. How to determine the type of media file in onActivityResult()?

泪湿孤枕 提交于 2019-12-23 15:13:45
问题 I get media file from Gallery. Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.setType("image/*,video/*,audio/*"); startActivityForResult(Intent.createChooser(intent, "Select Media"), CameraUtils.REQUEST_GALLERY); How to determine the type of media file in onActivityResult()? @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == RESULT_OK) { switch (requestCode) { case CameraUtils.REQUEST_GALLERY: Uri uri = data.getData(); /

How can I send messages back and forth between ADB shell and an Android app?

扶醉桌前 提交于 2019-12-23 13:32:19
问题 I've been looking for an answer or the past 3 days, and haven't yet found one that works. I'm trying to write an Android app that can be controlled from ADB with custom commands. Is there anyway I can send strings back an forth between an app and an ADB shell? Thanks in advance, and sorry for my noob qustion. 回答1: Sure, there are several ways to do this. You could use a unix domain socket, and open it from both the android app and from a command line executable you would build by abusing the

Android: passing data back and forth using intent setResults

孤街醉人 提交于 2019-12-23 13:24:56
问题 I am creating a GPS based app for Android and there are 2 activities Main and LocNames. Main shows my map and LocNames is to get source and destination that user wants. I want to start LocNames when user selected it from menu, user enters names in boxes and I want result to be send back to Main. But I am getting exceptions in doing so. Here is how my Main calls LocNames: public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.showMyLocation:

How to call a non-activity method on Notification Click

百般思念 提交于 2019-12-23 13:08:54
问题 I have a java class MyClass which contains a method called callMethod . I want to call this method when user clicks on the notification Below is the code i used to generate the notification public class MainActivity extends AppCompatActivity { Button button; NotificationManager mNotifyMgr; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); button = (Button) findViewById(R.id.button); mNotifyMgr =

How to properly create an Intent to refer like Tez?

寵の児 提交于 2019-12-23 12:26:23
问题 In my app i have to add an intent to share my app. I looked through Tez, which shares the app icon along with a text which contains a hyperlink. How to achieve this? 回答1: private void prepareShareIntent(Bitmap bmp) { Uri bmpUri = getLocalBitmapUri(bmp); // see previous remote images section // Construct share intent as described above based on bitmap Intent shareIntent = new Intent(); shareIntent = new Intent(); shareIntent.setPackage("com.whatsapp"); shareIntent.setAction(Intent.ACTION_SEND)

How to Pass JSON Array using JSON Object

别等时光非礼了梦想. 提交于 2019-12-23 12:23:15
问题 GridView contains Categories, and when I do tap on any of the GridView item (i.e - any Category) i would like to show items those belongs to that particular Category only in ViewPager. For example, I have two categories first - Electronics and second - Appliances , still whenever i do tap on Appliances category - it showing all the items (from Electronics 1 to Appliances 2 ) whereas it has to show only items those are under Appliances category ISSUE Still showing all the items in a ViewPager,