top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Android: Add app in android context menu

+3 votes
380 views

I want to link my app in android context menu. Say, like share it, if you install share it you will receive the same in the context menu of any file type. Like that I want to add my app to context menu. How can I do that?

posted Aug 29, 2016 by Akshay

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote
 
Best answer

Some devices (Samsung) have their custom intent that outsiders are not aware of. However the typical process is adding the intent for the mime type of the specific file types your app wants to handle. If you want to access all the files, then you could probably use */*.

 <activity
      android:name=".MyShareApp"
      android:theme="@android:style/Theme.Dark.NoTitleBar" >
      <intent-filter>
           <action android:name="android.intent.action.SEND" />
           <category android:name="android.intent.category.DEFAULT" />
           <data android:mimeType="photo/*" />
      </intent-filter>
 </activity>

Hope this helps!

answer Sep 1, 2016 by Vinod Kumar K V
Similar Questions
0 votes

I have created a JAVA class exposing native API. I have kept this class in _frameworks/base/core/java/com/myDomain/myPackage/myClass.java_ and for this i have already created JNI C code files and their entries in required make files.

But after building the SDK, it didn't include expected package _com.myDomain.myPackage_.

Is there any specific configuration file(s) where I would have to make entries to include it in Android SDK, or the place is incorrect where currently class files is kept.

+3 votes

I want to add table to the database dynamically through code on runtime. Note: I want to add tables at any point of time.

+1 vote

My app cashes when i click submit, it doesnt verify the fields as it should.
It works the way i want to but if i click on submit without entering anything it crashes.

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        Button addBtn = (Button) findViewById(R.id.addBtn);
        addBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                EditText amoutGiven = (EditText) findViewById(R.id.amountG);
                EditText manyPeople = (EditText) findViewById(R.id.mPeople);
                EditText moenyGiven = (EditText) findViewById(R.id.moneyG);
                TextView changeTxt  = (TextView) findViewById(R.id.changeTxt);
                Button nxtBtn     = (Button) findViewById(R.id.nxtBtn);
                Button tryBtn     = (Button) findViewById(R.id.tryBtn);
                android.view.inputmethod.InputMethodManager imm = (android.view.inputmethod.InputMethodManager)getSystemService(INPUT_METHOD_SERVICE);
                imm.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);

                if (amoutGiven.getText().length()==0){
                    amoutGiven.setError("This field is required");
                }

                if (manyPeople.getText().length()==0){
                    manyPeople.setError("This field is required");
                }

                if (moenyGiven.getText().length()==0){
                    moenyGiven.setError("This field is required");
                }

                int num1 = Integer.parseInt(amoutGiven.getText().toString());
                int num2 = Integer.parseInt(manyPeople.getText().toString());
                int num3 = Integer.parseInt(moenyGiven.getText().toString());
                int total = num1 * num2;
                int change = num3 - total;

                changeTxt.setVisibility((changeTxt.getVisibility() == View.VISIBLE)
                        ? View.INVISIBLE : View.VISIBLE);

                if (change < 0 ){
                    changeTxt.setText("Your numbers dont add up");
                    tryBtn.setVisibility((tryBtn.getVisibility() == View.VISIBLE)
                            ? View.INVISIBLE : View.VISIBLE);
                    tryBtn.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            startActivity(new Intent(MainActivity.this, MainActivity.class));

                        }
                    });

                }else {

                    changeTxt.setText( "Give Back Change oF: R" + change +"" );
                    nxtBtn.setVisibility((nxtBtn.getVisibility() == View.VISIBLE)
                            ? View.INVISIBLE : View.VISIBLE);
                    nxtBtn.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            startActivity(new Intent(MainActivity.this, MainActivity.class));    
                        }
                    });    
                }    
            }
        });    
    }
}
+5 votes

I wanted to close the app (Say facebook app) that I open from my app via Intent.
Using intent I am providing option for users to open various apps installed in mobile. Now, I need to provide option to automatically close the opened app after 5-10 seconds.

Is it possible to achieve?
Thanks in advance.

0 votes

Hi,Recently I made an app which takes photo and set to an ImageView in android.In samsung phone its orientation is 90 while camera intent opens so I used ExifInterface with four case 90/180/270/0 with normal case (0 degree) but when I compiled this method,its working perfect in all samsung device which is setting image after reverse rotate 90 to ImageView but not with others like moto/redmi/asus/karbonn I checked on each phone and there is an error that they are not getting bitmap.but when I removed ExifInterface and orientation,it started to work with all devices.but same issue with samsung device that setting image in ImageView with 90 degree orientation.
So I decided to use switch for samsung and other device so how can I know whether app is installed in samsung device or others using java?

...