Я пытался создать приложение для использования, но у меня возникают проблемы, когда я добавляю кнопку «Поделиться», можете ли вы помочь мне устранить ошибку
Это мой фрагмент кода для общего доступа к синтаксису в MainActivity:
// sharebutton start
ImageView btn_share=(ImageView)findViewById(R.id.share_its);
btn_share.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
shareIt();
}
});
}
private void shareIt() {
//sharing implementation here
Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
sharingIntent.setType("text/plain");
sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "SUBJEK TEKS");
sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, "TEXT TO SHARE ");
startActivity(Intent.createChooser(sharingIntent, "SHARE IT"));
// Sharebutton end
}
полный код в https://pastebin.com/qwD7KtPD
Это мой main.xml
<item
android:id="@+id/action_settings"
android:orderInCategory="100"
android:title="@string/action_settings"
app:showAsAction="never"
android:visible="false"/>
<item
android:id="@+id/action_laporan"
android:title="Laporan"
app:showAsAction="always"
android:orderInCategory="0"/>
<ImageView
android:id="@+id/btn_share"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="bottom|right"
android:background="@color/bottomlogo"
android:paddingTop="10dp"
android:paddingBottom="10dp"
app:showAsAction="always"
android:src="@drawable/ic_menu_share" />
после компиляции в .apk я получаю ошибку