android-intent

Android Alert dialog from inside an intent service

蓝咒 提交于 2020-01-09 05:08:05
问题 I want to display an alert dialog from inside an intent service. AlertDialog alertDialog = new AlertDialog.Builder(this).create(); This throws the following exception Unable to add window — token null is not for an application I have tried IntentService.this and getApplicationContext() as well. Between i dont want to do it using an activity. I just want to show a simple alert dialog with a little text. 回答1: Need Activity for display AlertDialog , because we can't display Dialog from any

Disable multi finger touch in my app [duplicate]

谁说胖子不能爱 提交于 2020-01-09 04:22:05
问题 This question already has answers here : Disable or prevent multitouch in Activity (8 answers) Closed 5 years ago . My app uses one Activity to host several fragments. Each time one fragment is shown on the phone screen.The view of each fragment consists of several image icons. Currently, user is able to press on two icons simultaneously with two fingers (with each fingure press on one icon). I want to disable this multi-touch feature on my app to allow only one icon press take effect at a

Pass list of objects from one activity to other activity in android

对着背影说爱祢 提交于 2020-01-09 04:17:52
问题 I want to pass a list of objects from one activity from another activity. I have one class SharedBooking Below: public class SharedBooking { public int account_id; public Double betrag; public Double betrag_effected; public int taxType; public int tax; public String postingText; } Code from Calling activity: public List<SharedBooking> SharedBookingList = new ArrayList<SharedBooking>(); public void goDivision(Context context, Double betrag, List<SharedBooking> bookingList) { final Intent

How to attach image from drawable to gmail?

删除回忆录丶 提交于 2020-01-08 18:02:14
问题 I am trying to attach image from my gridview to gmail or facebook,but whenever i tried to attach my app got crash,and i am getting following error with nullpointer exception,following is my code with gridview image selection,can any one help? public class Free_Cover_Activity extends AppCompatActivity { GridView grid; int[] imageId = { R.drawable.discovercover, R.drawable.burpresswordfree, R.drawable.flyfree, R.drawable.cantmovefree, R.drawable.cantmovewordfree, R.drawable.chalkthisfree, R

Android app enable NFC only for one Activity

。_饼干妹妹 提交于 2020-01-08 18:01:14
问题 Is it possible to enable NFC for only one activity in android for an NFC enabled application? I've read this, Reading NFC tags only from a particuar activity But the devices are still scanning for tags on all activities of the application. EDIT: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.nfccheckout" > <uses-feature android:name="android.hardware.nfc" android:required="true" /> <uses-permission android:name=

how can you share location same like whatsapp in android with chooser dialog?

安稳与你 提交于 2020-01-08 01:50:28
问题 I want "share location" functionality same like whatsapp in my current application. Now to open chooser dialog i used below mentioned code. public static void showFileChooser(Activity activity, Fragment fragment, boolean isAllowMultiple) { try { File imageStorageDir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM), "demo"); if (!imageStorageDir.exists()) { imageStorageDir.mkdirs(); } File file = new File(imageStorageDir + File.separator + "i" + String

how can you share location same like whatsapp in android with chooser dialog?

孤街浪徒 提交于 2020-01-08 01:50:25
问题 I want "share location" functionality same like whatsapp in my current application. Now to open chooser dialog i used below mentioned code. public static void showFileChooser(Activity activity, Fragment fragment, boolean isAllowMultiple) { try { File imageStorageDir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM), "demo"); if (!imageStorageDir.exists()) { imageStorageDir.mkdirs(); } File file = new File(imageStorageDir + File.separator + "i" + String

Cannot instantiate the type Intent

随声附和 提交于 2020-01-07 09:54:58
问题 Error: "Cannot instantiate the type Intent" Objective: Launch a new intent depending on gridView position value Request: Assistance with the error specified above public void onItemClick(AdapterView<?> parent, View v, int position, long id) { ImageCell i = (ImageCell) v; trace("onItemClick in view: " + i.mCellNumber); Toast.makeText(DragActivity.this, "" + position, Toast.LENGTH_SHORT).show(); switch (position) { case 0: // start one activity Intent intent = new Intent(DragActivity.this,

Cannot instantiate the type Intent

我的未来我决定 提交于 2020-01-07 09:54:12
问题 Error: "Cannot instantiate the type Intent" Objective: Launch a new intent depending on gridView position value Request: Assistance with the error specified above public void onItemClick(AdapterView<?> parent, View v, int position, long id) { ImageCell i = (ImageCell) v; trace("onItemClick in view: " + i.mCellNumber); Toast.makeText(DragActivity.this, "" + position, Toast.LENGTH_SHORT).show(); switch (position) { case 0: // start one activity Intent intent = new Intent(DragActivity.this,

Android - ImageView how can i get the camera picture? where resultCode is 0 and requestCode is 2?

自作多情 提交于 2020-01-07 08:36:15
问题 Getting resultCode= 0 and requestCode = 2, cant get the picView with picture. import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.app.Activity; import android.content.ActivityNotFoundException; import android.content.Intent; import android.graphics.Bitmap; import android.net.Uri; import android.os.Bundle; import android.provider.MediaStore; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import