[android-developers] Digest for android-developers@googlegroups.com - 10 updates in 8 topics

Jot Singh <jivanjotster@gmail.com>: Jun 19 02:41PM -0700

Hey Guys,
 
I am using Zxing library to create a QR Code, however to maximize the
amount of data that can be packed into a QR code, I am compressing the
data. The issue that I am running into is that I am able to create a QR
code with the compressed data, however it fails when I try to decompress
it. I am not sure if I am doing something wrong, or if it is simply not
possible with QR codes.
 
Any assistance will be appreciated, below is my source code.
 
public class DataExfil {
 
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
DataExfil dataExfil = new DataExfil();
}
 
public DataExfil() {
 
String output = "This Repository contains the source code for the
QR Code project.\n"
+ "This Repository contains the source code for the QR Code
project.\n"
+ "This Repository contains the source code for the QR Code
project.\n"
+ "This Repository contains the source code for the QR Code
project.\n"
+ "This Repository contains the source code for the QR Code
project.\n"
+ "This Repository contains the source code for the QR Code
project.\n"
+ "This Repository contains the source code for the QR Code
project.\n"
+ "This Repository contains the source code for the QR Code
project.\n"
+ "This Repository contains the source code for the QR Code
project.\n"
+ "This Repository contains the source code for the QR Code
project.\n"
+ "This Repository contains the source code for the QR Code
project.\n"
+ "This Repository contains the source code for the QR Code
project.\n"
+ "This Repository contains the source code for the QR Code
project.\n";

String path = "code.png";
String doc2;
String charset = "UTF-8";
Map map = new HashMap();
map.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.L);
 
try {
encryptQR(output, path, charset, map, 200, 200);
System.out.println("No errors occured...");
System.out.println(decryptQR(path, charset, map));
} catch (WriterException | IOException | NotFoundException |
DataFormatException e) {
// TODO Auto-generated catch block
Logger.getLogger(DataExfil.class.getName()).log(Level.SEVERE,
null, e);
}
}
 
/**
*
* @param output
* @param file
* @param charset
* @param hintMap
* @param width
* @param height
* @throws WriterException
* @throws IOException
*/
private void encryptQR(String output, String file, String charset,
Map hintMap, int width, int height) throws WriterException,
IOException {
 
byte[] data;
data = compress(output.getBytes());
 
BitMatrix mat = new MultiFormatWriter().encode(
new String(data, charset),
BarcodeFormat.QR_CODE, width, height);
MatrixToImageWriter.writeToFile(mat,
file.substring(file.lastIndexOf('.') + 1), new File(file));
}
 
/**
*
* @param file
* @param charset
* @param map
* @return
* @throws IOException
* @throws NotFoundException
*/
private String decryptQR(String file, String charset, Map map)
throws IOException, NotFoundException, DataFormatException {
BinaryBitmap binBit = new BinaryBitmap(new HybridBinarizer(
new BufferedImageLuminanceSource(ImageIO.read(new
File(file)))));
Result result = new MultiFormatReader().decode(binBit, map);
 
byte[] data;
data = result.getText().getBytes(charset);
//data = result.getRawBytes();
byte[] decompressed;
decompressed = decompress(data);
 
String output = new String(decompressed, charset);
 
return output;
}
 
/**
*
* @param data
* @return
* @throws IOException
*/
public static byte[] compress(byte[] data) throws IOException {
Deflater deflater = new Deflater();
deflater.setInput(data);
deflater.setLevel(Deflater.BEST_SPEED);
ByteArrayOutputStream outputStream = new
ByteArrayOutputStream(data.length);
deflater.finish();
byte[] buffer = new byte[1024];
while (!deflater.finished()) {
int count = deflater.deflate(buffer); // returns the generated
code... index
outputStream.write(buffer, 0, count);
}
outputStream.close();
byte[] output = outputStream.toByteArray();
System.out.println("Original: " + data.length);
System.out.println("Compressed: " + output.length);
return output;
}
 
/**
*
* @param data
* @return
* @throws IOException
* @throws DataFormatException
*/
public static byte[] decompress(byte[] data) throws IOException,
DataFormatException {
Inflater inflater = new Inflater();
inflater.setInput(data);
ByteArrayOutputStream outputStream = new
ByteArrayOutputStream(data.length);
byte[] buffer = new byte[1024];
while (!inflater.finished()) {
int count = inflater.inflate(buffer);
outputStream.write(buffer, 0, count);
}
outputStream.close();
byte[] output = outputStream.toByteArray();
System.out.println("Compressed: " + data.length);
System.out.println("decompressed: " + output.length);
return output;
}
}
Prakash Elugoti <reddyprakash939@gmail.com>: Jun 19 01:42PM -0700

Can anyone tell me how to extract text from PDF ???????
Prakash Elugoti <reddyprakash939@gmail.com>: Jun 19 01:44PM -0700

Can anyone tell me how to extract text from PDF in android ???????
Prakash Elugoti <reddyprakash939@gmail.com>: Jun 20 02:32AM +0530

Sorry Wrong mail :)
 
On Mon, Jun 20, 2016 at 2:14 AM, Prakash Elugoti <reddyprakash939@gmail.com>
wrote:
 
"Håkon Nilsen" <hnilsen@gmail.com>: Jun 19 12:35PM -0700

It's working unless you're using vector drawable as your app icon. So it
only works for me until I'm uploading to Google Play. This needs to be
fixed.
 
 
søndag 19. juni 2016 06.44.47 UTC+2 skrev sim47 følgende:
Philipp K <uweliebtuschi@gmail.com>: Jun 19 08:19AM -0700

I have an application where I want to record someone's speech during a
phone call. When I use the MediaRecorder object with VOICE_COMMUNICATION as
input, the echo cancelation works just fine. However, when I use an
AudioRecord, it does not work. I tried chosing VOICE_COMMUNICATION as input
for the AudioRecord, as well as normal MIC input and manually attached the
AEC (AcousticEchoCanceler) to the record.
 
*THIS WORKS:*
 
recorder = new MediaRecorder();
recorder.setAudioSource(MediaRecorder.AudioSource.VOICE_COMMUNICATION);
recorder.setOutputFormat(MediaRecorder.OutputFormat.AAC_ADTS);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
recorder.setAudioEncodingBitRate(16000);
recorder.setAudioSamplingRate(44100);
 
*THIS DOES NOT WORK:*
 
OutputStream outputStream = new FileOutputStream(filePcm);BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(outputStream);DataOutputStream dataOutputStream = new DataOutputStream(bufferedOutputStream);
int minBufferSize = AudioRecord.getMinBufferSize(SAMPLE_RATE_HZ,
AudioFormat.CHANNEL_CONFIGURATION_MONO,
AudioFormat.ENCODING_PCM_16BIT);
short[] audioData = new short[minBufferSize];
AudioRecord audioRecord = new AudioRecord(MediaRecorder.AudioSource.MIC,
44100,
AudioFormat.CHANNEL_CONFIGURATION_MONO,
AudioFormat.ENCODING_PCM_16BIT,
minBufferSize);AcousticEchoCanceler canceler = AcousticEchoCanceler.create(audioRecord.getAudioSessionId());NoiseSuppressor suppressor = NoiseSuppressor.create(audioRecord.getAudioSessionId());if (suppressor != null) {
suppressor.setEnabled(true);}
if (canceler != null) {
canceler.setEnabled(true);}
audioRecord.startRecording();
while (recording) {
int numberOfShort = audioRecord.read(audioData, 0, minBufferSize);
for (int i = 0; i < numberOfShort; i++) {
dataOutputStream.writeShort(audioData[i]);
}}
audioRecord.stop();
 
Can anybody tell me what I am doing wrong?
"Juan Ramos Suyón" <juancagb.17@gmail.com>: Jun 19 08:02AM -0700

I have published a new version of my app, and I have downloaded the updated
version from the Google Play Store.
 
But, the size of the application in my device 2 (where I downloaded and
updated using Google Play Store) is higher than the application size in my
device 1 (where I tested my app from Android Studio).
 
I think it is because an update downloads new things but not delete the
modified/deleted files.
 
Can someone affirm this?
Do you know how to prevent this "issue"?
 
Thanks in advance,
Tobias K <tobias.k910@gmail.com>: Jun 19 07:31AM -0700

Hi,
a few days ago we've published our second android game. When I search it in
the PlayStore it is not visible. The only way to get on the store entry is
by clicking on our first game on "other apps developed by..."
The game is called "Highway Race" from Maikor Studios. Does anybody has a
guess or hint why the app is not visible?
 
Thanks
Harish Co <coharish518@gmail.com>: Jun 19 03:35AM -0700

Users are trying to give rating to my app from play store but it is showing
error like Error retrieving information from server [RPC-S-9 xxxx]
 
 
Please help me on this
"Hasan KARAOĞLU" <rhasank1994@gmail.com>: Jun 19 02:52AM -0700

I have an activity. This activity's layout has one ViewPager. This
viewpager has five fragment by code. And I have five icons at the bottom of
screen. They are located in tablayout.
 
Come to main point, When I open keyboard, the keyboard lift tablayout to
top? How can solve it ?
 
*I tried the ways below . But they didn't work :*
 
- android:windowSoftInputMode="adjustPan|adjustResize"
-

android:isScrollContainer="false"
-

android:fitsSystemWindows="true"

 
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/activityRoot"
android:layout_width="match_parent"
android:layout_height="match_parent">
 
<android.support.design.widget.AppBarLayout
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
 
<include layout="@layout/toolbar" />
</android.support.design.widget.AppBarLayout>
 
<android.support.v4.widget.DrawerLayout xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/DrawerLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/appBarLayout">
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:fillViewport="true"
android:isScrollContainer="true"
android:layout_weight="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
 
<android.support.v4.view.ViewPager
android:id="@+id/viewpager"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:transitionGroup="false"
android:layout_weight="1" />
 
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
style="@style/MyCustomTabLayout"
android:layout_width="match_parent"
android:layout_height="?actionBarSize"
android:background="@drawable/bottom_bar_background"
app:tabMode="fixed"
app:tabPaddingEnd="0dp"
app:tabPaddingStart="0dp"
app:tabTextAppearance="@style/MyCustomTabText" />
</LinearLayout>
 
</ScrollView>
<include
layout="@layout/navigation_drawer_menu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/tabs"
android:layout_gravity="start"
android:layout_marginBottom="?actionBarSize" />
</android.support.v4.widget.DrawerLayout>
 
</RelativeLayout>
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to android-developers+unsubscribe@googlegroups.com.

No comments:

Post a Comment