Menu
  • HOME
  • TAGS

how to fetch all column Values based on Email

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...

How do I avoid multiple apk install promps on an Android programmatic install?

android,android-intent,apk

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...

Android parentActivity not getting recreated after startActivityForResult returns

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...

How to getCropAndSetWallpaperIntent(Uri imageUri) to work?

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?...

Unable to launch list view owing to constructor error

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....

Android Implicit Intent for Viewing a Video File

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")); } ...

The method getIntent() is undefined for the type GetLRL

android,android-intent

GetLRL class must be an Activity (extends Activity), if it is not, then the undefined method exception will be thrown

How to get position of listitem using setonitemclicklistener and send to next activity

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...

Android: Intent asks remove argument & getBaseContext() ask to create its method

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...

How to resolve Out of Memory Error on Bitmap in Android?

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 =...

Dealing with Fragment and listView and JSON

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...

Return a String from a Thread Android Java

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...

Getting the Foreground Activity of any application in a Service written in other application

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 - No Activity found to handle intent action.VIEW

android,exception,android-intent,android-fragments,textview

This occur when user clicks URL in text In this case, the URL is malformed: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=href (has extras) } The URL is href. That is not a valid URL. Here is the part where I do TextView html settings: That...

how to pass data intent in different textview in android

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...

I want to Show Simple Toast Message When User Click On Media Controller button Pause/Start/Stop in video View Using Media Controller

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(); } ...

Sending Intent from BroadcastReceiver class to currently running activity

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...

Pass 3D-array to Activity in Android

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...

Unable to check if alarm has been set by AlarmManager

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...

Notification not always starting the Activity

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....

Start and stop recording from a button in a notification

android,android-intent

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...

Is it possible to know whether another app is in background or foreground?

android,android-intent

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...

How to set an image on imageView from the gallery and image taken by camera in Android?

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

Making a layout clickable, and start an intent

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 App crashes when intent a new activity

java,android,android-intent

Have you added the new Activity to the manifest file? Add this <activity android:name=".Dashboard" android:label="Dashboard" /> ...

The constructor Intent(new View.OnClickListener(){}, GetLRL) is undefined

android,android-intent

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...

Open Map Activity from GCM Push Notification

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.

Android Intent and Intent filter

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...

Multiple notification handling

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...

I need to start activity using my SearchView widget on my actionbar

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; ...

Android - unable to retrieve Intent when Activity is set to Single Top

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...

How to click song list (Now Playing activity) to playing without (Music Preview) startActivity

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,...

Is it possible to share multiple text by using share intent?

android,button,android-intent,share

Could anyone help ? Concatenate the six strings into one larger string, and share that larger string....

Use one instance of MediaPlayer throughout several fragment classes

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...

Getting arguments from a bundle

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 Receive SMS Intent: Get Message Id or Thread Id

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...

Bluetooth pairing - how to show the simple Cancel/Pair dialog?

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...

How to open “zxing Barcode” scanning screen in a small window?

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. =)

Choosing photo using new Google Photos app is broken

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...

Launching email client programatically in android and passing email address to client

android,email,android-intent

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. ...

I have error when use context in adapter, i would like use startActivityForResult(…) in adapter, how should I do?

android,android-intent,android-activity,android-adapter,android-context

You're getting an error on the mActivity = (Activity)mContext; line because the Context you're instantiating the Adapter with is not an Activity. Change the Adapter instantiation as follows: mAdapter = new MyAdapter(this, TITLES, ICONS, NAME, EMAIL, PROFILE); ...

take screenshot from layout and share via android

android,android-intent,bitmap

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...

Facebook API v2+. Open Facebook application (friend profile or chat page) from my android app using intent?

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...

Need assistance with the Android Manifest XML File within my Launcher App

android,android-intent,android-manifest,intentfilter,launcher

You need an extra attribute to be added to the activity tag. Try adding this to the activity tag: android:launchMode="singleTask"...

Android Intent doesnt work

java,android,android-intent

Use passed intent variable in onNewIntent protected void onNewIntent(Intent intent) { handleIntent(intent); } You should also remove call to handleIntent from within handleIntent method...

Passing Number[] array through Intent

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"); ...

Android : AlarmManager is not wroking properly. It is not able to set the alarm

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); ...

Back to a fragment from fragmentActivity in Android

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...

Starting new Activity not from the MainActivity file

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);

Use OnclickListener In custom Adapter Class

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); } }); ...

Alarm receive don't work

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. ...

Get IntentSender object for createChooser method in Android

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: Edit an image by 3rd party app / Intent ACTION_EDIT

android,cordova,android-intent

Disregard this one. Started from scratch again and it seems to be working.

Cannot resolve constructor Intent

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.

How are android intents handled at runtime?

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 compiles but crashes

java,android,android-layout,listview,android-intent

View row=null; Is defined twice as local variable in if{} block, and as class field in adapter. Row variable here: TextView titulo=(TextView) row.findViewById(R.id.textView1); ImageView icone=(ImageView) row.findViewById(R.id.imageView1); is declared as adapter field, assigned to null (probably to avoid compiler complains) and then never touched again. Solution - just declare variable in...

Android - No view found for 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...

I'm trying to get location on android device But it crashes immediately after execution

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...

Start intent when pitch us between 0 and 135 Android

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...

Broadcast intent vs multicast listener implementation on Android

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.

How to check for existing activities when back button pressed

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...

opening notofication from gcmIntentClass to a fragment class

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); ...

i need to calculate fine to pay for late submission of books in library? [closed]

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; ...

Intent can't move to another activity using IF

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....

RuntimeException when loading image from device and applying parallax effect

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....

On Android M, how to configure the “direct-share” capabilities (image, text), and how to query the items?

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...

How to send a WifiP2pManager object though a Parcelable interface to another activity

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...

Is it secure to pass PIN via bundle/extras in Android?

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.

BroadcastReciver class not running

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" /> ...

Cannot start activity using explicit intent

android,android-intent

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" /> ...

How do I configure my AlarmReceiver to actually trigger at my desired interval?

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...

How does “this” actually provide a Context from an Activity when used in for example an Intent(this, ClassName.class)

java,android,android-intent

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...

Unable to Register Android App with GCM : Not allowed to start service Intent

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...

Android Notification: Intent.FLAG_ACTIVITY_NEW_TASK required?

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...

Implementing a File Picker in Android and replicating the selected file at another location

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,...

Clear back stack but keep transition animations

android,android-intent

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....

Simplest way to use / create a PendingIntent

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...

Passing HashMap using intent returns null, why?

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: Using an intent to start any activity

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 - No suitable constructor found

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); ...

Sync Adapter not calling onCreate

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 ....

SigninActivity is not an enclosing class

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)); ...

How to determine which Activity launched current Activity in Android?

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()...

How to access navigation drawer in all activities?

android,android-intent,android-fragments,navigation-drawer

Call this code on button click. Fragment frag = new YourFragment(); FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.replace(R.id.fragment_container, frag); ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); ft.addToBackStack(null); ft.commit(); ...

open application After incoming or outgoing call diconnection

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...

How to mock a Android NFC Tag object for unit testing

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...

Import PDF from adobe

java,android,android-intent,intentservice

public class savepdf extends ActionBarActivity { static final int REQUEST_IMAGE_OPEN = 1; private static final int WRITE_REQUEST_CODE = 43; private Uri mData; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_savepdf); // Get intent, action and MIME type Intent intent = getIntent(); String action = intent.getAction(); String type = intent.getType(); if...

Tag returns null when trying to write NDEF message to NFC tag - Tag is not detected

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...

Changing activity from other app android

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...

Unable to get instance of Activity in Unity C#

java,c#,android,android-intent,unity3d

I was able to forge a solution based on a YouTube tutorial(link below if interested). The Problem The problem was residing in the fact that Unity did not technically know about the activity, despite it being defined in the manifest, therefore it was not able to create it. Someone pointed...