Posts

Showing posts from August, 2020

Receiving Simple Data from Other Apps Using Sketchware

Image
Add this code in onCreate : // Get intent, action and MIME type     Intent intent = getIntent();     String action = intent.getAction();     String type = intent.getType(); if (Intent.ACTION_SEND.equals(action) && type != null) {  if ("text/plain".equals(type)) {   shared = intent.getStringExtra(Intent.EXTRA_TEXT);   YourWidget.setText(shared);  } } Inject this code in manifest.xml : <intent-filter>  <action android:name="android.intent.action.MAIN" />  <category android:name="android.intent.category.LAUNCHER" />   </intent-filter>    <intent-filter>     <action android:name="android.intent.action.SEND" />  <category android:name="android.intent.category.DEFAULT" />  <data android:mimeType="text/plain" />   </intent-filter> Video tutorial  

Add CustomView to ToolBar [make search bar]

Image
Hi guys in this article I will show you how to add CustomView to your ToolBar in Sketchware  What you need is: Enabling appcompat library  Create a new CustomView  Design your CustomView for me I added edittext1 & button1 Add this code getSupportActionBar().setDisplayShowTitleEnabled( false ); getSupportActionBar().setDisplayHomeAsUpEnabled( false ); View logo = getLayoutInflater().inflate( R .layout.dvv, null ); logo.setLayoutParams( new LinearLayout .LayoutParams(android.widget. LinearLayout .LayoutParams.MATCH_PARENT, android.widget. LinearLayout .LayoutParams.MATCH_PARENT)); _toolbar.addView(logo); final Button button1 = ( Button )logo.findViewById( R .id.button1); final EditText edittext1 = ( EditText )logo.findViewById( R .id.edittext1); button1.setOnClickListener( new View .OnClickListener() { public void onClick ( View v) { SketchwareUtil.showMessage(getApplicationContext(), edittext1.getText().toStri...