This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//This demo app Assumes there are 2 jpg files on the sdcard in the root directory | |
public class MainActivity extends ActionBarActivity { | |
ImageView img; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyAppClass extends Application | |
{ | |
public static Typeface FONT_AWESOME; | |
public static FontAwesomeHelper FONT_AWESOME_HELPER; | |
@Override | |
public void onCreate() | |
{ | |
super.onCreate(); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BarsFragment extends Fragment { | |
int[] positionsArray = new int[4]; | |
VerticalSeekBar[] seekBarArray; | |
LinearLayout ll; | |
@Override | |
public View onCreateView(LayoutInflater inflater, ViewGroup container, | |
Bundle savedInstanceState) { | |
View view = inflater.inflate(R.layout.barsfragment, container, false); | |
String myTag = getTag(); | |
((MainActivity) getActivity()).setFragmentTag(myTag); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int currentapiVersion = android.os.Build.VERSION.SDK_INT; | |
if (currentapiVersion >= android.os.Build.VERSION_CODES.HONEYCOMB) { | |
android.content.ClipboardManager clipboard = (android.content.ClipboardManager) getSystemService(CLIPBOARD_SERVICE); | |
ClipData clip = ClipData.newPlainText("label", shortUrl); | |
clipboard.setPrimaryClip(clip); | |
Toast toast = Toast.makeText(getApplicationContext(),"copied", Toast.LENGTH_LONG); | |
toast.setGravity(Gravity.CENTER, 0, 0); | |
toast.show(); | |
} else { | |
android.text.ClipboardManager clipboard = (android.text.ClipboardManager) getSystemService(CLIPBOARD_SERVICE); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
if (v == findViewById(R.id.emailbtn)) { | |
Intent emailIntent = new Intent(Intent.ACTION_SENDTO,Uri.fromParts("mailto", "@", null)); | |
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "TITLE"); | |
emailIntent.putExtra(Intent.EXTRA_TEXT, "TEXT"); | |
startActivity(Intent.createChooser(emailIntent, "Send email...")); | |
} else if (v == findViewById(R.id.smsbtn)) { | |
Uri uri = Uri.parse("smsto:"); | |
Intent it = new Intent(Intent.ACTION_SENDTO, uri); | |
it.putExtra("sms_body", "BODY"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ListViewAdapter extends BaseAdapter { | |
private Activity activity; | |
private ArrayList<VideoObject> data; | |
private static LayoutInflater inflater = null; | |
public ImageLoader imageLoader; | |
Context cx; | |
public ListViewAdapter(Activity a, ArrayList<VideoObject> videoObjListParam) { | |
activity = a; | |
inflater = (LayoutInflater) activity | |
.getSystemService(Context.LAYOUT_INFLATER_SERVICE); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
StringBuffer outputx = null; | |
try { | |
Process processx = Runtime.getRuntime().exec("/data/data/com.example.ffmpegencode/ffmpeg -loop_input -i /sdcard/go.jpg -i /sdcard/gohoubi.m4a -shortest -acodec copy /sdcard/goood.mp4"); | |
BufferedReader in = new BufferedReader(new InputStreamReader(processx.getInputStream())); | |
String line = null; | |
while ((line = in.readLine()) != null) { | |
Log.d("", "line"); | |
} | |
Log.d("", "encoding..."); | |
processx.waitFor(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find someDir/ -iname "*.flv" -exec ffmpeg -i {} -sameq -ar 22050 {}.mp4 ";" -ls | |
vlc * --sout '#transcode{vcodec=h264,vb=92,channels=1,ab=16,samplerate=1024,width=320}:standard{access=http,mux=ts,dst=:666/tv.mp4}' --random --sout-keep | |
awk -F'[ "]+' '$7 == "/" { ipcount[$1]++ }END { for (i in ipcount) {printf "%15s - %d\n", i, ipcount[i] } }' /var/log/apache2/access.log | |
ffmpeg -loop 1 -shortest -y -i img.jpg -i snd.wav -acodec copy -vcodec mjpeg out.avi | |
ls * |sort > play.txt | |
cat play.txt | while IFS= read -r f; do printf "%05d %s\n" "$RANDOM" "$f"; done | sort -n | cut -c7- >> play.m3u | |
sed -e 's/$/\nwf.mp4/' -i play.m3u |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//**in the service (ServiceX) | |
public static boolean isRunning(Context ctx) { | |
sharedPref = ctx.getSharedPreferences("my_pref", MODE_PRIVATE); | |
return sharedPref.getBoolean("running", false); | |
} | |
private void setRunning(boolean running) { | |
sharedPref = getSharedPreferences("my_pref", MODE_PRIVATE); | |
SharedPreferences.Editor prefEditor = sharedPref.edit(); | |
prefEditor.putBoolean("running", running); | |
prefEditor.commit(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Act extends Activity { | |
OnTaskCompleted otc = new OnTaskCompleted() { | |
@Override | |
public void onTaskCompleted(String result) { | |
Log.d("onTaskCompleted", result); | |
} | |
}; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); |
OlderNewer