Thursday, April 11, 2013

[android help] How to Attach files with sending mail in android application?

email - How to Attach files with sending mail in android application? - Stack Overflow



















I am sending mail through my application. For that I am using following code.



Intent i = new Intent(Intent.ACTION_SEND);
i.setType("text/plain");
i.putExtra(Intent.EXTRA_EMAIL , new String[]{"recipient@example.com"});
i.putExtra(Intent.EXTRA_SUBJECT, "subject of email");
i.putExtra(Intent.EXTRA_TEXT , "body of email");
try {
startActivity(Intent.createChooser(i, "Send mail..."));
} catch (android.content.ActivityNotFoundException ex) {
Toast.makeText(MyActivity.this, "There are no email clients installed.", Toast.LENGTH_SHORT).show();
}


It just work fine but i want to attach an xml file with it. Is it possible? How?


























There are lots of similar questions asked with perfect solution in Stack Overflow already.


You can have look to few : here and here and here


Solution is to use with email intent : one more putExtra with Key-Extra_Stream and Value-uri to file.


And please go through the FAQ to undersatand How to better benifit from the site.


























default






.

stackoverflow.comm

[android help] Parsing RSS feed to android application


Here is the code To fetch a RSS Feed from a URL and list it in a listview in android.


You need first to create a class that extends ListActivity, and then put this code:



// Initializing instance variables
headlines = new ArrayList();
links = new ArrayList();

try {
URL url = new URL("http://www.RSS-Feed-URL-HERE");

XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
factory.setNamespaceAware(false);
XmlPullParser xpp = factory.newPullParser();

// We will get the XML from an input stream
xpp.setInput(getInputStream(url), "UTF_8");

/* We will parse the XML content looking for the "" tag which appears inside the "<item>" tag.<br /> * However, we should take in consideration that the rss feed name also is enclosed in a "<title>" tag.<br /> * As we know, every feed begins with these lines: "<channel><title>Feed_Name...."
* so we should skip the "" tag which is a child of "<channel>" tag,<br /> * and take in consideration only "<title>" tag which is a child of "<item>"<br /> *<br /> * In order to achieve this, we will make use of a boolean variable.<br /> */<br /> boolean insideItem = false;<br /><br /> // Returns the type of current event: START_TAG, END_TAG, etc..<br /> int eventType = xpp.getEventType();<br /> while (eventType != XmlPullParser.END_DOCUMENT) {<br /> if (eventType == XmlPullParser.START_TAG) {<br /><br /> if (xpp.getName().equalsIgnoreCase("item")) {<br /> insideItem = true;<br /> } else if (xpp.getName().equalsIgnoreCase("title")) {<br /> if (insideItem)<br /> headlines.add(xpp.nextText()); //extract the headline<br /> } else if (xpp.getName().equalsIgnoreCase("link")) {<br /> if (insideItem)<br /> links.add(xpp.nextText()); //extract the link of article<br /> }<br /> }else if(eventType==XmlPullParser.END_TAG && xpp.getName().equalsIgnoreCase("item")){<br /> insideItem=false;<br /> }<br /><br /> eventType = xpp.next(); //move to next element<br /> }<br /><br /> } catch (MalformedURLException e) {<br /> e.printStackTrace();<br /> } catch (XmlPullParserException e) {<br /> e.printStackTrace();<br /> } catch (IOException e) {<br /> e.printStackTrace();<br /> }<br /><br /> // Binding data<br /> ArrayAdapter adapter = new ArrayAdapter(this,<br /> android.R.layout.simple_list_item_1, headlines);<br /><br /> setListAdapter(adapter);<br /><br /><br />}<br />public InputStream getInputStream(URL url) {<br /> try {<br /> return url.openConnection().getInputStream();<br /> } catch (IOException e) {<br /> return null;<br /> }<br /> }<br /><br />@Override<br />protected void onListItemClick(ListView l, View v, int position, long id) {<br /> Uri uri = Uri.parse((String) links.get(position));<br /> Intent intent = new Intent(Intent.ACTION_VIEW, uri);<br /> startActivity(intent);<br />}<br /></code><br /></pre></div><img src="http://pixel.quantserve.com/pixel/p-89EKCgBk8MZdE.gif" border="0" height="1" width="1" /></p><br /> <a href="http://stackoverflow.com/questions/4960499/parsing-rss-feed-to-android-application" target= "_blank" >.</a> <br/> <p> stackoverflow.comm</p></div> <div style='clear: both;'></div> </div> <div class='post-footer'> <div class='post-footer-line post-footer-line-1'> <span class='post-author vcard'> </span> <span class='post-timestamp'> at <meta content='https://android-ios-store.blogspot.com/2013/04/android-help-parsing-rss-feed-to.html' itemprop='url'/> <a class='timestamp-link' href='https://android-ios-store.blogspot.com/2013/04/android-help-parsing-rss-feed-to.html' rel='bookmark' title='permanent link'><abbr class='published' itemprop='datePublished' title='2013-04-11T08:55:00-07:00'>April 11, 2013</abbr></a> </span> <span class='post-comment-link'> <a class='comment-link' href='https://android-ios-store.blogspot.com/2013/04/android-help-parsing-rss-feed-to.html#comment-form' onclick=''> No comments: </a> </span> <span class='post-icons'> <span class='item-control blog-admin pid-1456614097'> <a href='https://www.blogger.com/post-edit.g?blogID=8510175475242461702&postID=5695286073331294874&from=pencil' title='Edit Post'> <img alt='' class='icon-action' height='18' src='https://resources.blogblog.com/img/icon18_edit_allbkg.gif' width='18'/> </a> </span> </span> <div class='post-share-buttons goog-inline-block'> <a class='goog-inline-block share-button sb-email' href='https://www.blogger.com/share-post.g?blogID=8510175475242461702&postID=5695286073331294874&target=email' target='_blank' title='Email This'><span class='share-button-link-text'>Email This</span></a><a class='goog-inline-block share-button sb-blog' href='https://www.blogger.com/share-post.g?blogID=8510175475242461702&postID=5695286073331294874&target=blog' onclick='window.open(this.href, "_blank", "height=270,width=475"); return false;' target='_blank' title='BlogThis!'><span class='share-button-link-text'>BlogThis!</span></a><a class='goog-inline-block share-button sb-twitter' href='https://www.blogger.com/share-post.g?blogID=8510175475242461702&postID=5695286073331294874&target=twitter' target='_blank' title='Share to X'><span class='share-button-link-text'>Share to X</span></a><a class='goog-inline-block share-button sb-facebook' href='https://www.blogger.com/share-post.g?blogID=8510175475242461702&postID=5695286073331294874&target=facebook' onclick='window.open(this.href, "_blank", "height=430,width=640"); return false;' target='_blank' title='Share to Facebook'><span class='share-button-link-text'>Share to Facebook</span></a><a class='goog-inline-block share-button sb-pinterest' href='https://www.blogger.com/share-post.g?blogID=8510175475242461702&postID=5695286073331294874&target=pinterest' target='_blank' title='Share to Pinterest'><span class='share-button-link-text'>Share to Pinterest</span></a> </div> </div> <div class='post-footer-line post-footer-line-2'> <span class='post-labels'> Labels: <a href='https://android-ios-store.blogspot.com/search/label/android%20help' rel='tag'>android help</a>, <a href='https://android-ios-store.blogspot.com/search/label/Parsing%20RSS%20feed%20to%20android%20application' rel='tag'>Parsing RSS feed to android application</a> </span> </div> <div class='post-footer-line post-footer-line-3'> <span class='post-location'> </span> </div> </div> </div> </div> <div class='post-outer'> <div class='post hentry uncustomized-post-template' itemprop='blogPost' itemscope='itemscope' itemtype='http://schema.org/BlogPosting'> <meta content='http://pixel.quantserve.com/pixel/p-89EKCgBk8MZdE.gif' itemprop='image_url'/> <meta content='8510175475242461702' itemprop='blogId'/> <meta content='1065542617140952389' itemprop='postId'/> <a name='1065542617140952389'></a> <h3 class='post-title entry-title' itemprop='name'> <a href='https://android-ios-store.blogspot.com/2013/04/android-help-progressbar-backround-not.html'>[android help] ProgressBar backround not showing on emulator but not on phone</a> </h3> <div class='post-header'> <div class='post-header-line-1'></div> </div> <div class='post-body entry-content' id='post-body-1065542617140952389' itemprop='articleBody'> <div><p><div itemprop="description"><br /><p>Im using ProgressBars in a ListView. The Background is white and the ProgressBar default.</p><br /><pre><br /><code><com.mitjahenner.kitchenhelper.ReverseProgressBar<br /> android:id="@+id/timerProgress"<br /> style="?android:attr/progressBarStyleHorizontal"<br /> android:layout_width="fill_parent"<br /> android:layout_height="wrap_content"<br /> android:layout_marginTop="10dp"<br /> android:layout_marginRight="3dp"<br /> android:layout_marginLeft="3dp" /><br /></code><br /></pre><br /><p>When I open the app in my 4.2.2 emulator everything looks normal (blue bar with gray background)</p><br /><p>But on my 4.2.2 (Gnex) phone its just the blue bar and no background at all (the white background from the parent view).</p><br /><p>Any idea what the problem could be?</p><br /></div><img border="0" height="1" src="http://pixel.quantserve.com/pixel/p-89EKCgBk8MZdE.gif" width="1" /></p><br /> <a href="http://stackoverflow.com/questions/15951421/progressbar-backround-not-showing-on-emulator-but-not-on-phone" target="_blank">.</a> <br/> <p> stackoverflow.comm</p></div> <div style='clear: both;'></div> </div> <div class='post-footer'> <div class='post-footer-line post-footer-line-1'> <span class='post-author vcard'> </span> <span class='post-timestamp'> at <meta content='https://android-ios-store.blogspot.com/2013/04/android-help-progressbar-backround-not.html' itemprop='url'/> <a class='timestamp-link' href='https://android-ios-store.blogspot.com/2013/04/android-help-progressbar-backround-not.html' rel='bookmark' title='permanent link'><abbr class='published' itemprop='datePublished' title='2013-04-11T08:44:00-07:00'>April 11, 2013</abbr></a> </span> <span class='post-comment-link'> <a class='comment-link' href='https://android-ios-store.blogspot.com/2013/04/android-help-progressbar-backround-not.html#comment-form' onclick=''> No comments: </a> </span> <span class='post-icons'> <span class='item-control blog-admin pid-1456614097'> <a href='https://www.blogger.com/post-edit.g?blogID=8510175475242461702&postID=1065542617140952389&from=pencil' title='Edit Post'> <img alt='' class='icon-action' height='18' src='https://resources.blogblog.com/img/icon18_edit_allbkg.gif' width='18'/> </a> </span> </span> <div class='post-share-buttons goog-inline-block'> <a class='goog-inline-block share-button sb-email' href='https://www.blogger.com/share-post.g?blogID=8510175475242461702&postID=1065542617140952389&target=email' target='_blank' title='Email This'><span class='share-button-link-text'>Email This</span></a><a class='goog-inline-block share-button sb-blog' href='https://www.blogger.com/share-post.g?blogID=8510175475242461702&postID=1065542617140952389&target=blog' onclick='window.open(this.href, "_blank", "height=270,width=475"); return false;' target='_blank' title='BlogThis!'><span class='share-button-link-text'>BlogThis!</span></a><a class='goog-inline-block share-button sb-twitter' href='https://www.blogger.com/share-post.g?blogID=8510175475242461702&postID=1065542617140952389&target=twitter' target='_blank' title='Share to X'><span class='share-button-link-text'>Share to X</span></a><a class='goog-inline-block share-button sb-facebook' href='https://www.blogger.com/share-post.g?blogID=8510175475242461702&postID=1065542617140952389&target=facebook' onclick='window.open(this.href, "_blank", "height=430,width=640"); return false;' target='_blank' title='Share to Facebook'><span class='share-button-link-text'>Share to Facebook</span></a><a class='goog-inline-block share-button sb-pinterest' href='https://www.blogger.com/share-post.g?blogID=8510175475242461702&postID=1065542617140952389&target=pinterest' target='_blank' title='Share to Pinterest'><span class='share-button-link-text'>Share to Pinterest</span></a> </div> </div> <div class='post-footer-line post-footer-line-2'> <span class='post-labels'> Labels: <a href='https://android-ios-store.blogspot.com/search/label/android%20help' rel='tag'>android help</a>, <a href='https://android-ios-store.blogspot.com/search/label/ProgressBar%20backround%20not%20showing%20on%20emulator%20but%20not%20on%20phone' rel='tag'>ProgressBar backround not showing on emulator but not on phone</a> </span> </div> <div class='post-footer-line post-footer-line-3'> <span class='post-location'> </span> </div> </div> </div> </div> <div class='post-outer'> <div class='post hentry uncustomized-post-template' itemprop='blogPost' itemscope='itemscope' itemtype='http://schema.org/BlogPosting'> <meta content='http://www.gravatar.com/avatar/9c1a2e02f6372c3d5c368f959b53fecf?s=32&d=identicon&r=PG' itemprop='image_url'/> <meta content='8510175475242461702' itemprop='blogId'/> <meta content='4946511622409349406' itemprop='postId'/> <a name='4946511622409349406'></a> <h3 class='post-title entry-title' itemprop='name'> <a href='https://android-ios-store.blogspot.com/2013/04/android-help-name-does-not-exist-in.html'>[android help] The name 'Assets' does not exist in the current context</a> </h3> <div class='post-header'> <div class='post-header-line-1'></div> </div> <div class='post-body entry-content' id='post-body-4946511622409349406' itemprop='articleBody'> <div><p><div><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>android - The name 'Assets' does not exist in the current context - Stack Overflow




















I have a problem with this line of code. Want to create sqlite database on the device.



string dbPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal) + "\\test.db";
if (!System.IO.File.Exists(dbPath))

using (System.IO.Stream sr = ***Assets***.Open("test.db"))
{
using (System.IO.Stream srTo = System.IO.File.Create(dbPath))
{
sr.CopyTo(srTo);
}
}


This message gives the: The name 'Assets' does not exist in the current context


























Change



Assets



to



getAssets().open("test.db")
























If you aren't doing this in an activity you need a reference to the Activity/Context. You will need to pass this in to your helper class in the constructor.



public yourClass(Activity context.......){

context.Assets.Open("your.db");
}



















lang-sql







.

stackoverflow.comm

[android help] Can all xml layout convert to java code in Android?

Can all xml layout convert to java code in Android? - Stack Overflow



















After developing few applications, I know that many people like to add view programmatic ally.
But is it all xml layout can convert to java code dynamically?
What is the pros and cons of using java code to generate the layout?


























The layout XML you are creating is being translated at run-time to java code. So the answer to your question is Yes. You can do the same and basically create all your layout in java code from scratch.


The obvious down grade of this thehnic as you know is that it will take you much more time to achieve the same result as with the XML file.
























But is it all xml layout can convert to java code dynamically?



Yes



What is the pros and cons of using java code to generate the layout?



According to the documentation the advantage to declaring your UI in XML is that it enables you to better separate the presentation of your application from the code that controls its behavior. Your UI descriptions are external to your application code, which means that you can modify or adapt it without having to modify your source code and recompile. For example, you can create XML layouts for different screen orientations, different device screen sizes, and different languages. Additionally, declaring the layout in XML makes it easier to visualize the structure of your UI, so it's easier to debug problems.


Please read this link for more details




















default






.

stackoverflow.comm

[android help] MapFragment in a fragment Vs MapView in a fragment with Google Maps api v2


I have an app having actionbar where one of the fragments contain a mapFragment. Also, i've to make an overlay of list on top of the map. MapFragment as of now as lesser functionality(i cant make setInfoWindowAdapter to work in it).So my question is should I be using Mapview within a fragment or MapFragment within in a fragment? which is the best practice? I've read through many articles but none them exactly mention which is the best option and why.



.

stackoverflow.comm

[android help] Check if app is open during a GCM onMessage event?


I would use order broadcast to do that.


In your onMessagemethod:



Intent responseIntent = new Intent("com.yourpackage.GOT_PUSH");
sendOrderedBroadcast(responseIntent, null);


In your Activity:



public class YourActivity extends Activity {

final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {

@Override
public void onReceive(Context context, Intent intent) {
//Right here do what you want in your activity
abortBroadcast();
}
};

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

//.....
}

@Override
protected void onPause() {
unregisterReceiver(mBroadcastReceiver);
super.onPause();
}

@Override
protected void onResume() {
IntentFilter filter = new IntentFilter("com.yourpackage.GOT_PUSH");
filter.setPriority(2);
registerReceiver(mBroadcastReceiver, filter);
super.onResume();
}
}


The other BroadcastReceiver



public class SecondReceiver extends BroadcastReceiver {

@Override
public void onReceive(Context context, Intent intent) {
//In this receiver just send your notification
}

}


Manifest:



android:name=".YourActivity"
android:label="@string/app_name">

android:name="android.intent.action.MAIN" />
android:name="android.intent.category.LAUNCHER" />


android:name=".SecondReceiver">
android:priority="1">
android:name="com.yourpackage.GOT_PUSH">




Basically in the onMessage method you send an Intent which is first received by the BroadcastReceiver registered inside YourActivity if it is running and in foreground, otherwise it is received by the SecondReceiver.



.

stackoverflow.comm

[android help] Android Fast and Precise Canvas Graphing?


I am developing an android application which gets graph values over tcp and draws the graph realtime and continuously.The application has to draw 100 pixels/values per second, finishing a 1000 pixel width graph in 10 seconds.


I am developing on a Samsung Galaxy Tab 10.1 Tablet.


Below is the main activity code.I just pasted necessary parts.



public class MainActivity extends Activity {

private MyGraph graph;
private Handler mHandler;
private Handler mHandler2;
private boolean running;

public static int counter=1;
private int limit=1000;

private class MyGraph extends View {

private Paint paintecg = new Paint();
private Paint paintdel = new Paint();
private Canvas canvas = new Canvas();

private Bitmap cache = Bitmap.createBitmap(1000,800, Bitmap.Config.ARGB_8888);

private float nextX; //next point in x axis
private float lastX=0;
private float nextY; // next point in y axis
private float lastY=150;

public MyGraph(Context context){
super(context);

paintecg.setStyle(Paint.Style.STROKE);
paintecg.setColor(Color.GREEN);
paintecg.setAntiAlias(true); paintecg.setStrokeWidth(2f);

paintdel.setStyle(Paint.Style.FILL_AND_STROKE);
paintdel.setColor(Color.BLACK);

}

public void onDraw(Canvas canvas) {
if (cache != null)
canvas.drawBitmap(cache, 0, 0, paintecg);

}

public void drawNext() {
canvas = new Canvas(cache);

nextX=lastX+1;
//adding new points to the graph
canvas.drawLine(lastX,valuearray_ecg[counter-1],nextX,valuearray_ecg[counter], paintecg);
//emptying next 25 pixels
canvas.drawRect(nextX, 0, nextX+25, 800, paintdel);

lastX=nextX;

if (nextX counter++;
}
else {
counter=1;
lastX=0;
}
postInvalidate();
}

}


}


This is the handler created inside oncreate() method :



LinearLayout graphView=(LinearLayout) findViewById(R.id.layout_graph);
graph = new MyGraph(this);
mHandler = new Handler(new Handler.Callback() {
@Override
public boolean handleMessage(Message msg) {
graph.drawNext();
if (running)
mHandler.sendMessageDelayed(new Message(), 10);
return true;
}
});
graphView.addView(graph);


Graph is drawed inside a layout in main.xml


This way, when i set handler to 20 ms and my x-axis steps to 2 pixels, it draws 1000 pix in around 15 seconds.Weird thing is, if i lock and unlock the device while app is running, timing becomes normal and draws 1000 pixels in 10 seconds.


when i set handler's delay to 10 miliseconds and x-axis steps to 1 pixel, at first it draws 1000 pixels in 25+ seconds.After locking and unlocking it drops 20- seconds.


I see i'm probably doing it wrong.My question is, is there any way to draw a graph that fast using android's native canvas drawing? Or what is the best way to handle an app like this?



.

stackoverflow.comm

[android help] Invalid file on uploading text file to sever with HttpPost?


I'm trying to upload a text file that already is in SD-card of emulator and it's size is less than 4KB.This is php code for uploading file in server side:



$allowedExts = array("jpg", "jpeg", "gif", "png", "txt", "xml");
$extension = end(explode(".", $_FILES["file"]["name"]));
if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/png")
|| ($_FILES["file"]["type"] == "image/pjpeg")
|| ($_FILES["file"]["type"] == "text/plain")
|| ($_FILES["file"]["type"] == "text/xml"))
&& ($_FILES["file"]["size"] < 2000000)
&& in_array($extension, $allowedExts))
{
if ($_FILES["file"]["error"] > 0)
{
echo "Return Code: " . $_FILES["file"]["error"] . "
";
}
else
{
echo "Upload: " . $_FILES["file"]["name"] . "
";
echo "Type: " . $_FILES["file"]["type"] . "
";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB
";
echo "Temp file: " . $_FILES["file"]["tmp_name"] . "
";

if (file_exists("upload/" . $_FILES["file"]["name"]))
{
echo $_FILES["file"]["name"] . " already exists. ";
}
else
{
move_uploaded_file($_FILES["file"]["tmp_name"],
"upload/" . $_FILES["file"]["name"]);
echo "Stored in: " . "upload/" . $_FILES["file"]["name"];
}
}
}
else
{
echo "Invalid file";
}
?>


To upload text file,I execute an AsyncTask and it is it's doInBackground():



@Override
protected Boolean doInBackground(String... url) {
File home = new File(path + "/" + "home #" + address + ".txt");
String response;
try {
response = OpenHttpConnection(home, "text/plain");
} catch (IOException e) {
return false;
}
if (response.toLowerCase().contains("invalid")) {
return false;
}
return true;
}


This is OpenHttpConnection method:



private String OpenHttpConnection(File file, String mime)
throws IOException {

StringBuilder s = null;
try {
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(
Constants.UPLOAD_ADDRESS);

MultipartEntity entity = new MultipartEntity();

entity.addPart("data", new FileBody(file, mime));
httppost.setEntity(entity);
HttpResponse response = httpclient.execute(httppost);
BufferedReader reader = new BufferedReader(new InputStreamReader(
response.getEntity().getContent(), "UTF-8"));
String sResponse;
s = new StringBuilder();

while ((sResponse = reader.readLine()) != null) {
s = s.append(sResponse);
}

} catch (Exception e) {
e.printStackTrace();
return "exception " + e.toString();
}

return s.toString();
}


But upload failed and when I debug uploading progress,response(in "doInBackground") is equal to "Invalid file".Also I tried to change OpenHttpConnection() method and create entity of HttpPost without using "mime type",like this:



entity.addPart("data", new FileBody(file));


But result is same.Is there any thing that I did wrong?



.

stackoverflow.comm

Wednesday, April 10, 2013

[android help] Android: Obtaining a generated variable and its values?


I am making an app that encrypts plain text and then sends it via email. My cText variable that I have created in the 'encrypt' method (created from passT and keyT that user inputs) is returned at the end of the method. I am curious, however, as to how I am going to incorporate it in my onCreate method for including it's new encrypted contents into an email? Below is what I have however I am only getting errors:



public class ScreenNext extends Activity {

int key = 0;
static char ch;

protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_screen_next)

EditText emailT;//Import EditTexts (Key and Email)
Button send = (Button) findViewById(R.id.bSend);//Import button1 (Send)
final EditText passT = (EditText) findViewById(R.id.etTogg);//passT variable for Password Text for EditText field
final EditText keyT = (EditText) findViewById(R.id.etKey);
final EditText passT = (EditText) findViewById(R.id.etTogg);//passT variable for Password Text for EditText field

send.setOnClickListener(new OnClickListener() {

public void onClick(View v) {
// TODO Auto-generated method stub
String keyText = keyT.getText().toString();
String passText = passT.getText().toString();
String EmailAdd = emailT.getText().toString();

//This must be fixed
//String cipherText = cText.getText().toString();


Intent email = new Intent(Intent.ACTION_SEND);//The intent
email.setType("plain/text");
email.putExtra(Intent.EXTRA_EMAIL, new String[]{EmailAdd.toString()});
email.putExtra(Intent.EXTRA_SUBJECT, "Your encrypted Password");//Subject is hard coded for convenience sake
email.putExtra(Intent.EXTRA_TEXT, cText.toString());//Here we add encrypted Password that has just been generated
startActivity(email);//Start the activity
}

});

}//End onCreate
...
}


And my encryption method:



public static String message(String choice, String subKey, String message) {
int Option = Integer.parseInt(choice);//Must pareseInt
int key = Integer.parseInt(subKey);
message = message.toLowerCase();


ScreenNext subcipher_1 = null;
String CipherTxt = subcipher_1.encrypt(message, key);
return CipherTxt;
}


public static String encrypt(String Txt, int key) {

//local var cipherText of type string is init empty
String CipherTxt = "";//May be able to remove this'un
String cText="";
//enhanced for loop
// start at 0, go until "as long as input text"
for (int i = 0; i < Txt.length(); i++) {
//get a char from the string at index i (start at 0 work through to end of string)
// and store in local var extractedChar for type char
char extractedChar = Txt.charAt(i);
/* enhanced for loop
* start at 0, go until end of user entered cipherKeyValue
* either set to lowercase a or add one to the char
* uses the checkifz method
*/
for (int j = 0; j < key; j++) {
ScreenNext subcipher_1 = null;
if (subcipher_1.checkIfZ(extractedChar) == true) {
extractedChar = 'a';
} else {
extractedChar++;
}
CipherTxt= new StringBuilder().append(extractedChar).toString();
}
//add extracted char to builder object
//change object builder to string and assing to cipherText of type String
//create new object builder from StringBuilder class
cText = cText.concat(CipherTxt);
}
//Pass the cipherText value out of the method to whom ever called it

return cText;
}


Any help is very much appreciated.



.

stackoverflow.comm

[General] Huawei U8160 Home button


Hi, Please help!!! The home button on my U8160 is not displaying the home screen anymore. It just vibrates but nothing else happens. Any solutions. besides I have also lost the lock screen page is not displayed anymore. How can I get it back?
Thanks



.

forum.xda-developers.com

Google Voice on T-Mobile? [General]

Google Voice on T-Mobile? So I recently switched from a GNex on Verizon to a Moto X DE on T-Mobile. I had always used Google Voice for my v...