Skip to content

Instantly share code, notes, and snippets.

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.support.v4.app.Fragment;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.os.Bundle;
import android.view.Menu;
import java.util.ArrayList;
import java.util.Set;
import android.app.Activity;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothSocket;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.IntentFilter;
import android.os.Bundle;
import android.view.Menu;
import java.io.IOException;
import java.util.ArrayList;
public void bluetoothConnection(View view) {
//private final BluetoothSocket mmSocket;
//private final BluetoothDevice mmDevice;
BluetoothConnectThread confectionTest = new BluetoothConnectThread(mBluetoothAdapter);
Toast.makeText(getApplicationContext(), "bluetoothConnection()",
Toast.LENGTH_SHORT).show();
}
private class BluetoothConnectThread extends Thread {
private final BluetoothSocket mmSocket;
-----------------------
BluetoothChat.java
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.option_menu, menu);
return true;
}
------------------------
#include <stdio.h>
// main(){
// char myArray[80], search, *ptr;
// int cnt=0;
// printf(" Type a phrase... ");
// gets(myArray);
// printf(" enter a special character to be searched and counted:\n");
// scanf(" %c", &search);
// ptr = myArray;
#include <stdio.h>
#include <conio.h>
int sOcc(char *ptr, char specialChar);
main(){
char myArray[80], search, *ptr;
int cnt=0;
printf(" Please enter a phrase... ");
gets(myArray);
#include <stdio.h>
int sOcc(char *ptr, char *specialChar);
main(){
char myArray[80], search, *ptr;
int cnt=0;
printf("\n Please enter a phrase... ");
gets(myArray);
printf(" Please enter a search char ...");
/* Write a c program to convert given number of days to a measure of time
* given in years, weeks and days. For example 375 days is equal to 1 year
* 1 week and 3 days (ignore leap year)
*/
#include <stdio.h>
#define DAYSINWEEK 7
void main()
{
#include <stdio.h>
#include <stdbool.h>
/* This function calculates (ab)%c */
int modulo(int a,int b,int c){
long long x=1,y=a; // long long is taken to avoid overflow of intermediate results
while(b > 0){
if(b%2 == 1){
x=(x*y)%c;
}