android-intent

Skip going back to direct parent activity when pressed back

人盡茶涼 提交于 2019-12-28 13:55:13
问题 I have got a small problem in an Android app I am working on : There are 3 activities namely A , B , C and the invocation is in the following order : A -> B -> C. While in C, when I press BACK button, it should go back to A[Instead of the B by default]. And pressing BACK in A will exit the program. I tried to call an intent from C to A. But in this case the call invocation gets into a loop : A -> B -> C -> A since the new activity is pushed on top of the stack. As a result, when BACK is

Intent.setData vs Intent.putExtra

杀马特。学长 韩版系。学妹 提交于 2019-12-28 13:40:17
问题 I'm trying to follow this tutorial: http://www.vogella.com/articles/AndroidCalendar/article.html I understand what putExtra does but I fail to understand what setData() means? Android Docs, wasn't much helpful: Set the data this intent is operating on. what does this mean for the constant intent.setData(CalendarContract.Events.CONTENT_URI); ? There doesn't seem to be any affect when I comment out this line. 回答1: setData() is used to point to the location of a data object (like a file for

Intent to open Instagram user profile on Android

℡╲_俬逩灬. 提交于 2019-12-28 08:07:56
问题 I'm developing a social networking app and our users can connect their Instagram account to our service. I'd like to open Instagram profiles directly in their official Android app (if it is installed) but I can't find any way to do that. However, there is a page on their developer site about the exact same feature on iOS but this doesn't seem to work on Android at all. Everything I found on the web only suggests various ways to open links in a browser. Any suggestions? 回答1: I solved this

Intent filter works on emulator but not on device

二次信任 提交于 2019-12-28 07:05:09
问题 I'm creating a custom intent filter which will open my app when I tap a file with a certain file extension ( .myextension in this case.) The intent-filter is below. This currently works perfectly every time I open a .myextension file from my emulator. However, when I try it from my device, it no longer works. On my device, when I tap a .myextension file in the Files browser app, I see Unable to preview file. instead of automatically opening the app. I've tried opening the file from quite a

How to using intents to view calendar data?

浪子不回头ぞ 提交于 2019-12-28 06:39:05
问题 I made this code: long eventID = 208; Uri uri = ContentUris.withAppendedId(Events.CONTENT_URI, eventID); Intent intent = new Intent(Intent.ACTION_VIEW) .setData(uri); startActivity(intent); I made sure the EventID was correct, and the event-title showed in the view was correct. THE PROBLEM is the event time was incorrect, like: 1970-1-1 8:00. Why? Anyone can Help? Thanks. 回答1: You have to add the event begin & end time to intent's extra data : intent.putExtra("beginTime", beginMilliTS);

Opening pdf file from server using android intent

故事扮演 提交于 2019-12-28 05:40:53
问题 I'm searching on the web how to open pdf file from server with default pdf viewer on android. What I found is download the file first then start it in intent or load it with google docs. I don't want to do all these. I just want to load it directly from server in default pdf viewer from phone. I've tried opening video url with intent and it worked. But opening pdf url with intent is not working. Below is my code; private void openFilePDF(){ try{ Toast.makeText(getBaseContext(), "Opening PDF..

How to capture the new Intent in onNewIntent()?

夙愿已清 提交于 2019-12-28 05:35:17
问题 I want to pass a new, but different, Intent to an Activity. How do you differentiate between the new Intent and previous Intents? What kind of code goes into onNewIntent()? An example will be very helpful. 回答1: The new intent comes as part of onNewIntent(Intent) . The original Intent is still available via getIntent() . You put whatever code you need to into onNewIntent in order to update the UI with the new parameters; probably similar to what you're doing in onCreate . Also, you probably

How to scroll table layout in horizontal and vertical in android

╄→尐↘猪︶ㄣ 提交于 2019-12-28 05:14:13
问题 I am totally confused in table layout scroll. I have to implement table with horizontal and vertical scrolling. I have also saw table fix header example but tablefixheader sample have used adapter to set data but i require add-view method in table layout. I have used below code but it couldn't support both ways scrolling <ScrollView android:layout_width="fill_parent" android:layout_height="fill_parent" android:scrollbars="vertical" > <HorizontalScrollView android:layout_width="match_parent"

Restricting selectable file types via intent in Android

橙三吉。 提交于 2019-12-28 04:05:07
问题 I am uploading selected files to server but I want to restrict users to pick only document files (.doc, .pdf, etc.) and image files. For now my code is working for all files it fetches uri of all files. How can I restrict users to pick only specific types of file? Here is my code to pick any file. Intent i=new Intent(); i.setType("*/*"); i.setAction(Intent.ACTION_GET_CONTENT); i.addCategory(Intent.CATEGORY_OPENABLE); startActivityForResult(Intent.createChooser(i, "abc"),requestCode); 回答1:

android - How to get view from context?

岁酱吖の 提交于 2019-12-28 02:42:26
问题 I want to get the view or findViewById() from Context? Or from intent? I'm trying to reach a specific view in my broadcast receiver and the parameter of onReceive are context and intent. Well, I have a class and within it is my broadcast receiver. Now, I'm trying to separate the broadcast receiver from it, but I need a way so I can still communicate with the views on my class from my separated broadcast receiver class. Thanks. 回答1: For example you can find any textView: TextView textView =