android,android-intent,android-pendingintent
I don't want to start a Service, or Activity, or broadcast anything... Then you cannot use ActivityRecognition.ActivityRecognitionApi.requestActivityUpdates(). Is there just a simple way to create this PendingIntent to execute just a block of code? No. The conventional use case for this API is to find out about changes in...
android,android-intent,android-service,android-pendingintent,android-broadcast
Your Intent is used to explicitly start the AlarmReceiver class which is a BroadcastReceiver. Hence, you need to use getBroadcast(), not getService(), to create the PendingIntent object. Replace PendingIntent pIntent = PendingIntent.getService(this, 0, intent, 0); with PendingIntent pIntent = PendingIntent.getBroadcast(this, 0, intent, 0); Try this. This will work. ...
android,android-intent,android-activity,android-task
When you use FLAG_ACTIVITY_SINGLE_TOP, you can retrieve the Intent in the onNewIntent() method, not in onCreate(). @Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); String TOKEN_VALUE = intent.getStringExtra("TOKEN_VALUE"); String params = intent.getStringExtra("params"); // and so on .... } For singleTop Activities, the onNewIntent() method acts as an entry point which is...
android,facebook,facebook-graph-api,android-intent
taggable_friends is for tagging friends only. Use /me/friends instead to get IDs. Of course you can only get friends who authorized your App too, that´s how it is now. Not sure if it even works with those IDs though, because those are App Scoped IDs and there is no way...
android,android-intent,android-activity
Do these go to the OS, where they are relayed to the place where they are needed Yes. After all, the majority of the time, the activity that is to be started does not presently exist. Also, on that note, can all Activity instances "listen" to all intents Activities...
android,android-layout,android-intent,android-fragments,android-activity
How about the following: double finePerDay = ...; Calendar dueDate = ...; Calendar now = Calendar.getInstance(); int daysLate = Math.max(0, TimeUnit.MILLISECONDS.toDays (dueDate.getTimeInMillis() - now.getTimeInMillis())); double totalFine = finePerDay * daysLate; ...
android,android-intent,android-tabhost
The first parameter to the Intent constructor that you are trying to use takes a Context. Fragment is not a Context. Use getActivity() instead of this.
Use passed intent variable in onNewIntent protected void onNewIntent(Intent intent) { handleIntent(intent); } You should also remove call to handleIntent from within handleIntent method...
You could try starting the recording in a plain old Service in the onStartCommand(...) callback, and making your PendingIntent to start recording start this service. To stop the service, you can't make a PendingIntent that stops a service, so you'd have to get creative, and could use a BroadcastReceiver to...
android,android-intent,android-fragments,android-activity
You need to pass to Intent constructor an instance of Context class. So if you need to start new activity from Fragment you shall write new Intent(getActivity(), NextActivity.class); and start it like getActivity().startActivity(myIntent);
android,android-intent,android-fragments,android-gcm
You can pass parameter with Intent like this notificationIntent.putExtra("fragment", 1); Where 1 is your fragment index and inside your HomeActivity you can use this int id=getIntent().getIntExtra("fragment", 0); viewPager.setCurrentItem(id); ...
java,android,multithreading,android-fragments,android-intent
You can do something like this. String str_Data = ""; public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.MainActivity); String str_Name = ""; str_Name = setDataToText(str_Url); } private String setDataToText(String urlStr) { new Thread(new Runnable() { @Override public void run() { // TODO Auto-generated method stub //A code to retrieve data is executed...
android,android-intent,android-activity,service,intentservice
What I want is that I need the reference to the current Activity of ANY application that is on the foreground. That is not possible. Other applications are running in other processes; you do not have access to Java objects, such as Activity instances, in those processes....
android,android-intent,android-camera,zxing,barcode-scanner
You may use Journey's Library. You can use the scanner as a component just like an image or a text. It's based on ZXing. =)
GetLRL class must be an Activity (extends Activity), if it is not, then the undefined method exception will be thrown
You have to add an extra flag to close the email app first. Something with singletask or so. Try something like: intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); And have a look at yet more flags. ...
android,android-intent,android-activity,multidimensional-array
I'm pretty sure double[][][] doesn't implement Serializable. What you can do is make your own class like so: public class MyArrayWrapper implements Serializable { private double[][][] arr; public MyArrayWrapper(double[][][] value) { arr = value; } public double[][][] getArray() { return arr; } } You then instantiate that wrapper class and...
android,android-intent,android-imageview,android-bitmap
Take a look at the selected as best answer here Take photo w/ camera intent and display in imageView or textView? and you could find out how to take a picture and set it as a background of an imageView programmatically
android,android-intent,android-pendingintent
the chooser target intent is not the PendingIntent. For instance, in the following snippet, I am declaring intent for ACTION_SEND, with type text/plain, and this is the my target intent for the Intent.createChooser. Then I am creating another Intent, receiver, and a handler, the PendingIntet, which will invoke onReceive of...
android,image,android-intent,crop,android-fileprovider
From Storage Options | Android Developers: By default, files saved to the internal storage are private to your application and other applications cannot access them (nor can the user). ACTION_CROP launches an "other application" that supports cropping, and passes it the URI of the file to crop. If that file...
android,sockets,if-statement,android-intent,client
Change your if condition as if(thread.Socketdata.toString().equals("OK")){ Intent i = new Intent(MainActivity.this,LOGIN.class); startActivity(i); } and check....
android,android-layout,android-intent,android-activity
tv8=(TextView)findViewById(R.id.editText4); tv9=(TextView)findViewById(R.id.editText5); tv10=(TextView)findViewById(R.id.editText6); Change these to: tv8=(TextView)findViewById(R.id.textView4); tv9=(TextView)findViewById(R.id.textView5); tv10=(TextView)findViewById(R.id.textView6); You just used the wrong id's....
Firstly, AFAIK, at a time, only one application can be in foreground mode. That means, if you run your application (task manager), it will be in foreground mode and other application that were running will be in background mode until they are being killed. So you don't have to list...
android,android-intent,android-fragments,android-activity
It seems quite unusual for Android to clean up an activity in the way you described, but if that was the case I would think that your activity should still be restored. The fact that you don't return to the original activity and you can see from your debugging that...
android,sqlite,android-intent,homescreen
Hey guyz i have solved my problem of fetching data from tables based on column values and know i want to share the sloppy mistakes. TextView lblEmail = (TextView) findViewById(R.id.textView1); TextView lblReg = (TextView) findViewById(R.id.textView1); TextView lblName = (TextView) findViewById(R.id.textView1); This code has to be written like as stated below...
android,cordova,android-intent
Disregard this one. Started from scratch again and it seems to be working.
android,android-intent,intentfilter
There is no action with the name android.intent.action.SETTINGS. Try to remove the <intent-filter> from your manifest and add this code snippet in the onClick() method: Intent intent = new Intent(android.provider.Settings.ACTION_SETTINGS); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); Take a look at this SO question Opening Android Settings programmatically...
android,android-intent,intentservice,oncreate
I solved this with Service public class RepeatClass extends Service { private static final String TAG = "ServiceTag"; private boolean isRunning = false; @Override public void onCreate() { Log.i(TAG, "Service onCreate"); isRunning = true; } @Override public int onStartCommand(Intent intent, int flags, int startId) { Log.i(TAG, "Service onStartCommand"); //Creating new...
android,android-intent,android-activity
This might help u, Thread thread = new Thread(new Runnable() { @Override public void run() { try { URL url = new URL(url); HttpURLConnection conn = (HttpURLConnection) url .openConnection(); conn.setReadTimeout(10000 /* milliseconds */); conn.setConnectTimeout(15000 /* milliseconds */); conn.setRequestMethod("GET"); conn.setDoInput(true); // Starts the query conn.connect(); InputStream stream = conn.getInputStream(); String data...
android,android-intent,android-gcm
It looks like this was an issue for other people as well (see here). I checked the official GCM docs and indeed can verify that you'll need to place uses-permission outside the application tag. By the way, it looks like you are using the deprecated C2DM libraries. You might want...
java,android,android-intent,android-fragments,android-activity
You have a problem with the Context used for your Intent, change from: Intent intent = new Intent(this, mWC[position].activityClass); to Intent intent = new Intent(getActivity(), mWC[position].activityClass); or Intent intent = new Intent(view.getContext(), mWC[position].activityClass); ...
android,android-intent,android-sensors
First of all the TYPE_GYROSCOPE return angles are Radian angles, use: float azimuth = sensorEvent.values[0]*180/Math.PI; float pitch = sensorEvent.values[1]*180/Math.PI; float roll = sensorEvent.values[2]*180/Math.PI; Second, You do not start Activity as i can see, just trying to set text. Edit: If that is your indicator for phone's orientation , make an...
android,android-intent,telephony,smsmanager
There are no message IDs or thread IDs in SMS. Each SMS is a data packet that is completely independent of all other SMS. In Android, there is a standard SMS application that stores SMS in a database and "threads" conversations using some criteria which is not contained within the...
android,android-intent,bluetooth,android-bluetooth,bluetooth-oob
You are being prompted for entering the pin because that is what you are requesting in your pairingIntent. Instead of using pairingIntent.putExtra(BluetoothDevice.EXTRA_PAIRING_VARIANT, BluetoothDevice.PAIRING_VARIANT_PIN); pairingIntent.putExtra(BluetoothDevice.EXTRA_PAIRING_KEY, 1234); Use pairingIntent.putExtra(BluetoothDevice.EXTRA_PAIRING_VARIANT, PAIRING_VARIANT_PASSKEY_CONFIRMATION); As mentioned here, The user will be prompted to confirm the passkey displayed on the screen or an app will confirm the...
android,android-intent,android-fragments
This is a correct approach Send (in the Activity): final FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); final DetailActivityFragment frg = new DetailActivityFragment (); ft.replace(R.id.container, frg); final Bundle bdl = new Bundle(); bdl.putString("yourKey", "Some Value"); frg.setArguments(bdl); ft.commit(); Receive (in the Fragment): final Bundle bdl = getArguments(); String str = ""; try { str...
android,android-intent,android-activity,android-bundle
On rooted device something can modify the framework to intercept Bundles so risk is higher than on non-rooted devices.
android,android-intent,alarmmanager,android-pendingintent
This is how I was able to set alarm from my activity to ALARM app of Android. With AlarmManager its not possibe it seems. Thank you guys for your answers. Intent i = new Intent(AlarmClock.ACTION_SET_ALARM); l = getIntent().getExtras().getString("song"); i.putExtra(AlarmClock.EXTRA_HOUR, pickerTime.getCurrentHour()); i.putExtra(AlarmClock.EXTRA_MINUTES, pickerTime.getCurrentMinute()); i.putExtra(AlarmClock.EXTRA_RINGTONE, l); ...
android,android-intent,android-gallery,google-photos
Below code is working for me to get content URI on latest Google Photos as well. What i have tried is writing to temp file and return temp image URI, if it has authority in content URI. You can try same: public static String getImageUrlWithAuthority(Context context, Uri uri) { InputStream...
android,android-intent,listadapter
Use Activity instead of context beceause your Context is null, you are not assigning anything to Context in constructor but you are assigning values to Activity holder.replyEdittext.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent replyClassIntent = new Intent(activity,Reply_Class.class); activity.startActivity(replyOzoneIntent); } }); ...
android,android-intent,android-activity,bitmap
use following method..... **************************************************** Bitmap bm = ShrinkBitmap(imagefile, 300, 300); image.setImageBitmap(bm); Bitmap ShrinkBitmap(String file, int width, int height) { BitmapFactory.Options bmpFactoryOptions = new BitmapFactory.Options(); bmpFactoryOptions.inJustDecodeBounds = true; Bitmap bitmap = BitmapFactory.decodeFile(file, bmpFactoryOptions); int heightRatio =(int)Math.ceil(bmpFactoryOptions.outHeight/(float)height); int widthRatio =...
android,listview,android-intent
Just you need to pass your HashMap Arraylist to next Activity. Like, intent.putExtra("myList",arraylist_oper); and in your next Activity just retrieve as Intent intent = getIntent(); ArrayList<HashMap<String,String>> mylist = (ArrayList<HashMap<String, String>>)intent.getSerializableExtra("myList"); EDIT : You need to pass your qrCode too next Activity intent.putExtra("qrcodes", arraylist_oper.get(position).get("qrcode"))); Now retrieve in next activity as String...
Please use this code this is tested code : public static void takeScreenshot(Context context, View view) { String path = Environment.getExternalStorageDirectory().toString() + "/" + "test.png"; View v = view.findViewById(android.R.id.content).getRootView(); v.setDrawingCacheEnabled(true); v.setDrawingCacheEnabled(true); Bitmap bitmap = Bitmap.createBitmap(v.getDrawingCache()); v.setDrawingCacheEnabled(false); OutputStream out = null; File imageFile = new File(path); try { out = new...
android,android-intent,notifications,android-pendingintent
This is Showing that : PendingIntent contentIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); You are giving request code 0 to all notifications. 0 should be replaced by each unique number...
android,android-layout,android-intent
I don't understand fully what's the purpose of your code, or the semantics of the variables, but I believe you want to set the default value to 0 on your getIntExtras Integer hasilNormal1 = hasilIntent.getIntExtra("hasilBNormal1", 0); Integer hasilNormal2 = hasilIntent.getIntExtra("hasilBNormal2", 0); ... Also, it seems that you are losing the...
java,android,android-intent,android-fragments,android-activity
Make sure that WCBankActivity extends Activity class and FragmentWCBank Fragment. It looks to me that WCBankActivity isn't Activity for some reason but I wouldn't know looking at this code. Hope it helped a bit....
First, do not use Class.forName(). Either use if or a Class[] and just reference the Accelerometer.class and MultiTouch.class objects. Second, your manifest has: <activtiy android:name=".Accelerometer" android:label="Accelerometer" /> which has the element name spelled incorrectly. Try: <activity android:name=".Accelerometer" android:label="Accelerometer" /> ...
android,android-intent,listener,broadcast
You may try LocalBroadcastManager, which is a lightweight solution for sending broadcast intents, and it is a part of Android support library v4.
android,android-intent,notifications
Technically this flag is required. But since it is required, Android is nice and will just set it for you ;-) The reason it is required is as follows: The code that processes the Notification and calls startActivity() to actually launch the Intent, isn't running in a "task". It is...
android,android-intent,android-manifest,android-m,direct-share
Question 1 In the description, they only show what to put in the manifest, and they mention using "ChooserTargetService". What should be done in order to provide the texts and images? Start by extending ChooserTargetService. You'll need to return a List of ChooserTarget and how you create those targets is...
android,android-layout,android-intent,android-activity,android-xml
I think the problem is here: Button buttonLoadImage = (Button) findViewById(R.id.buttonLoadPicture); You should use this Button buttonLoadImage = (Button) view.findViewById(R.id.buttonLoadPicture); Because the header is not added into the activity layout yet, so your currently code will get a null pointer when find buttonLoadPicture....
android,android-intent,android-activity,activity-lifecycle
The ActionBar back is really the "Up" button. The distinction between it and the device back button is that the "Up" button is meant to go up in the screen hierarchy (back to an instance of the parent activity) while the device back button is meant to go back chronologically...
Seems like these two approaches are very different: The start...forResult(...) methods start an intent or sub-activity in a way that allows for a result to be returned to the activity that executed the start...forResult(...). The result will be passed back to the activity's onActivityResult(...) method. All other ways of launching...
java,android,xml,exception,android-intent
Do the change in your xml like below code: <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#0D47A1" android:id="@+id/mylayout"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center" android:text="sometext"/> </RelativeLayout> And in your activity like this RelativeLayout relativeLayout; public class YourActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) {...
android,android-intent,alarmmanager,android-alarms,repeatingalarm
Well, you have a couple of issues. First, setRepeating() is inexact on Android 4.4 and higher, with a targetSdkVersion of 19 or higher. They do not state how "inexact" it actually is, and so I don't know when your alarms will get scheduled. Second, a repeating alarm period of less...
android,android-intent,android-activity,android-bundle
you have three ways: 1) you can define your broadcast inside your MainActivity like this: in onCreate() registerReceiver(smsReceiver, new IntentFilter(SMS_RECIEVED)); and define smsReciver in MainActivity private BroadcastReceiver smsReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { //you can update textBox here handler.postDelayed(sendUpdatesToUI, 10); } }; define...
android,android-layout,android-intent,android-fragments,android-activity
Check the videoView state like: if(videoView.isPlaying()){ Toast.makeText(context, "Paused", Toast.LENGTH_SHORT).show(); } ...
android,android-intent,wifi-direct
After figuring out that we cannot send such objects via intents, i tried to share data between my activities, so static SharedData Class is born in my MainHomeActivity. public static class SharedData { private static WifiP2pManager mManager; private static WifiP2pManager.Channel mChannel; static public void set(WifiP2pManager m, WifiP2pManager.Channel c) { mManager...
android,android-intent,android-activity,android-gcm,android-location
MapActivity is extend by Fragment Activity and inside this you are opening Map i.e also opening inside a fragment so you cannot make a call to map directly with help of intent. you can do this like as: ((MyFragmentActivity) getActivity()).replaceFragments(); and then inside fragment activity replace that fragment.
java,android,android-intent,android-fragments,android-activity
Your code transaction.replace(R.id.detail_container...Now this may be the correct UI element. I am assuming this is the correct UI. If so, fragment_wc_bank layout xml does not have that ID detail_container, hence you get error, simple as that. However activity_main.xml has that ID, again I am assuming detail_container is the correct UI...
java,android,android-intent,android-fragments,android-studio
Try changing your encoding, see the image: ...
android,android-intent,android-fragments,android-fragmentactivity
Suppose you just need to call finish(), like this: findViewById(R.id.btnCancelar).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); The reason for the NullPointerException maybe is that the layout id of R.id.content_frame could not be found in the AddEscolas activity. If you need to update the EscolasFragment fragment...
android,android-layout,android-intent,android-fragments,android-activity
I fixed it by the following: Moving the followings to the fragment : private ListView mListView; private ListViewNewsAdapter listViewNewsAdapter; private ArrayList<ListViewNewsItem> listViewNewsItems; private JSONParser jsonParser = new JSONParser(); private String READNEWS_URL = "xxxxxxxx.xxxxx.xxxxx"; public CreateFragment() { // Required empty public constructor } Then, inside the onCreateView I created : mListView...
java,android,android-intent,android-activity,android-developer-api
You could use a BroadcastReceiver for this. private final BroadcastReceiver mHandleMessageReceiver = new BroadcastReceiver(){ @Override public void onReceive(Context context, Intent intent) { //Get all your music data from the intent String position = intent.getStringExtra("pos"); ... } }; Register this BroadcastReciever with an Intent in your NowPlayingActivity's onCreate() like this, registerReceiver(mHandleMessageReceiver,...
android,android-intent,android-file,android-fileprovider,android-implicit-intent
STEP 1 - Using an Implicit Intent: To choose a file from the device, you should use an implicit Intent Intent chooseFile = new Intent(Intent.ACTION_GET_CONTENT); chooseFile.setType("*/*"); chooseFile = Intent.createChooser(chooseFile, "Choose a file"); startActivityForResult(chooseFile, PICKFILE_RESULT_CODE); STEP 2 - Getting the absolute file path: To get the file path from a Uri,...
android,button,android-intent,share
Could anyone help ? Concatenate the six strings into one larger string, and share that larger string....
java,android,android-intent,android-fragments,android-mediaplayer
You can use the Singleton Pattern: public class Singleton { private static Singleton mInstance = null; private String mString; private Singleton(){ mString = "Hello"; } public static Singleton getInstance(){ if(mInstance == null) { mInstance = new Singleton(); } return mInstance; } public String getString(){ return this.mString; } public void setString(String...
android,android-intent,uri,android-wallpaper
Like the error says, you need a content URI. Content URIs allow you to share files with temporary read and write permissions. Check out: Get a Content URI from a File URI?...
android,android-intent,android-studio
You should use activity result to deal with it: in MainActivity: public void onClick(View v) { Intent intent = new Intent(this, MainActivity2Activity.class); startActivityForResult(intent, PERFERENCE_CODE); } // React to complete edit @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { // Check which request we're responding to if (resultCode ==...
java,android,class,android-intent,android-activity
You are doing mistake in your onPostExecute(String result) method. Replace Intent intent3 = new Intent(SigninActivity.this, MainActivity.class); startActivity(intent3); By context.startActivity(new Intent(context, MainActivity.class)); ...
android,android-intent,broadcastreceiver,intentfilter
Change your action in android manifest to : <action android:name="android.intent.action.ACTION_POWER_CONNECTED" /> <action android:name="android.intent.action.ACTION_POWER_DISCONNECTED" /> ...
android,android-intent,android-fragments
import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.Fragment; import android.widget.ImageButton; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.View.OnClickListener; public class postingActivity extends Fragment { private ImageButton infrastructure; private ImageButton trafficjam; private ImageButton others; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle...
android,android-intent,android-activity,stack
If you know to which activity you want to go in onBackPressed() you can start the activity with the FLAG_ACTIVITY_CLEAR_TOP. It would switch to the instance of MenuActivity if an instance is existing, but it would also remove all activity instances which are between your current activity instance and the...
java,android,android-layout,android-intent,android-activity
My guess is that you chose the wrong import, You should import import android.support.v7.widget.SearchView; instead of import android.widget.SearchView; ...
because in your code, Intent intent = new Intent(this, GetLRL.this); // <<- Here this refers to View.OnClickListener not an Activity reference From above code line, this refers to onClickListener and Intent Requires Application Context as First argument and use .class as Second Argument. So change your code line like, Intent...
android,unit-testing,android-intent,mocking,nfc
It's possible to create a mock tag object instance using reflection (note that this is not part of the public Android SDK, so it might fail for future Android versions). Get the createMockTag() method though reflection: Class tagClass = Tag.class; Method createMockTagMethod = tagClass.getMethod("createMockTag", byte[].class, int[].class, Bundle[].class); Define some constants...
java,android,android-intent,hashmap
I believe there is a typo here: Intent intent = getIntent(); players = (HashMap<Integer, Player>) intent.getSerializableExtra("player"); Did you mean: getSerializableExtra("players"); ...
android,android-intent,tags,nfc,ndef
NFC events are triggered by touching an NFC tag. Hence, when you open your app by clicking the launcher icon (or by starting it from your development environment), ANdroid won't generate an NFC event (even if your device is was already placed on top of the tag). Hence, what you...
From Activity page ava.lang.Object ↳ android.content.Context ↳ android.content.ContextWrapper ↳ android.view.ContextThemeWrapper ↳ android.app.Activity We also need to note that Context is an abstract class, so we need to use some implementation because it is imposible to create an instance of an abstract class in java. And on this Context page you...
android,arrays,android-intent,bundle,androidplot
The Number class implements Serializable. So you should be able to do the following: Bundle extras = getIntent().getExtras(); Number[] series1Numbers = (Number[]) extras.getSerializable("plotpoints"); ...
java,android,android-intent,uri,avd
Change your onClick method to below code. You should give the option to choose the external player. @Override public void onClick(View v) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.parse("https://youtu.be/jxoG_Y6dvU8"), "video/*"); startActivity(Intent.createChooser(intent, "Complete action using")); } ...
Change your code to public class TaskActivity extends FragmentActivity { private void launchNextTask(Task nextTask) { Intent intent = new Intent(TaskActivity.this, TaskActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); intent.putExtra(TASK_KEY, nextTask); startActivity(intent); overridePendingTransition(R.anim.slide_in, R.anim.slide_out); } } And it should fix your issue....
android,android-intent,android-activity
There are two approaches to do. the common one use startActivityForResult in your calling activity to start the activity. Here I use ActivityCompat for backward compatibility. ActivityCompat.startActivityForResult(this, new Intent(this, MyActivity.class), 0, null); Then in the callee activity, you can use the following code to detect the calling activity. if (getCallingActivity()...
android,android-intent,android-listview,broadcastreceiver
You have declared your PhonecallReceiver as abstract. This means that Android cannot instantiate it when it needs to. You need to rethink your architecture. BroadcastReceivers declared in the manifest cannot be abstract because Android needs to be able to instantiate them itself as needed. Either make your PhonecallReceiver concrete (not...
java,android,android-intent,android-activity
Since Intent constuctor accepts the component class as its parameter, it's as simple as this: context.startActivity(new Intent(context, Class.forName("com.example.area.Triangle_Area")); ...
android,android-intent,android-activity,android-service,android-syncadapter
Sync adapter starts explicitly by calling: ContentResolver.requestSync(ACCOUNT, AUTHORITY, null); or similar method: ContentResolver.addPeriodicSync( ACCOUNT, AUTHORITY, Bundle.EMPTY, SYNC_INTERVAL); https://developer.android.com/training/sync-adapters/running-sync-adapter.html I strongly recommend this book, especially first 200 pages http://www.wrox.com/WileyCDA/WroxTitle/Enterprise-Android-Programming-Android-Database-Applications-for-the-Enterprise.productCd-1118183495.html ....
Have you added the new Activity to the manifest file? Add this <activity android:name=".Dashboard" android:label="Dashboard" /> ...
android,android-intent,android-activity
Check out the "Setting up a regular activity PendingIntent" section of the android notifications. You are not following the guidelines laid out in the example. Particularly, you don't do the following: Create a back stack based on the Intent that starts the Activity: Create the Intent to start the Activity....
android,android-intent,service,alarmmanager
In order for this check to work, you need to be absolutely sure that the PendingIntent only exists when the alarm is set. There are 2 things you can do to ensure that is so: 1) When testing your code, make sure that you uninstall your application and then reinstall...
android,android-intent,android-asynctask
if you ever bothered to read what AsyncTask has of methods you would have noticed that AsyncTask class has a method called cancel which accepts boolean value. public final boolean cancel (boolean mayInterruptIfRunning); Attempts to cancel execution of this task. This attempt will fail if the task has already completed,...
I managed to get it working properly without the duplicates by having our background service call a custom activity: public static void installDownloadedApplication(Context context) { Intent intent = new Intent(context, InstallActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); } Then our custom activity does what the background service used to do: /** * We use...
java,android,android-intent,input,android-studio
Source: Getting a Result from an Activity From Activity1: public static final String RESULT_REQUEST = 1; When you want to start Activity2: Intent intent = new Intent(this, Activity2.class); startActivityForResult(intent, RESULT_REQUEST); This will be called when Activity2 is finished: @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { // Check...