यह इरादा-फ़िल्टर के साथ किया जाता है। अपने मेनिफेस्ट में निम्न टैग जोड़ें:
<activity android:name=".CameraActivity" android:clearTaskOnLaunch="true">
<intent-filter>
<action android:name="android.media.action.IMAGE_CAPTURE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
अब आपका एप्लिकेशन उस सूची में दिखाई देगा जब उपयोगकर्ता एक तस्वीर लेना चाहता है।
संपादित करें:
Uri saveUri = (Uri) getIntent().getExtras().getParcelable(MediaStore.EXTRA_OUTPUT);
if (saveUri != null)
{
// Save the bitmap to the specified URI (use a try/catch block)
outputStream = getContentResolver().openOutputStream(saveUri);
outputStream.write(data); // write your bitmap here
outputStream.close();
setResult(RESULT_OK);
}
else
{
// If the intent doesn't contain an URI, send the bitmap as a Parcelable
// (it is a good idea to reduce its size to ~50k pixels before)
setResult(RESULT_OK, new Intent("inline-data").putExtra("data", bitmap));
}
तुम भी एंड्रॉयड में निर्मित Camera app source code जाँच कर सकते हैं:
यहाँ एक बिटमैप वापस जाने के लिए उचित तरीका है।
क्षमा किया है, कुछ भूल गया- मैंने अभी प्रश्न – stoefln
संपादित किया है, मैंने अपना जवाब संपादित किया है। – Dalmas
क्या बड़ी छवियों को अतिरिक्त में डालने में कोई समस्या नहीं है? छवि के पथ को वापस करने के लिए बेहतर नहीं होगा? – stoefln