android-intent

Send not serializable data to new Activity

孤者浪人 提交于 2020-01-06 18:43:52
问题 I have not serializable data which I must sent to other Activity . I try to use Intent , but it's impossible. Intent intent = new Intent(v.getContext(), UserDetailActivity.class); intent.putExtra("class", user); v.getContext().startActivity(intent); How can I send the data from previous Activity to new Activity ? 回答1: I don't think you can do this bacause the ParseUser needs to implement either Parcelable or Serializable. You probably can't modify the class so this is what you can do: Create

How to override the Home key function

拜拜、爱过 提交于 2020-01-06 18:33:47
问题 I'm developing a pattern lock app. The problem is that when the phone screen is off, then my LockActivity shows to be unlocked, but when i press the mobile home key, then it works. I want to override the home key function (as it's not working) until I enter the unlock pattern. @Override public boolean onKeyDown(int keyCode, android.view.KeyEvent event) { if ((keyCode == KeyEvent.KEYCODE_VOLUME_DOWN)||(keyCode == KeyEvent.KEYCODE_POWER)||(keyCode == KeyEvent.KEYCODE_VOLUME_UP)||(keyCode ==

Media Player in android Using MediaStore

跟風遠走 提交于 2020-01-06 18:09:27
问题 public class PlayerScreen extends AppCompatActivity implements SeekBar.OnSeekBarChangeListener { private MediaPlayer mp; private Button buttonplaypause; private int count; private SeekBar seekbar; private int curpos, prevpos; private Bundle b; private String title; private final Handler handler = new Handler(); private Runnable updatePositionRunnable = new Runnable() { public void run() { seekbar.setProgress(mp.getCurrentPosition()); handler.postDelayed(this, 6000); } }; @Override protected

Parcelable object that receives passed data coming up null

…衆ロ難τιáo~ 提交于 2020-01-06 18:07:23
问题 I'm working on an Android app that stores contact information, I'm trying to add a feature that when you click on a contact item in the ListView it will send the contact object that implements parcelable over two the second activity. This is Where I send the contact object over to the Contacts Activity. ` @Override protected void onListItemClick(ListView l, View v, int position, long id) { // TODO Auto-generated method stub final Contact item = (Contact) getListAdapter().getItem(position);

How to store image in app internal memory, after selecting from gallery and cropping through intent

ε祈祈猫儿з 提交于 2020-01-06 18:06:01
问题 In my app I am selecting an image from gallery, than I cropped that image, than store it in external storage. But if sd-card not available than problem occurs. So here I am asking you how to store image in application internal storage. Here is my code for external storage. Override public void onClick(View v) { int outputX = 400; int outputY = 400; int aspectX = 1; int aspectY = 1; Intent intent = new Intent(Intent.ACTION_GET_CONTENT, null); intent.setType("image/*"); intent.putExtra("crop",

How start an activity using Intent inside a inner static class?

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-06 18:01:19
问题 I have a static and inner class inside my Activityclass . I need to call an Activity using Intent(context,nameOfTheNewActivity.class) because I am trying to call an Intent when an item from a RecyclerView.ViewHolder is clicked. I had to Override the onClick to get the position of the item was clicked using getLayoutPosition() (this getLayoutPosition() worked fine). Now when I try to use Intent I have the error: Non-static method cannot be referenced by a static context. I read another links

How to pass an arrayList between two intent in Android

蹲街弑〆低调 提交于 2020-01-06 17:57:45
问题 I am new in Android and I have a question regarding intent. I want to pass an String ArrayList between two activities by using intent. I have tried this: ` ArrayList<String> playerName = new ArrayList<>(); Intent intent = new Intent(this,Game.class); intent.putStringArrayListExtra("Player",playerName); startActivity(intent);` Then I tried to receive my intent like that: ` ArrayList<String> playerNameList= new ArrayList<>(); playerNameList = getIntent().getStringArrayListExtra("Player"); int

Problem calling activity from another package in Android

房东的猫 提交于 2020-01-06 17:14:42
问题 Situation: I need to combine several apps into one .apk app. Lets say implement app2 into app1 What i have done: Copied app2 package into main app1 project which i am working, so my app1 has two packages. app2 had this manifest file: <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.package.app2" android:versionCode="3" android:versionName="1.2"> <application android:label="App2" android:icon="@drawable/icon"> <activity android:name="Activity1" android

Issue starting activity from non-activity class

夙愿已清 提交于 2020-01-06 15:39:12
问题 I am a noob to android and I have a Map Activity that also uses OverlayItems. Within the onButtonTap method of my overlay class, I want to execute startActivity so i can then use intent.ACTION_CALL. Intent callIntent = new Intent(Intent.ACTION_CALL); callIntent.setData(Uri.parse("tel:"+MapActivity.phonenumber0)); startActivity(callIntent); in the code above i am asked to create a method for startActivity(Intent), which I don't understand. and when i try... Intent callIntent = new Intent

Share image is not working via ACTION.SEND

旧街凉风 提交于 2020-01-06 14:55:12
问题 I am sharing image on facebook using ACTION_SEND, but its not working .code is here try { File myFile = new File("/mnt/sdcard/DCIM/100MEDIA/aa.jpg"); MimeTypeMap mime = MimeTypeMap.getSingleton(); String ext = myFile.getName().substring( myFile.getName().lastIndexOf(".") + 1); String type = mime.getMimeTypeFromExtension(ext); Intent sharingIntent = new Intent( "android.intent.action.SEND"); sharingIntent.setType(type); sharingIntent.putExtra("android.intent.extra.STREAM", Uri.fromFile(myFile)