android-intent

android opening facebook app on a specific post

早过忘川 提交于 2020-01-03 11:01:13
问题 I am working on an application that fetches posts from user stream (from stream table) and displays them. streams post_id fields are returned in the format of: {uid}_{postid}, e.g.: 100001147753406_320951738012113 How can I open facebook application to show such post? in web browser this can be done with the url: www.facebook.com/uid/posts/postid, and according to searches this should be accomplished by setting Intent's uri to: fb://post/{postid}?owner={uid} However, this does not always work

onCreate called after onActivityResult when I pick picture from gallery

主宰稳场 提交于 2020-01-03 10:44:19
问题 I have 'SherlockFragmentActivity' with overrided 'onActivityResult'. I try to get image from camera and gallery and crop it. The problem is I returned on my activity not fragment after onActivityResult called. ... FragmentTransaction t = fragmentManager.beginTransaction(); LogInFragment logFrag = new LogInFragment(); t.replace(R.id.fragment_container, logFrag); t.commit(); ... @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult

Broadcast Receiver in fragment not receive intent from service

我与影子孤独终老i 提交于 2020-01-03 08:40:15
问题 I have a fragment and a service as below: I register and unregister LocalbroadcastManager in file Fragment.java Fragment.java @Override public void onStart() { // TODO Auto-generated method stub super.onStart(); IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(ffmpegService.PROGRESS); intentFilter.addAction(ffmpegService.DONE); LocalBroadcastManager.getInstance(getActivity()). registerReceiver(receiver, intentFilter); } @Override public void onStop() {

Android onActivityResult called early

此生再无相见时 提交于 2020-01-03 08:36:10
问题 I have 2 Activities, each in seperate applications. Activity1 has a button the user can click and it calls the second activity using an intent in its onClick() method: Intent myIntent = getPackageManager().getLaunchIntentForPackage(com.myProject.Activity2); startActivityForResult(myIntent, 600); This correctly launches Activity2 from Activity1, but onActivityResult gets called in Activity1 before onCreate gets called in Activity2, instead of in onBackPressed() where I set up the return intent

How do I sendBroadcast(intent) from myDialog and receive in myActivity?

一世执手 提交于 2020-01-03 07:19:27
问题 So, I'm trying to get a handle on BroadcastReceivers and Intent filters. I have a custom Dialog that I create in MyActivity. In the Dialog, I have a Button. When the button gets clicked, I want to send a broadcast that MyActivity's receiver will pick up. Here's what I have right now: //MyActivity.java class myActivity extends Activity { //MyDialog dialog initialized in onCreate ... private class MyReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent

How to change the position of a spinner according to position of other spinner in two different activities

纵然是瞬间 提交于 2020-01-03 06:56:06
问题 I Have two android spinner dropdown in two differnt activity.But both spinner have same data from same sourec.I want to change in position of second Activity acording to position of first activity.How to resolve this issue ?. Updated code: First Activity: public class ServiceRequest extends BaseActivity implements OnItemClickListener { private List<Item> customerList = new ArrayList<Item>(); private SpinnerAdapter adapter; public static final String EXTRA_INTENT_CUSTOMER_LIST ="extra_intent

Not able to start Service using Broadcast Receivers

笑着哭i 提交于 2020-01-03 06:42:08
问题 I want to start a service using BroadcastReceiver with this code public void onReceive(Context context, Intent intent) { Intent myIntent = new Intent(context,BlueToothService.class); context.startService(myIntent); } But not able to start the service. I also registered service and receiver in manifest. And I have also one doubt, can we use Broadcast Receiver without activity? This is my service class public class BlueToothService extends Service { @Override public IBinder onBind(Intent intent

How to read jpg file from a specific location with the cursor

◇◆丶佛笑我妖孽 提交于 2020-01-03 05:28:11
问题 I would like to understand how I can use a cursor to jpg files in a folder specified in the sdcard. I'm trying to select with a cursor the jpg files in a specific folder, and I tried this: This is the code: public static Uri getRandomImage(ContentResolver resolver) { String[] projection = new String[] { BaseColumns._ID, }; String folder = "/sdcard/DCIM/Wallpaper/"; folder = folder + "%"; Uri uri = Media.EXTERNAL_CONTENT_URI; String[] whereArgs = new String[]{folder}; Cursor cursor = resolver

ACTION_SEND intent android

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-03 05:06:09
问题 I am trying to pass a url to a specific app using the ACTION_SEND intent, I want to by pass the chooser and just go straight to the app i desire but it doesn't seem to take the url unless i use the chooser.. private void shareIt(){ Intent pC = new Intent(Intent.ACTION_SEND); pC.setType("text/plain"); pC.putExtra(Intent.EXTRA_TEXT, "http://www.bob.com"); pC.setType("text/plain"); pC.setClassName("com.sec.print.mobileprint","com.sec.print.mobileprint.UI.WebPrint"); //startActivity(pC);

Dynamically load layout in Android

巧了我就是萌 提交于 2020-01-03 04:49:09
问题 My application requires 2 screens and for this I have created two different XML layout files using RelativeLayout . One layout file loads whenever I run my Activity. Now I want to load the second layout on to the same Activity , when user click on a button in OptionsMenu and also when user press Back button the first screen loads instead of exiting the application. So that i don't need to create another Intent in my application. 回答1: Ideally there should be two different activities present in